Console 3.1.30: complete all-module Git domain migration and audit

This commit is contained in:
Andrei Smaliak 2026-10-29 16:09:32 +01:00
parent dd52cbe9a3
commit 54ea6e3133
8 changed files with 86 additions and 12 deletions

View File

@ -0,0 +1,10 @@
# Console 3.1.30 — complete Git update domain audit
- All ten Console stages use the shared stage_versions/git_delivery owner for
catalog checks, individual updates, update-all, snapshots and package delivery.
- Bootstrap accepts legacy saved repository URLs but always connects to
git.iomatex.com, including network retries; no fallback to git.it-screen.com.
- Preserve TLS verification, exact-host validation, commit pinning and checksums.
- New snapshots, credentials, stage config and APT sources store the new host.
Legacy virtual APT addresses remain readable and resolve through the new host.
- Client binaries remain 5.1.44; this release updates Console/delivery only.

View File

@ -0,0 +1,34 @@
# Debian Console update transport audit — 2026-10-29
Published target: Console 3.1.30, client 5.1.44 unchanged.
| Entry | Shared owner | Network destination |
| --- | --- | --- |
| Console version check `/api/stages/check` | stage_versions.refresh → git_delivery.open_git | HTTPS git.iomatex.com |
| Single stage `/api/stages/install` | stage_versions.install → git_delivery.bootstrap | HTTPS git.iomatex.com |
| Update all `/api/stages/install-all` | same owner, ordered stage queue | HTTPS git.iomatex.com |
| Initial installer, including old `--git-url` input | bootstrap then shared delivery owner | HTTPS git.iomatex.com, including retries |
| APT packages and native runtime dependencies | custom iomatex APT method → download_object → open_git | HTTPS git.iomatex.com |
| Client ELF and Zigbee2MQTT archive | git_delivery fetch → download_object | HTTPS git.iomatex.com |
| Snapshot/credential/stage/source persistence | bootstrap/activate/configure | canonical new host |
Audited stages: environment, Wi-Fi/AP, MQTT, Zigbee2MQTT, Console,
Avahi/mDNS, Cockpit, display/client, IP streaming, reverse tunnels.
They use offline/require-local.sh (Zigbee2MQTT through its shared library).
The optional dashboard bridge installer uses the same delivery owner.
The legacy full-clone functions in local_installer.sh are unreachable: its Git
entry refuses to run and directs the user to the lightweight bootstrap.
Old host literals remain only as accepted migration inputs and virtual APT
identifiers, test fixtures, or historical documentation. They are not network
fallback destinations. Registration servers and local service health URLs are
separate contracts and are unchanged. Build-time Debian dependency collection
in offline/build.sh is not an Edge updater.
Security remains: exact allowlisted hosts, TLS verification, redirect refusal,
commit-pinned contents and package hashes, authenticated Console actions,
explicit installation confirmation and shared installation lock.
Regression coverage: bootstrap retry with either input alias; stage catalog
refresh with legacy/new/missing host; legacy snapshot persistence; package
transport; individual/bulk Console API permission and confirmation tests.

View File

@ -58,9 +58,11 @@ class NoRedirect(urllib.request.HTTPRedirectHandler):
raise RuntimeError('Git download redirect refused') raise RuntimeError('Git download redirect refused')
headers = {'User-Agent': 'IomatexOS-Updater/1.0', 'Authorization': 'Basic ' + base64.b64encode((os.environ['IOMATEX_GIT_USERNAME'] + ':' + os.environ['IOMATEX_GIT_PASSWORD']).encode()).decode()} headers = {'User-Agent': 'IomatexOS-Updater/1.0', 'Authorization': 'Basic ' + base64.b64encode((os.environ['IOMATEX_GIT_USERNAME'] + ':' + os.environ['IOMATEX_GIT_PASSWORD']).encode()).decode()}
opener = urllib.request.build_opener(NoRedirect) opener = urllib.request.build_opener(NoRedirect)
hosts = [parsed.netloc] + [h for h in ('git.it-screen.com', 'git.iomatex.com') if h != parsed.netloc] # Accept old saved URLs as input only; never make a request to the blocked host.
host = 'git.iomatex.com'
attempts = 2
commit = None commit = None
for index, host in enumerate(hosts): for index in range(attempts):
base = 'https://' + host + '/api/v1/repos/' + repo + '/' base = 'https://' + host + '/api/v1/repos/' + repo + '/'
try: try:
if commit is None: if commit is None:
@ -80,9 +82,9 @@ for index, host in enumerate(hosts):
raise SystemExit('Git TLS verification/connection failed. No domain switch; check certificates and system time.') from None raise SystemExit('Git TLS verification/connection failed. No domain switch; check certificates and system time.') from None
if not isinstance(reason, OSError): if not isinstance(reason, OSError):
raise SystemExit('Git request failed; no domain switch.') from None raise SystemExit('Git request failed; no domain switch.') from None
if index + 1 == len(hosts): if index + 1 == attempts:
raise SystemExit('Both Git domains are unreachable. Check DNS and Internet connectivity; installation has not started.') from None raise SystemExit('git.iomatex.com is unreachable. Check DNS and Internet connectivity; installation has not started.') from None
print('Git network/DNS failure on ' + host + '; trying ' + hosts[index + 1], flush=True) print('Git network/DNS failure; retrying ' + host, flush=True)
PYTHON PYTHON
GIT_URL=$(cat "$work/git_delivery.py.source") GIT_URL=$(cat "$work/git_delivery.py.source")

View File

@ -22,21 +22,23 @@ class BootstrapFallbackTest(unittest.TestCase):
opener.open.side_effect = responses opener.open.side_effect = responses
with patch('urllib.request.build_opener', return_value=opener), patch.dict(os.environ, {'IOMATEX_GIT_USERNAME':'user','IOMATEX_GIT_PASSWORD':'secret'}), patch.object(sys, 'argv', ['-', 'https://'+host+'/An-J/Iomatex_OS.git', 'ci-cd', str(destination)]): with patch('urllib.request.build_opener', return_value=opener), patch.dict(os.environ, {'IOMATEX_GIT_USERNAME':'user','IOMATEX_GIT_PASSWORD':'secret'}), patch.object(sys, 'argv', ['-', 'https://'+host+'/An-J/Iomatex_OS.git', 'ci-cd', str(destination)]):
exec(compile(SOURCE, 'bootstrap', 'exec'), {}) exec(compile(SOURCE, 'bootstrap', 'exec'), {})
for call in opener.open.call_args_list:
self.assertTrue(call.args[0].full_url.startswith('https://git.iomatex.com/'))
return destination, opener return destination, opener
def test_dns_failure_selects_alternative_and_persists_source(self): def test_dns_retry_stays_on_canonical_host_and_persists_source(self):
dest, opener = self.run_bootstrap([URLError(socket.gaierror(-3, 'DNS failure')), io.BytesIO(BRANCH), io.BytesIO(b'loader')]) dest, opener = self.run_bootstrap([URLError(socket.gaierror(-3, 'DNS failure')), io.BytesIO(BRANCH), io.BytesIO(b'loader')])
self.assertEqual(b'loader', dest.read_bytes()) self.assertEqual(b'loader', dest.read_bytes())
self.assertEqual('https://git.iomatex.com/An-J/Iomatex_OS.git', Path(str(dest)+'.source').read_text()) self.assertEqual('https://git.iomatex.com/An-J/Iomatex_OS.git', Path(str(dest)+'.source').read_text())
self.assertEqual(3, opener.open.call_count) self.assertEqual(3, opener.open.call_count)
self.assertIn('git.iomatex.com', opener.open.call_args.args[0].full_url) self.assertIn('git.iomatex.com', opener.open.call_args.args[0].full_url)
def test_payload_timeout_keeps_same_commit_on_alternate(self): def test_payload_timeout_keeps_same_commit_and_host(self):
_, opener = self.run_bootstrap([io.BytesIO(BRANCH), socket.timeout(), io.BytesIO(b'loader')]) _, opener = self.run_bootstrap([io.BytesIO(BRANCH), socket.timeout(), io.BytesIO(b'loader')])
self.assertIn('git.iomatex.com', opener.open.call_args.args[0].full_url) self.assertIn('git.iomatex.com', opener.open.call_args.args[0].full_url)
self.assertTrue(opener.open.call_args.args[0].full_url.endswith('a'*40)) self.assertTrue(opener.open.call_args.args[0].full_url.endswith('a'*40))
def test_explicit_alternate_is_tried_first(self): def test_canonical_host_is_used_directly(self):
_, opener = self.run_bootstrap([io.BytesIO(BRANCH), io.BytesIO(b'loader')], 'git.iomatex.com') _, opener = self.run_bootstrap([io.BytesIO(BRANCH), io.BytesIO(b'loader')], 'git.iomatex.com')
self.assertIn('git.iomatex.com', opener.open.call_args_list[0].args[0].full_url) self.assertIn('git.iomatex.com', opener.open.call_args_list[0].args[0].full_url)
self.assertEqual('IomatexOS-Updater/1.0', opener.open.call_args_list[0].args[0].get_header('User-agent')) self.assertEqual('IomatexOS-Updater/1.0', opener.open.call_args_list[0].args[0].get_header('User-agent'))
@ -47,6 +49,12 @@ class BootstrapFallbackTest(unittest.TestCase):
with self.assertRaises(SystemExit): with self.assertRaises(SystemExit):
self.run_bootstrap([error, AssertionError('Must not switch')]) self.run_bootstrap([error, AssertionError('Must not switch')])
def test_both_domains_unreachable_reports_failure(self): def test_canonical_host_unreachable_reports_failure(self):
with self.assertRaisesRegex(SystemExit, 'Both Git domains are unreachable'): with self.assertRaisesRegex(SystemExit, 'git.iomatex.com is unreachable'):
self.run_bootstrap([URLError(socket.gaierror()), socket.timeout()]) self.run_bootstrap([URLError(socket.gaierror()), socket.timeout()])
def test_both_input_aliases_only_use_new_host(self):
for host in ('git.it-screen.com', 'git.iomatex.com'):
with self.subTest(host=host):
_, opener = self.run_bootstrap([io.BytesIO(BRANCH), io.BytesIO(b'loader')], host)
self.assertEqual(2, opener.open.call_count)

View File

@ -34,6 +34,7 @@ class SnapshotUpdateTest(unittest.TestCase):
def test_confirmed_update_preserves_hotfix_and_operator_files(self): def test_confirmed_update_preserves_hotfix_and_operator_files(self):
self.bootstrap() self.bootstrap()
self.assertEqual(b'new release', (self.root/'install.sh').read_bytes()) self.assertEqual(b'new release', (self.root/'install.sh').read_bytes())
self.assertEqual('git.iomatex.com', json.loads((self.root/'.iomatex-source.json').read_text())['host'])
self.assertEqual(b'operator configuration', (self.root/'operator.conf').read_bytes()) self.assertEqual(b'operator configuration', (self.root/'operator.conf').read_bytes())
backup, = self.parent.glob('.installer-local-changes-*') backup, = self.parent.glob('.installer-local-changes-*')
self.assertEqual(0o700, backup.stat().st_mode & 0o777) self.assertEqual(0o700, backup.stat().st_mode & 0o777)

View File

@ -37,6 +37,25 @@ class StageVersionsTest(unittest.TestCase):
versions.configure(root) versions.configure(root)
self.assertEqual('git.iomatex.com', versions.read_json(versions.CONFIG)['host']) self.assertEqual('git.iomatex.com', versions.read_json(versions.CONFIG)['host'])
def test_all_stage_catalogs_use_new_host_for_legacy_and_missing_config(self):
for host in (None, 'git.it-screen.com', 'git.iomatex.com'):
with self.subTest(host=host):
cfg = {'repo': 'An-J/Iomatex_OS', 'branch': 'ci-cd'}
if host is not None:
cfg['host'] = host
versions.delivery.write_json(versions.CONFIG, cfg)
with mock.patch.object(versions.delivery, 'auth_from_env', return_value={'username':'u','password':'p'}), \
mock.patch.object(versions.delivery.urllib.request, 'build_opener') as opener:
opener.return_value.open.side_effect = [
io.BytesIO(json.dumps({'commit': {'id': COMMIT}}).encode()),
io.BytesIO(json.dumps(self.catalog).encode())]
versions.refresh()
result = versions.read_json(versions.STATE / 'available.json')
self.assertEqual('', result['error'])
self.assertEqual(set(versions.STAGES), set(result['stages']))
for call in opener.return_value.open.call_args_list:
self.assertTrue(call.args[0].full_url.startswith('https://git.iomatex.com/'))
def test_published_catalog_is_accepted_by_legacy_console(self): def test_published_catalog_is_accepted_by_legacy_console(self):
raw = json.loads((ROOT / 'stage-releases.json').read_text()) raw = json.loads((ROOT / 'stage-releases.json').read_text())
# This is the exact set checked by Console 3.1.2's validator. # This is the exact set checked by Console 3.1.2's validator.

View File

@ -14,7 +14,7 @@
"version": "1.0.1" "version": "1.0.1"
}, },
"stage_ui": { "stage_ui": {
"version": "3.1.29" "version": "3.1.30"
}, },
"stage_avahi": { "stage_avahi": {
"version": "1.0.0" "version": "1.0.0"

View File

@ -1,3 +1,3 @@
{ {
"version": "3.1.29" "version": "3.1.30"
} }