-
Notifications
You must be signed in to change notification settings - Fork 85
SignPath
- OSS 組織として登録する
- テスト証明書・リリース証明書を提供してくれる
- Artifact Configurations で、署名するファイルの設定をする
- 署名されたバイナリは "Signing Requests" (artifact 置き場) に出力される
- 単体の実行ファイル
- zip ファイル内の実行ファイル
- msi ファイル内の実行ファイルと msi ファイル
Artifact Configurationは、どのように署名するかの指定である。cf. 公式ドキュメント: Artifact Configuration
Tera Term の zip ファイルはこのような構成になっているので、zip ファイル内のフォルダ名がリリースごとに異なる。
teraterm-5.5.0.zip:
/teraterm-5.5.0/
+--- ttermpro.exe
+--- keycode.exe
+--- ttpmacro.exe
+--- ttpcmn.dll
+--- ttxssh.dll
:
そのため、署名用に毎回構造が変わらない zip ファイルを作成して署名している。
<?xml version="1.0" encoding="utf-8" ?>
<artifact-configuration xmlns="http://signpath.io/artifact-configuration/v1">
<zip-file>
<pe-file-set>
<include path="teraterm\ttermpro.exe" />
<include path="teraterm\keycode.exe" />
<include path="teraterm\ttpmacro.exe" />
<for-each>
<authenticode-sign />
</for-each>
</pe-file-set>
</zip-file>
</artifact-configuration>
-
Trusted Build System
- 公開されているコミットから、途中に余計な処理をはさまずビルドされたことを検証できる
- 手動署名
GitHub Actions を使うことにしたので、AppVeyor は使用しないことにした。資料としてのみ残す
SignPath の Trusted Build System を使う(AppVeyor ビルドの artifact から、自動的に署名された artifact を作成する(SignPath 側に生成される))には /appveyor.yml が必要となる。
The build configuration must be stored in the root directory under the name appveyor.yml or .appveyor.yml (no custom name is allowed to be set under Project settings and Custom configuration .yml file name)
Custom configuration .yml file name を指定せず、root に置いた appveyor.yml を使わせるには、AppVeyor プロジェクトの種類を GitHub にする必要がある。Generic Git では appveyor.yml が使われない。
"appveyor.yml を root に置く" は、"main(デフォルト)ブランチの root" でなくてよい。ブランチの root に置いても動作する。
AppVeyor と連携するサンプルを見ると、artifacts の後の deploy で署名を呼んでいる。
- 1回のリクエストで1つの artifact しか署名できない
- 「実行ファイルを署名 > インストーラを作成 > インストーラを署名」という順にはできない。
そのため
- ポータブル.zip 内の実行ファイルは署名できる
- インストーラ.exe は署名できる
- インストーラに含まれる各実行ファイルを署名して、かつインストーラを署名することできない。
- SignPath のプロジェクトに AppVeyor を組み込む
- AppVeyor > Account > Security
- v1, v2 を有効にする
- AppVeyor > My profile > Api keys
- "teraterm" アカウントの
Bearer token 文字列をコピーする
- "teraterm" アカウントの
- SignPath > Project > teraterm > Trusted Build Systems > Link > AppVeyor
- AppVeyor API key に上記の
Bearer token 文字列を入力する("Bearer " は不要) - Artifact path に
installer\Output\teraterm-5.x.x.zip(そのときのバージョンを指定) を入力する
- AppVeyor API key に上記の
- AppVeyor > Account > Security
- AppVeyor に SignPath API token を設定する
-
CI buildsユーザの API token をコピーする- 生成したときにしか表示されない
- 現在の設定値は "プロジェクト管理情報" を参照のこと
- 再生成する場合
- SignPath > Users and Groups > CI builds > API token
- 生成した文字列をコピーする
- AppVeyor > Account > Encrypt YAML
-
Bearer 生成した文字列を入力し Encrypt する
-
- "プロジェクト管理情報" を更新する
- SignPath > Users and Groups > CI builds > API token
- 生成したときにしか表示されない
- appveyor.yml の authorization secure に記述する
-
Trusted build systems では、AppVeyor の artifact が複数ある場合、その中の1ファイルしか署名することができない。
そのため、署名するファイルのパスを指定する必要がある。
資料: SignPath による説明