Guard HTTPS port from plain HTTP
This commit is contained in:
1 parent
d6b263ada7
commit
e5e02bbed5
3 files changed
+8
-2
No files matched your search
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user