You've already forked TrustTunnelClient
mirror of
https://github.com/TrustTunnel/TrustTunnelClient.git
synced 2026-02-03 10:11:13 -08:00
Squashed commit of the following: commit bf55de27d4bc565f321175c8c974e4424adc83ea Author: Sergey Fionov <sfionov@adguard.com> Date: Thu Jan 22 16:59:39 2026 +0200 Revert "Revert "Fix spec"" This reverts commit c54f88a1ad9b91392476f3963d9d743dc0e245fb. commit 683608ef3c37433a5bdb8693bf0ab8f47573c182 Author: Sergey Fionov <sfionov@adguard.com> Date: Thu Jan 22 16:53:31 2026 +0200 skipci: Win use static CRT commit c54f88a1ad9b91392476f3963d9d743dc0e245fb Author: Sergey Fionov <sfionov@adguard.com> Date: Thu Jan 22 16:52:23 2026 +0200 Revert "Fix spec" This reverts commit d896c59c6051d16aaaae15c9b232b733af74a703. commit d896c59c6051d16aaaae15c9b232b733af74a703 Author: Sergey Fionov <sfionov@adguard.com> Date: Thu Jan 22 16:36:57 2026 +0200 Fix spec commit e995a888eafbedf9d995ab42b7929bd47e2df0e6 Author: Sergey Fionov <sfionov@adguard.com> Date: Thu Jan 22 16:28:08 2026 +0200 skipci: Fix after fix commit 9c950378fde758e673a16be85d4b0e29b44dc081 Author: Sergey Fionov <sfionov@adguard.com> Date: Thu Jan 22 16:19:51 2026 +0200 skipci: Fix commit eebf30dcbbbc36a02ea87b75e6fb3f4025deebad Author: Sergey Fionov <sfionov@adguard.com> Date: Thu Jan 22 16:11:46 2026 +0200 skipci: Fix commit 0226bdd71c13129b6c2236de4130d7b0042d806c Author: Sergey Fionov <sfionov@adguard.com> Date: Thu Jan 22 16:04:48 2026 +0200 Fix commit 14059f5b78c1bf68bdd04d928a94a68a5f2ff6e2 Author: Sergey Fionov <sfionov@adguard.com> Date: Thu Jan 22 15:56:17 2026 +0200 Add signing commit 07467b0834eca47934418bf3962c6b5bce09066e Author: Sergey Fionov <sfionov@adguard.com> Date: Thu Jan 22 15:30:34 2026 +0200 Cargo.lock commit 5a51983b14bf74892726e732077b4a80beafab16 Author: Sergey Fionov <sfionov@adguard.com> Date: Thu Jan 22 15:26:39 2026 +0200 Add RC files commit 8e886470a8b6a95966a2cf430cf7c1202586f238 Author: Sergey Fionov <sfionov@adguard.com> Date: Thu Jan 22 13:09:31 2026 +0200 skipci: Fix commit f36ecce36b3eca26a568028631596107ccb53cac Author: Sergey Fionov <sfionov@adguard.com> Date: Thu Jan 22 12:58:20 2026 +0200 Wintun commit 3d352b3833ebca34686b212d3e1a6c1e42d93008 Author: Sergey Fionov <sfionov@adguard.com> Date: Thu Jan 22 12:38:56 2026 +0200 Add Windows binary
61 lines
1.7 KiB
Python
61 lines
1.7 KiB
Python
import os
|
|
import sys
|
|
import pathlib
|
|
import requests
|
|
|
|
|
|
def main() -> int:
|
|
if len(sys.argv) != 2:
|
|
print("usage: win_sign_binary.py <path-to-exe>", file=sys.stderr)
|
|
return 2
|
|
|
|
signer_url = os.environ.get("bamboo_signerUrl") or os.environ.get("SIGNER_URL")
|
|
api_key = os.environ.get("bamboo_trustTunnelWinSignerSecretApiKey") or os.environ.get("SIGNER_API_KEY")
|
|
|
|
if not signer_url:
|
|
print("bamboo_signerUrl is not set", file=sys.stderr)
|
|
return 2
|
|
if not api_key:
|
|
print("bamboo_trustTunnelWinSignerSecretApiKey is not set", file=sys.stderr)
|
|
return 2
|
|
|
|
in_path = pathlib.Path(sys.argv[1])
|
|
if not in_path.exists():
|
|
print(f"File not found: {in_path}", file=sys.stderr)
|
|
return 2
|
|
|
|
out_path = in_path.with_suffix(in_path.suffix + ".signed")
|
|
|
|
try:
|
|
with in_path.open("rb") as f:
|
|
files = {"file": (in_path.name, f)}
|
|
r = requests.post(
|
|
signer_url,
|
|
headers={"Authorization": f"Bearer {api_key}"},
|
|
files=files,
|
|
timeout=300,
|
|
)
|
|
except Exception as e:
|
|
print(f"Signing request failed for {in_path}: {e}", file=sys.stderr)
|
|
return 1
|
|
|
|
if r.status_code < 200 or r.status_code >= 300:
|
|
print(
|
|
f"Signing failed for {in_path}. Status={r.status_code} Body={r.text}",
|
|
file=sys.stderr,
|
|
)
|
|
return 1
|
|
|
|
try:
|
|
out_path.write_bytes(r.content)
|
|
out_path.replace(in_path)
|
|
except Exception as e:
|
|
print(f"Failed to write signed file for {in_path}: {e}", file=sys.stderr)
|
|
return 1
|
|
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|