406 lines
23 KiB
Python
406 lines
23 KiB
Python
#!/usr/bin/env python3
|
|
"""Immutable release preparation and validation. Standard library + OpenSSL only."""
|
|
import argparse
|
|
import hashlib
|
|
import json
|
|
import os
|
|
from pathlib import Path, PurePosixPath
|
|
import re
|
|
import stat
|
|
import subprocess
|
|
import tarfile
|
|
import tempfile
|
|
import sys
|
|
from contextlib import nullcontext
|
|
|
|
if __name__ == '__main__':
|
|
sys.modules.setdefault('release', sys.modules[__name__])
|
|
|
|
LIMIT_BYTES = 4 * 1024**3
|
|
LIMIT_FILES = 100000
|
|
ID = re.compile(r'[A-Za-z0-9][A-Za-z0-9_.-]{0,99}\Z')
|
|
HASH = re.compile(r'[a-f0-9]{64}\Z')
|
|
COMMIT = re.compile(r'[a-f0-9]{40}\Z')
|
|
|
|
|
|
class Refused(Exception):
|
|
pass
|
|
|
|
|
|
def require(condition, message):
|
|
if not condition:
|
|
raise Refused(message)
|
|
|
|
|
|
def digest(data):
|
|
return hashlib.sha256(data).hexdigest()
|
|
|
|
|
|
def file_digest(path):
|
|
with Path(path).open('rb') as stream:
|
|
return hashlib.file_digest(stream, 'sha256').hexdigest()
|
|
|
|
|
|
def canonical(value):
|
|
return (json.dumps(value, sort_keys=True, separators=(',', ':'), ensure_ascii=True) + '\n').encode()
|
|
|
|
|
|
def load(path):
|
|
def unique(items):
|
|
result = {}
|
|
for key, value in items:
|
|
require(key not in result, 'Duplicate JSON key')
|
|
result[key] = value
|
|
return result
|
|
require(Path(path).stat().st_size <= 16 * 1024**2, 'Oversized JSON')
|
|
return json.loads(Path(path).read_text(), object_pairs_hook=unique)
|
|
|
|
|
|
def keys(value, required, optional=()):
|
|
require(isinstance(value, dict) and set(required) <= set(value) <= set(required) | set(optional), 'Invalid fields')
|
|
|
|
|
|
def safe_name(value):
|
|
require(isinstance(value, str) and ID.fullmatch(value) and value not in ('.', '..'), 'Invalid identifier')
|
|
return value
|
|
|
|
|
|
def safe_path(value):
|
|
require(isinstance(value, str) and value and '\\' not in value and not any(ord(c) < 32 or ord(c) == 127 for c in value), 'Invalid path')
|
|
p = PurePosixPath(value)
|
|
require(not p.is_absolute() and '..' not in p.parts and str(p) == value and value != '.', 'Unsafe path')
|
|
return p
|
|
|
|
|
|
def sha(value):
|
|
require(isinstance(value, str) and HASH.fullmatch(value), 'Invalid SHA256')
|
|
|
|
|
|
def conditions(items):
|
|
require(isinstance(items, list) and len(items) <= 10000, 'Invalid conditions')
|
|
for c in items:
|
|
require(isinstance(c, dict), 'Invalid condition')
|
|
kind = c.get('kind')
|
|
required = {'object': ('kind', 'name', 'type'), 'column': ('kind', 'name', 'column'), 'module_sha256': ('kind', 'name', 'sha256'), 'solver_graph': ('kind', 'version', 'sha256')}.get(kind)
|
|
require(required is not None, 'Unsupported condition')
|
|
keys(c, required)
|
|
if kind == 'solver_graph':
|
|
require(re.fullmatch(r'[A-Za-z0-9_.-]{1,100}', c['version']), 'Invalid solver version')
|
|
sha(c['sha256'])
|
|
continue
|
|
require(re.fullmatch(r'dbo\.[A-Za-z_][A-Za-z0-9_]{0,127}', c['name']), 'Invalid object name')
|
|
if kind == 'object':
|
|
require(c['type'] in ('U', 'P', 'FN', 'IF', 'TF', 'V', 'TR'), 'Invalid object type')
|
|
if kind == 'column':
|
|
require(re.fullmatch(r'[A-Za-z_][A-Za-z0-9_]{0,127}', c['column']), 'Invalid column')
|
|
if kind == 'module_sha256':
|
|
sha(c['sha256'])
|
|
|
|
|
|
def validate_manifest(m):
|
|
keys(m, ('format', 'release_id', 'source_commit', 'version', 'files', 'application_sha256',
|
|
'starting_schema_sha256', 'resulting_schema_sha256', 'migrations', 'omitted_migrations',
|
|
'prerequisites', 'postconditions', 'health', 'qualification'))
|
|
require(m['format'] == 1, 'Unsupported manifest format')
|
|
safe_name(m['release_id'])
|
|
require(COMMIT.fullmatch(m['source_commit']), 'Full source commit required')
|
|
require(isinstance(m['version'], str) and re.fullmatch(r'[A-Za-z0-9.+_-]{1,100}', m['version']), 'Invalid application version')
|
|
for field in ('application_sha256', 'starting_schema_sha256', 'resulting_schema_sha256'):
|
|
sha(m[field])
|
|
require(isinstance(m['files'], dict) and 3 <= len(m['files']) <= LIMIT_FILES, 'Invalid file index')
|
|
for name, checksum in m['files'].items():
|
|
p = safe_path(name)
|
|
require(p.parts[0] in ('app', 'sql', 'evidence'), 'Invalid package area')
|
|
require(not any(x.startswith('.') or x in ('App_Data', 'uploads', 'logs', 'Logs') for x in p.parts), 'Persistent/config path in package')
|
|
require(not (p.name.startswith('appsettings') and p.suffix == '.json') and p.name not in ('web.config', 'dotnet-tools.json'), 'Configuration in package')
|
|
sha(checksum)
|
|
for name in ('PlotLine.dll', 'PlotLine.deps.json', 'PlotLine.runtimeconfig.json'):
|
|
require('app/' + name in m['files'], 'Incomplete framework-dependent application')
|
|
app_index = {k: v for k, v in m['files'].items() if k.startswith('app/')}
|
|
require(digest(canonical(app_index)) == m['application_sha256'], 'Application index checksum mismatch')
|
|
conditions(m['prerequisites'])
|
|
conditions(m['postconditions'])
|
|
require(bool(m['postconditions']), 'Release database health checks required')
|
|
require(isinstance(m['migrations'], list), 'Invalid migrations')
|
|
known = set()
|
|
sql_files = set()
|
|
for step in m['migrations']:
|
|
keys(step, ('id', 'file', 'sha256', 'requires', 'mode', 'prerequisites', 'postconditions'), ('evidence',))
|
|
identity = step['id']
|
|
require(isinstance(identity, str) and re.fullmatch(r'[A-Za-z0-9][A-Za-z0-9_.-]{0,199}', identity), 'Invalid migration identity')
|
|
require(identity not in known, 'Duplicate migration identity')
|
|
require(isinstance(step['requires'], list) and len(set(step['requires'])) == len(step['requires']) and set(step['requires']) <= known, 'Missing or out-of-order migration dependency')
|
|
safe_path(step['file'])
|
|
require('/' not in step['file'] and step['file'].endswith('.sql') and step['file'] not in sql_files, 'Invalid migration filename')
|
|
sql_files.add(step['file'])
|
|
sha(step['sha256'])
|
|
require(m['files'].get('sql/' + step['file']) == step['sha256'], 'Migration absent from index or checksum mismatch')
|
|
require(step['mode'] in ('execute', 'baseline'), 'Non-transactional migration requires a separately reviewed recovery procedure')
|
|
if step['mode'] == 'baseline':
|
|
require(isinstance(step.get('evidence'), str) and step['evidence'].startswith('evidence/') and step['evidence'] in m['files'], 'Historical baseline evidence required')
|
|
else:
|
|
require('evidence' not in step, 'Execution cannot claim historical baseline evidence')
|
|
conditions(step['prerequisites'])
|
|
conditions(step['postconditions'])
|
|
require(bool(step['postconditions']), 'Migration postconditions required')
|
|
known.add(identity)
|
|
require({n[4:] for n in m['files'] if n.startswith('sql/')} == sql_files, 'Unapproved SQL file')
|
|
require(isinstance(m['omitted_migrations'], list), 'Invalid omitted migrations')
|
|
for omitted in m['omitted_migrations']:
|
|
keys(omitted, ('id', 'sha256', 'reason', 'evidence'))
|
|
require(omitted['id'] not in known and isinstance(omitted['reason'], str) and len(omitted['reason']) > 10, 'Invalid omitted migration')
|
|
sha(omitted['sha256'])
|
|
require(omitted['evidence'] in m['files'] and omitted['evidence'].startswith('evidence/'), 'Omission evidence missing')
|
|
known.add(omitted['id'])
|
|
require(m['health'] == ['http-root', 'http-login', 'http-deployment-identity', 'database-postconditions', 'binary-identity'], 'Unsupported health checks')
|
|
require(isinstance(m['qualification'], dict) and m['qualification'].get('status') == 'passed', 'Release is not qualified')
|
|
keys(m['qualification'], ('status', 'evidence'))
|
|
require(m['qualification']['evidence'] in m['files'] and m['qualification']['evidence'].startswith('evidence/'), 'Qualification evidence absent')
|
|
|
|
|
|
def qualification_identity(m, evidence):
|
|
require(evidence.get('status') == 'passed' and evidence.get('source_commit') == m['source_commit'], 'Qualification source identity mismatch')
|
|
require(evidence.get('application_dll_sha256') == m['files']['app/PlotLine.dll'], 'Qualification binary identity mismatch')
|
|
require(evidence.get('starting_schema_sha256') == m['starting_schema_sha256']
|
|
and evidence.get('resulting_schema_sha256') == m['resulting_schema_sha256'], 'Qualification database identity mismatch')
|
|
|
|
|
|
def extract(archive, destination):
|
|
"""Only called on a private, verified snapshot; never uses extractall."""
|
|
destination = Path(destination)
|
|
total = 0
|
|
names = set()
|
|
with tarfile.open(archive, 'r:') as tar:
|
|
for member in tar:
|
|
name = str(safe_path(member.name))
|
|
require(member.isfile() and not member.pax_headers and not member.linkname, 'Archive must contain plain regular files only')
|
|
require(name not in names and len(names) < LIMIT_FILES, 'Duplicate or excessive archive entries')
|
|
names.add(name)
|
|
total += member.size
|
|
require(0 <= member.size and total <= LIMIT_BYTES, 'Archive exceeds size limit')
|
|
require(name == 'manifest.json' or PurePosixPath(name).parts[0] in ('app', 'sql', 'evidence'), 'Unexpected archive path')
|
|
out = destination / name
|
|
out.parent.mkdir(parents=True, exist_ok=True, mode=0o700)
|
|
with out.open('xb') as target, tar.extractfile(member) as source:
|
|
while block := source.read(1024**2):
|
|
target.write(block)
|
|
out.chmod(0o600)
|
|
require('manifest.json' in names, 'Missing manifest')
|
|
m = load(destination / 'manifest.json')
|
|
validate_manifest(m)
|
|
require(names == set(m['files']) | {'manifest.json'}, 'Package files differ from manifest')
|
|
for name, checksum in m['files'].items():
|
|
require(file_digest(destination / name) == checksum, 'File checksum mismatch')
|
|
runtime = load(destination / 'app/PlotLine.runtimeconfig.json')
|
|
require(runtime.get('runtimeOptions', {}).get('tfm') == 'net10.0', 'Unexpected application runtime')
|
|
deps = load(destination / 'app/PlotLine.deps.json')
|
|
require('PlotLine/' + m['version'] in deps.get('libraries', {}), 'Application package version mismatch')
|
|
require((m['version'] + '+' + m['source_commit']).encode() in (destination / 'app/PlotLine.dll').read_bytes(), 'Assembly source commit mismatch')
|
|
qualification_identity(m, load(destination / m['qualification']['evidence']))
|
|
return m
|
|
|
|
|
|
def snapshot(path, destination, max_bytes):
|
|
"""Descriptor-relative, no-follow input. A changing source cannot bypass signature."""
|
|
path = Path(path)
|
|
require(path.is_absolute(), 'Absolute source path required')
|
|
fd = os.open('/', os.O_RDONLY | os.O_DIRECTORY)
|
|
try:
|
|
for part in path.parts[1:-1]:
|
|
next_fd = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=fd)
|
|
os.close(fd)
|
|
fd = next_fd
|
|
source_fd = os.open(path.name, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=fd)
|
|
with os.fdopen(source_fd, 'rb') as source, Path(destination).open('xb') as out:
|
|
info = os.fstat(source.fileno())
|
|
require(stat.S_ISREG(info.st_mode) and info.st_nlink == 1 and info.st_size <= max_bytes, 'Unsafe input file')
|
|
count = 0
|
|
while data := source.read(1024**2):
|
|
count += len(data)
|
|
require(count <= max_bytes, 'Input size exceeded')
|
|
out.write(data)
|
|
finally:
|
|
os.close(fd)
|
|
|
|
|
|
def verify_bundle(source, work, public_key, meter=None):
|
|
source, work = Path(source), Path(work)
|
|
phase = meter.phase if meter else lambda name: nullcontext()
|
|
with phase('package_validation'):
|
|
for name in ('authorization.json', 'authorization.sig'):
|
|
snapshot(source / name, work / name, 16384)
|
|
result = subprocess.run(['/usr/bin/openssl', 'pkeyutl', '-verify', '-pubin', '-inkey', str(public_key), '-rawin',
|
|
'-in', str(work / 'authorization.json'), '-sigfile', str(work / 'authorization.sig')],
|
|
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
require(result.returncode == 0, 'Release signature invalid')
|
|
authorization = load(work / 'authorization.json')
|
|
keys(authorization, ('format', 'release_id', 'source_commit', 'package_sha256', 'manifest_sha256'))
|
|
require(authorization['format'] == 1, 'Invalid authorization format')
|
|
safe_name(authorization['release_id'])
|
|
sha(authorization['package_sha256'])
|
|
sha(authorization['manifest_sha256'])
|
|
compressed = (source / 'transport.json').exists() or (source / 'package.tar.zst').exists()
|
|
if compressed:
|
|
from transport import envelope
|
|
require(not (source / 'package.tar').exists(), 'Ambiguous raw/compressed bundle')
|
|
t = envelope(source, work, public_key)
|
|
require(t['original_sha256'] == authorization['package_sha256'] and
|
|
t['release_id'] == authorization['release_id'] and
|
|
t['source_commit'] == authorization['source_commit'], 'Transport identity mismatch')
|
|
else:
|
|
snapshot(source / 'package.tar', work / 'package.tar', LIMIT_BYTES)
|
|
size = (work / 'package.tar').stat().st_size
|
|
t = {'method':'none','original_bytes':size,'transferred_bytes':size,
|
|
'original_sha256':authorization['package_sha256'],'transferred_sha256':authorization['package_sha256']}
|
|
if meter:
|
|
meter.data['transport'] = {k:t[k] for k in ('method','original_bytes','transferred_bytes','original_sha256','transferred_sha256')}
|
|
meter.data['transport']['compression_ratio'] = round(t['transferred_bytes']/t['original_bytes'],6)
|
|
if compressed:
|
|
meter.data['transport']['compression_seconds_atlas'] = t['compression_seconds']
|
|
meter.data['transport']['settings'] = {'level':t['level'],'threads':t['threads']}
|
|
if compressed:
|
|
from transport import decompress
|
|
with phase('decompression'):
|
|
decompress(work,t)
|
|
with phase('package_validation'):
|
|
require(file_digest(work / 'package.tar') == authorization['package_sha256'], 'Package checksum mismatch')
|
|
payload = work / 'payload'
|
|
payload.mkdir(mode=0o700)
|
|
manifest = extract(work / 'package.tar', payload)
|
|
require(file_digest(payload / 'manifest.json') == authorization['manifest_sha256'], 'Manifest checksum mismatch')
|
|
require(manifest['release_id'] == authorization['release_id'] and manifest['source_commit'] == authorization['source_commit'], 'Authorization identity mismatch')
|
|
return manifest, authorization, payload
|
|
|
|
|
|
def prepare(args, meter=None):
|
|
from receipt import Receipt, write_local
|
|
meter = meter or Receipt('atlas-preparation')
|
|
repo = Path(args.source).resolve()
|
|
with meter.phase('scope_verification'):
|
|
commit = subprocess.check_output(['git', '-C', str(repo), 'rev-parse', 'HEAD'], text=True).strip()
|
|
require(not subprocess.check_output(['git', '-C', str(repo), 'status', '--porcelain'], text=True).strip(), 'Source must be a clean Git commit')
|
|
if getattr(args, 'scope_base', None):
|
|
base = subprocess.check_output(['git','-C',str(repo),'rev-parse','--verify','--end-of-options',args.scope_base+'^{commit}'],text=True).strip()
|
|
require(COMMIT.fullmatch(base), 'Invalid scope baseline')
|
|
meter.data['scope'] = {'base':base,'source':commit,'changed_paths':subprocess.check_output(
|
|
['git','-C',str(repo),'diff','--name-only',base,commit],text=True).splitlines()}
|
|
require(COMMIT.fullmatch(commit), 'Invalid source commit')
|
|
plan = load(args.plan)
|
|
# The plan is reviewed data; paths are only read on Atlas, never trusted as remote targets.
|
|
keys(plan, ('starting_schema_sha256', 'resulting_schema_sha256', 'migrations', 'omitted_migrations', 'prerequisites', 'postconditions', 'qualification'))
|
|
output = Path(args.output).resolve()
|
|
require(not output.exists(), 'Release destination already exists')
|
|
output.mkdir(mode=0o700, parents=True)
|
|
with tempfile.TemporaryDirectory(prefix='pd-release-', dir=str(output.parent)) as directory:
|
|
work = Path(directory)
|
|
publish = work / 'publish'
|
|
with meter.phase('build'):
|
|
subprocess.run(['dotnet', 'publish', str(repo / 'PlotLine/PlotLine.csproj'), '-c', 'Release', '-o', str(publish),
|
|
'-p:ContinuousIntegrationBuild=true', '-p:SourceRevisionId=' + commit], check=True,
|
|
stdout=(output / 'publish.log').open('w'), stderr=subprocess.STDOUT)
|
|
with meter.phase('packaging_signing'):
|
|
require(not subprocess.check_output(['git', '-C', str(repo), 'status', '--porcelain'], text=True).strip(), 'Build changed tracked source')
|
|
files = {}
|
|
sources = {}
|
|
for path in sorted(publish.rglob('*')):
|
|
require(not path.is_symlink(), 'Publish contains symlink')
|
|
if not path.is_file():
|
|
continue
|
|
rel = path.relative_to(publish)
|
|
if any(p.startswith('.') or p in ('App_Data', 'uploads', 'logs', 'Logs') for p in rel.parts):
|
|
continue
|
|
if (path.name.startswith('appsettings') and path.suffix == '.json') or path.name in ('web.config', 'dotnet-tools.json'):
|
|
continue
|
|
name = 'app/' + rel.as_posix()
|
|
files[name] = file_digest(path)
|
|
sources[name] = path
|
|
for migration in plan['migrations']:
|
|
filename = str(safe_path(migration['file']))
|
|
require('/' not in filename, 'Invalid SQL source name')
|
|
# Historical non-numeric release SQL may be staged separately in the reviewed SQL input directory.
|
|
path = Path(args.sql) / filename
|
|
require(path.is_file() and not path.is_symlink() and file_digest(path) == migration['sha256'], 'SQL source differs from reviewed plan')
|
|
name = 'sql/' + filename
|
|
files[name] = migration['sha256']
|
|
sources[name] = path
|
|
for path in sorted(Path(args.evidence).rglob('*')):
|
|
require(not path.is_symlink(), 'Evidence symlink')
|
|
if path.is_file():
|
|
name = 'evidence/' + path.relative_to(args.evidence).as_posix()
|
|
safe_path(name)
|
|
files[name] = file_digest(path)
|
|
sources[name] = path
|
|
deps = load(publish / 'PlotLine.deps.json')
|
|
versions = [x[9:] for x in deps['libraries'] if x.startswith('PlotLine/')]
|
|
require(len(versions) == 1, 'Application identity unavailable')
|
|
manifest = {'format': 1, 'release_id': safe_name(args.release_id), 'source_commit': commit, 'version': versions[0],
|
|
'files': files, 'application_sha256': digest(canonical({k:v for k,v in files.items() if k.startswith('app/')})),
|
|
'health': ['http-root', 'http-login', 'http-deployment-identity', 'database-postconditions', 'binary-identity'], **plan}
|
|
validate_manifest(manifest)
|
|
qualification_identity(manifest, load(Path(args.evidence) / PurePosixPath(plan['qualification']['evidence']).relative_to('evidence')))
|
|
manifest_bytes = canonical(manifest)
|
|
(work / 'manifest.json').write_bytes(manifest_bytes)
|
|
sources['manifest.json'] = work / 'manifest.json'
|
|
with tarfile.open(output / 'package.tar', 'w', format=tarfile.USTAR_FORMAT) as tar:
|
|
for name, path in sorted(sources.items()):
|
|
entry = tarfile.TarInfo(name)
|
|
entry.size = path.stat().st_size
|
|
entry.mode = 0o644
|
|
with path.open('rb') as stream:
|
|
tar.addfile(entry, stream)
|
|
authorization = {'format': 1, 'release_id': args.release_id, 'source_commit': commit,
|
|
'package_sha256': file_digest(output / 'package.tar'), 'manifest_sha256': digest(manifest_bytes)}
|
|
(output / 'authorization.json').write_bytes(canonical(authorization))
|
|
subprocess.run(['/usr/bin/openssl', 'pkeyutl', '-sign', '-inkey', args.signing_key, '-rawin',
|
|
'-in', str(output / 'authorization.json'), '-out', str(output / 'authorization.sig')], check=True,
|
|
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
meter.data['release'] = {'id':args.release_id,'source_commit':commit,'version':manifest['version'],
|
|
'package_sha256':authorization['package_sha256'],'application_sha256':manifest['application_sha256']}
|
|
if getattr(args, 'compression', 'none') == 'zstd':
|
|
from transport import compress_bundle
|
|
with meter.phase('compression'):
|
|
transport = compress_bundle(output,work/'transport',args.signing_key,None,verified=True)
|
|
for name in ('transport.json','transport.sig','package.tar.zst'):
|
|
(work/'transport'/name).rename(output/name)
|
|
(output/'package.tar').unlink() # Only this operation's newly built temporary tar.
|
|
meter.data['transport'] = transport
|
|
with meter.phase('receipt_generation'):
|
|
meter.finish('prepared')
|
|
write_local(output/'preparation-receipt.json',meter.data)
|
|
meter.finish('prepared');write_local(output/'preparation-receipt.json',meter.data)
|
|
print(json.dumps(authorization, sort_keys=True))
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
sub = parser.add_subparsers(dest='command', required=True)
|
|
p = sub.add_parser('prepare')
|
|
for field in ('source', 'plan', 'sql', 'evidence', 'output', 'release-id', 'signing-key'):
|
|
p.add_argument('--' + field, required=True)
|
|
p.add_argument('--compression',choices=('zstd','none'),default='zstd')
|
|
p.add_argument('--scope-base')
|
|
c = sub.add_parser('compress',help='Wrap an unchanged existing signed tar; no application build')
|
|
for field in ('bundle','output','signing-key','public-key'):c.add_argument('--'+field,required=True)
|
|
v = sub.add_parser('verify')
|
|
v.add_argument('bundle')
|
|
v.add_argument('--public-key', required=True)
|
|
args = parser.parse_args()
|
|
os.umask(0o077)
|
|
try:
|
|
if args.command == 'prepare':
|
|
prepare(args)
|
|
elif args.command == 'compress':
|
|
from transport import compress_bundle
|
|
print(json.dumps(compress_bundle(args.bundle,args.output,args.signing_key,args.public_key),sort_keys=True))
|
|
else:
|
|
with tempfile.TemporaryDirectory(prefix='pd-verify-') as work:
|
|
m, a, _ = verify_bundle(Path(args.bundle).resolve(), work, args.public_key)
|
|
print(json.dumps({'verified': True, 'release_id': m['release_id'], 'package_sha256': a['package_sha256']}))
|
|
except (Refused, ValueError, OSError, subprocess.CalledProcessError) as error:
|
|
print('RELEASE REFUSED: ' + (str(error) if isinstance(error, Refused) else type(error).__name__))
|
|
raise SystemExit(1)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|