Skip to content

Commit 16b3987

Browse files
committed
named-pipes can be used to stop the proxy without authentication
as they're not meant to be accessible by other users
1 parent c198046 commit 16b3987

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

xpra/server/proxy/server.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
PROXY_WS_TIMEOUT = envfloat("XPRA_PROXY_WS_TIMEOUT", 1.0)
4646
assert PROXY_SOCKET_TIMEOUT > 0, "invalid proxy socket timeout"
4747
CAN_STOP_PROXY = envbool("XPRA_CAN_STOP_PROXY", getuid() != 0 or WIN32)
48-
STOP_PROXY_SOCKET_TYPES = os.environ.get("XPRA_STOP_PROXY_SOCKET_TYPES", "socket,named-pipe").split(",")
48+
STOP_PROXY_SOCKET_TYPES = os.environ.get("XPRA_STOP_PROXY_SOCKET_TYPES", "named-pipe").split(",")
4949
STOP_PROXY_AUTH_SOCKET_TYPES = os.environ.get("XPRA_STOP_PROXY_AUTH_SOCKET_TYPES", "socket").split(",")
5050
# something (a thread lock?) doesn't allow us to use multiprocessing on MS Windows:
5151
PROXY_INSTANCE_THREADED = envbool("XPRA_PROXY_INSTANCE_THREADED", WIN32)
@@ -331,7 +331,10 @@ def handle_hello_request(self, request: str, proto, caps: typedict) -> bool:
331331
return False
332332

333333
def handle_stop_request(self, proto) -> None:
334-
default_can_stop = CAN_STOP_PROXY and get_socktype(proto) in STOP_PROXY_SOCKET_TYPES and proto.authenticators
334+
socktype = get_socktype(proto)
335+
default_can_stop = CAN_STOP_PROXY
336+
default_can_stop |= socktype in STOP_PROXY_SOCKET_TYPES
337+
default_can_stop |= (socktype in STOP_PROXY_AUTH_SOCKET_TYPES) and proto.authenticators
335338
if not is_request_allowed(proto, "stop", default_can_stop):
336339
msg = "`stop` requests are not enabled for this proxy server connection"
337340
log.warn(f"Warning: {msg}")

0 commit comments

Comments
 (0)