Browse Source

enforce local ranges for broadcasts (#1920)

pull/1923/head
jcfp 4 years ago
committed by GitHub
parent
commit
87454c9b10
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      SABnzbd.py

10
SABnzbd.py

@ -86,6 +86,7 @@ from sabnzbd.misc import (
upload_file_to_sabnzbd,
is_localhost,
is_lan_addr,
ip_in_subnet,
)
from sabnzbd.filesystem import get_ext, real_path, long_path, globber_full, remove_file
from sabnzbd.panic import panic_tmpl, panic_port, panic_host, panic, launch_a_browser
@ -1505,7 +1506,14 @@ def main():
external_host = localipv4()
logging.debug("Using %s as host address for Bonjour and SSDP", external_host)
if is_lan_addr(external_host):
# Only broadcast to local network addresses. If local ranges have been defined, further
# restrict broadcasts to those specific ranges in order to avoid broadcasting to the "wrong"
# private network when the system is connected to multiple such networks (e.g. a corporate
# VPN in addition to a standard household LAN).
if is_lan_addr(external_host) and (
(not sabnzbd.cfg.local_ranges()) or any(ip_in_subnet(external_host, r) for r in sabnzbd.cfg.local_ranges())
):
# Start Bonjour and SSDP
sabnzbd.zconfig.set_bonjour(external_host, cherryport)
# Set URL for browser for external hosts

Loading…
Cancel
Save