Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3b0dc6c8a | ||
|
|
bfda29a845 |
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import pathlib
|
import pathlib
|
||||||
|
import struct
|
||||||
import sys
|
import sys
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ def release(version: str, exe: str, out_dir: str) -> None:
|
|||||||
exe_path = pathlib.Path(exe)
|
exe_path = pathlib.Path(exe)
|
||||||
if exe_path.suffix != ".exe" or not exe_path.is_file():
|
if exe_path.suffix != ".exe" or not exe_path.is_file():
|
||||||
sys.exit(f"not a Windows executable: {exe}")
|
sys.exit(f"not a Windows executable: {exe}")
|
||||||
|
signed = _has_authenticode_signature(exe_path)
|
||||||
name = f"alkane-toolkit-v{version}-windows-x86_64"
|
name = f"alkane-toolkit-v{version}-windows-x86_64"
|
||||||
out = pathlib.Path(out_dir) / f"{name}.zip"
|
out = pathlib.Path(out_dir) / f"{name}.zip"
|
||||||
out.parent.mkdir(parents=True, exist_ok=True)
|
out.parent.mkdir(parents=True, exist_ok=True)
|
||||||
@@ -35,6 +37,14 @@ def release(version: str, exe: str, out_dir: str) -> None:
|
|||||||
"Run alkane-toolkit.exe. No installer and no extra runtime are needed:\r\n"
|
"Run alkane-toolkit.exe. No installer and no extra runtime are needed:\r\n"
|
||||||
"the executable is self-contained and runs on Windows 10 and 11.\r\n"
|
"the executable is self-contained and runs on Windows 10 and 11.\r\n"
|
||||||
"\r\n"
|
"\r\n"
|
||||||
|
+ (
|
||||||
|
"The executable is signed by Blueflare (Azure Artifact Signing). To check:\r\n"
|
||||||
|
"right-click alkane-toolkit.exe > Properties > Digital Signatures.\r\n"
|
||||||
|
if signed else
|
||||||
|
"This build is not code-signed, so Windows SmartScreen may warn on first\r\n"
|
||||||
|
"run: choose More info > Run anyway.\r\n"
|
||||||
|
)
|
||||||
|
+ "\r\n"
|
||||||
"Settings are kept in %APPDATA%\\alkane-toolkit.\r\n"
|
"Settings are kept in %APPDATA%\\alkane-toolkit.\r\n"
|
||||||
"SSH-based actions use the OpenSSH client built into Windows (ssh.exe);\r\n"
|
"SSH-based actions use the OpenSSH client built into Windows (ssh.exe);\r\n"
|
||||||
"HTTP actions use curl.exe, also built in.\r\n"
|
"HTTP actions use curl.exe, also built in.\r\n"
|
||||||
@@ -49,6 +59,15 @@ def release(version: str, exe: str, out_dir: str) -> None:
|
|||||||
print(out)
|
print(out)
|
||||||
|
|
||||||
|
|
||||||
|
def _has_authenticode_signature(exe: pathlib.Path) -> bool:
|
||||||
|
"""True if the PE file carries a certificate table (an Authenticode signature)."""
|
||||||
|
data = exe.read_bytes()
|
||||||
|
pe = struct.unpack_from("<I", data, 0x3C)[0]
|
||||||
|
magic = struct.unpack_from("<H", data, pe + 24)[0]
|
||||||
|
dirs = pe + 24 + (96 if magic == 0x10B else 112)
|
||||||
|
return struct.unpack_from("<II", data, dirs + 4 * 8)[1] > 0
|
||||||
|
|
||||||
|
|
||||||
def tests(cargo_json: str, out_zip: str) -> None:
|
def tests(cargo_json: str, out_zip: str) -> None:
|
||||||
executables = []
|
executables = []
|
||||||
for line in pathlib.Path(cargo_json).read_text().splitlines():
|
for line in pathlib.Path(cargo_json).read_text().splitlines():
|
||||||
|
|||||||
+5
-2
@@ -73,8 +73,11 @@ Signing (formerly Trusted Signing), so Windows and SmartScreen show
|
|||||||
| Signer | `ci/sign-windows.sh` (jsign from the CI image, RFC 3161 timestamp from `timestamp.acs.microsoft.com`) |
|
| Signer | `ci/sign-windows.sh` (jsign from the CI image, RFC 3161 timestamp from `timestamp.acs.microsoft.com`) |
|
||||||
| Check | `windows-native.yml` requires `Get-AuthenticodeSignature` = Valid on real Windows once signing is on |
|
| Check | `windows-native.yml` requires `Get-AuthenticodeSignature` = Valid on real Windows once signing is on |
|
||||||
|
|
||||||
Turning it on, once Microsoft approves the identity validation (portal:
|
Signing is on since 2026-11-03 (identity validation approved, certificate
|
||||||
signing account > Identity validations):
|
profile `alkane-toolkit`, PublicTrust). The zip's README.txt states whether its
|
||||||
|
executable is signed. To set it up again, e.g. for a new profile, after an
|
||||||
|
identity validation is approved (portal: signing account > Identity
|
||||||
|
validations):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
scripts/enable-windows-signing.sh <identity-validation-id>
|
scripts/enable-windows-signing.sh <identity-validation-id>
|
||||||
|
|||||||
Reference in New Issue
Block a user