tor: Check if Hidden service is version 3

Check that the Hidden service hostname contains 56 bytes before the
.onion.

Helps: #2104

Tests:

- With Hidden service enabled, v3 check is passed.

- With Hidden service disabled, v3 check is skipped.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2023-04-30 15:10:31 -04:00 committed by Sunil Mohan Adapa
parent 56adc7ae22
commit f9e039b4cb
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -159,6 +159,13 @@ class TorApp(app_module.App):
results.append(
diagnose_port_listening(int(ports['obfs4']), 'tcp6'))
if status['hs_enabled']:
hs_hostname = status['hs_hostname'].split('.onion')[0]
results.append([
_('Hidden service is version 3'),
'passed' if len(hs_hostname) == 56 else 'failed'
])
results.append(_diagnose_url_via_tor('http://www.debian.org', '4'))
results.append(_diagnose_url_via_tor('http://www.debian.org', '6'))