mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
diagnostics: fix IPv6 failures
- Curl: if an IPv6 zone index is specified, use --interface parameter. This fixes two issues: - Curl in Debian Buster doesn't support an IPv6 zone index in URL - Curl in Debian Bullseye doesn't redirect properly if a zone index is in URL. - Disable IPv6 diagnostics on daemons that don't listen on an IPv6 address: plinth, deluge, transmission Closes #1519 Signed-off-by: Veiko Aasa <veiko17@disroot.org> Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
This commit is contained in:
parent
f9c9c62837
commit
ee03357f65
@ -20,6 +20,7 @@ Python action utility functions.
|
||||
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import socket
|
||||
import subprocess
|
||||
@ -351,7 +352,16 @@ def _check_port(port, kind='tcp', listen_address=None):
|
||||
def check_url(url, kind=None, env=None, check_certificate=True,
|
||||
extra_options=None, wrapper=None, expected_output=None):
|
||||
"""Check whether a URL is accessible."""
|
||||
command = ['curl', '--location', '-f', '-w', '%{response_code}', url]
|
||||
command = ['curl', '--location', '-f', '-w', '%{response_code}']
|
||||
|
||||
if kind == '6':
|
||||
# extract zone index
|
||||
match = re.match(r'(.*://)\[(.*)%(?P<zone>.*)\](.*)', url)
|
||||
if match:
|
||||
command = command + ['--interface', match.group('zone')]
|
||||
url = '{0}[{1}]{2}'.format(*match.group(1, 2, 4))
|
||||
|
||||
command.append(url)
|
||||
|
||||
if wrapper:
|
||||
command.insert(0, wrapper)
|
||||
|
||||
@ -111,7 +111,6 @@ def diagnose():
|
||||
results = []
|
||||
|
||||
results.append(action_utils.diagnose_port_listening(8112, 'tcp4'))
|
||||
results.append(action_utils.diagnose_port_listening(8112, 'tcp6'))
|
||||
results.extend(
|
||||
action_utils.diagnose_url_on_all('https://{host}/deluge',
|
||||
check_certificate=False))
|
||||
|
||||
@ -67,7 +67,6 @@ def diagnose():
|
||||
"""Run diagnostics and return the results."""
|
||||
results = []
|
||||
results.append(action_utils.diagnose_port_listening(8000, 'tcp4'))
|
||||
results.append(action_utils.diagnose_port_listening(8000, 'tcp6'))
|
||||
results.extend(
|
||||
action_utils.diagnose_url_on_all('http://{host}/plinth/',
|
||||
check_certificate=False))
|
||||
|
||||
@ -122,7 +122,6 @@ def diagnose():
|
||||
results = []
|
||||
|
||||
results.append(action_utils.diagnose_port_listening(9091, 'tcp4'))
|
||||
results.append(action_utils.diagnose_port_listening(9091, 'tcp6'))
|
||||
results.extend(
|
||||
action_utils.diagnose_url_on_all('https://{host}/transmission',
|
||||
check_certificate=False))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user