From f9e039b4cbee56120fed83b131c6d27869ae6a92 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Sun, 30 Apr 2023 15:10:31 -0400 Subject: [PATCH] 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 Reviewed-by: Sunil Mohan Adapa --- plinth/modules/tor/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plinth/modules/tor/__init__.py b/plinth/modules/tor/__init__.py index a08abb00f..bf97f028d 100644 --- a/plinth/modules/tor/__init__.py +++ b/plinth/modules/tor/__init__.py @@ -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'))