diff --git a/actions/tor b/actions/tor index e8cd0ad02..0c2cdbfb0 100755 --- a/actions/tor +++ b/actions/tor @@ -198,8 +198,11 @@ def get_hidden_service(): if not hs_dir: return '' - with open(os.path.join(hs_dir, 'hostname'), 'r') as conf_file: - hs_hostname = conf_file.read().strip() + try: + with open(os.path.join(hs_dir, 'hostname'), 'r') as conf_file: + hs_hostname = conf_file.read().strip() + except Exception: + return 'error' return hs_hostname + ' ' + ','.join(hs_ports) diff --git a/plinth/modules/tor/tor.py b/plinth/modules/tor/tor.py index 8804b5b19..7d5cc5895 100644 --- a/plinth/modules/tor/tor.py +++ b/plinth/modules/tor/tor.py @@ -89,6 +89,10 @@ def get_status(): hs_enabled = False hs_hostname = 'Not Configured' hs_ports = '' + elif output == 'error': + hs_enabled = False + hs_hostname = 'Configuration Error' + hs_ports = '' else: hs_enabled = True hs_info = output.split()