diff --git a/vps/enable-https.sh b/vps/enable-https.sh index 0ae6db4..3b8722f 100755 --- a/vps/enable-https.sh +++ b/vps/enable-https.sh @@ -151,6 +151,7 @@ enable_hub_tls() { [Service] Environment=OWRT_REMOTE_TLS_CERT=$live_dir/fullchain.pem Environment=OWRT_REMOTE_TLS_KEY=$live_dir/privkey.pem +Environment=OWRT_REMOTE_EXTRA_PORTS=80 Environment=OWRT_REMOTE_TLS_PORTS=443 Environment=OWRT_REMOTE_PUBLIC_URL=https://$host EOF diff --git a/vps/owrt-remote-hub.py b/vps/owrt-remote-hub.py index f557ff5..29147c8 100644 --- a/vps/owrt-remote-hub.py +++ b/vps/owrt-remote-hub.py @@ -2710,9 +2710,14 @@ def cmd_serve(args): auth = load_auth() server = make_http_server(app, args.host, args.port) extra_servers = [] + tls_ports = parse_extra_ports(args.tls_ports) if args.tls_cert and args.tls_key else [] + tls_port_set = set(tls_ports) for port in parse_extra_ports(args.extra_ports): if port == args.port: continue + if port in tls_port_set: + print(f"WARNING: port {port} skipped for plain HTTP because TLS is enabled on it", file=sys.stderr) + continue try: extra_server = make_http_server(app, args.host, port) except OSError as exc: @@ -2723,7 +2728,7 @@ def cmd_serve(args): thread.start() print(f"{APP_NAME} also listening on http://{args.host}:{port}") if args.tls_cert and args.tls_key: - for port in parse_extra_ports(args.tls_ports): + for port in tls_ports: try: tls_server = make_http_server(app, args.host, port, args.tls_cert, args.tls_key) except OSError as exc: diff --git a/vps/owrt-remote.service b/vps/owrt-remote.service index 9526459..e10d64a 100644 --- a/vps/owrt-remote.service +++ b/vps/owrt-remote.service @@ -9,7 +9,7 @@ Environment=OWRT_REMOTE_BIND=0.0.0.0 Environment=OWRT_REMOTE_PORT=8088 Environment=OWRT_REMOTE_EXTRA_PORTS=80 Environment=OWRT_REMOTE_STATE_DIR=/var/lib/owrt-remote -ExecStart=/opt/owrt-remote/owrt-remote-hub.py serve --host 0.0.0.0 --port 8088 --extra-ports 80 +ExecStart=/opt/owrt-remote/owrt-remote-hub.py serve Restart=on-failure RestartSec=3 AmbientCapabilities=CAP_NET_BIND_SERVICE