Ship Windows x64 through a separately signed official GNU release channel
This commit is contained in:
+18
-4
@@ -126,6 +126,13 @@ def https(value):
|
||||
return url
|
||||
|
||||
|
||||
def release_label(platform, official_windows):
|
||||
if official_windows:
|
||||
check(platform == WINDOWS_GNU, 'official Windows releases require a GNU x64 build receipt')
|
||||
return 'windows-gnu-official'
|
||||
return {LINUX: 'linux', WINDOWS: 'windows', WINDOWS_GNU: 'windows-gnu'}[platform]
|
||||
|
||||
|
||||
def prepare(args):
|
||||
provision_folder(args.state)
|
||||
provision_folder(args.state/'private')
|
||||
@@ -141,7 +148,7 @@ def prepare_locked(args):
|
||||
check(minimum in (1,2), 'unknown minimum updater version')
|
||||
check(0 < args.days <= 3650, 'invalid validity in days')
|
||||
platform, blobs = binaries(args.artifacts, args.build_receipt)
|
||||
label = {LINUX:'linux', WINDOWS:'windows', WINDOWS_GNU:'windows-gnu'}[platform]
|
||||
label = release_label(platform, getattr(args, 'official_windows', False))
|
||||
check(minimum == 1 or platform == WINDOWS_GNU, 'version 2 currently applies to the GNU Windows worker')
|
||||
provision_folder(args.state)
|
||||
config, private = args.state / 'config', args.state / 'private'
|
||||
@@ -288,14 +295,19 @@ def publish(args):
|
||||
check(bool(args.rotate_bootstrap_from) == bool(args.bootstrap_state), 'rotation needs previous SHA and local signing state')
|
||||
check(not (args.rotate_bootstrap_from and args.bootstrap_worker), 'a rotation uses the new receipt-bound stable worker')
|
||||
client = Publisher(args.origin, args.ca)
|
||||
if args.dev_login_file:
|
||||
if args.local_username:
|
||||
login = {'username': args.local_username, 'password': getpass.getpass('WebUI password: '),
|
||||
'totp_code': getpass.getpass('Authenticator code: ')}
|
||||
elif args.dev_login_file:
|
||||
path = args.dev_login_file
|
||||
check(path.stat().st_mode & 0o077 == 0, 'dev login file requires private permissions')
|
||||
credentials = json.loads(path.read_bytes())
|
||||
login = {k: credentials[k] for k in ('username','password')}
|
||||
else:
|
||||
login = {'username': args.dev_username, 'password': getpass.getpass('Development WebUI password: ')}
|
||||
client.request('POST', '/auth/dev/login', encoded(login), {'Content-Type': 'application/json'})
|
||||
route = '/auth/local/login' if args.local_username else '/auth/dev/login'
|
||||
client.request('POST', route, encoded(login), {'Content-Type': 'application/json'})
|
||||
client.headers['X-RMM-Tenant'] = str(uuid.UUID(args.tenant))
|
||||
session = client.request('GET', '/auth/session')
|
||||
client.headers['X-CSRF-Token'] = session['csrf_token']
|
||||
try:
|
||||
@@ -319,7 +331,7 @@ def publish(args):
|
||||
check(result['sha256'] == blob['sha256'] and result['size_bytes'] == blob['bytes'], 'artifact receipt differs')
|
||||
if args.rotate_bootstrap_from:
|
||||
stable = blobs[-1]
|
||||
label = {LINUX:'linux', WINDOWS:'windows', WINDOWS_GNU:'windows-gnu'}[platform]
|
||||
label = release_label(platform, getattr(args, 'official_windows', False))
|
||||
rotate_pin(args.bootstrap_state,label,tenant,args.rotate_bootstrap_from,
|
||||
{'sha256':stable['sha256'],'bytes':stable['bytes']})
|
||||
if worker_only:
|
||||
@@ -340,6 +352,7 @@ def main():
|
||||
for name, fn in (('prepare', prepare), ('publish', publish)):
|
||||
cmd = sub.add_parser(name)
|
||||
cmd.set_defaults(run=fn)
|
||||
cmd.add_argument('--official-windows', action='store_true', help='Use the dedicated Windows GNU production signing key and bootstrap state')
|
||||
cmd.add_argument('--artifacts', type=Path, required=True)
|
||||
cmd.add_argument('--build-receipt', type=Path, required=True)
|
||||
if name == 'prepare':
|
||||
@@ -360,6 +373,7 @@ def main():
|
||||
cmd.add_argument('--envelope', type=Path, help='Prepared agent and helper release')
|
||||
cmd.add_argument('--rotate-worker-only', action='store_true', help='Rotate the stable worker independently of a code-pair release')
|
||||
auth = cmd.add_mutually_exclusive_group(required=True)
|
||||
auth.add_argument('--local-username', help='Sign in with the public WebUI password and a fresh TOTP code')
|
||||
auth.add_argument('--dev-username')
|
||||
auth.add_argument('--dev-login-file', type=Path)
|
||||
args = parser.parse_args()
|
||||
|
||||
Reference in New Issue
Block a user