Firefox remote debugging server: restricting which hosts may connect to the debugger port
0 reputation · 14 Nov 2020, 16:17 UTC
0 reputation · 14 Nov 2020, 16:17 UTC
I want a repeatable development environment where Firefox's remote debugging server (started with --start-debugger-server 6000 and devtools.debugger.remote-enabled set to true) accepts connections only from approved hosts, so the same scripted setup can be shared across a team without exposing the debugging interface to the whole network.
As far as I can tell from the documented preferences, there is no built-in option to bind the debugger server to a specific interface or to restrict which origins or IP addresses may initiate a session. Once enabled, the listener appears reachable by any client that can route to the port, and authentication or origin filtering does not seem to be part of the current stable behavior. Firewall rules work, but they live outside the Firefox profile and break the goal of a self-contained, reproducible configuration.
34775 reputation · 14 Nov 2020, 20:01 UTC
Firefox does not provide a built‑in preference or command‑line flag that accepts an IP‑allowlist or origin filter for the remote debugger server. You can, however, bind the debugger to a single interface (e.g., localhost) so that only connections from that interface are accepted. If you need to allow a small set of specific hosts while keeping the configuration inside a reproducible profile, run a lightweight TCP proxy that performs the allow‑list check and forwards approved traffic to the Firefox debugger port.
devtools.debugger.remote-host (or the command‑line form --start-debugger-server :) controls the interface on which the debugger listener binds.127.0.0.1 (or using --start-debugger-server 127.0.0.1:6000) makes the listener reachable only from the local machine.socat, nc, or a minimal Node/Go program) can listen on 0.0.0.0:6001, check the source IP against an allow‑list, and forward approved connections to 127.0.0.1:6000 where Firefox is bound.user_pref("devtools.debugger.remote-host", "127.0.0.1");
user_pref("devtools.debugger.remote-enabled", true);
firefox -P <profile-name> --start-debugger-server 6000
ss -ltnp | grep 6000
You should see 127.0.0.1:6000 in the output.127.0.0.1).socat:
socat TCP-LISTEN:6001,reuseaddr,fork SYSTEM:\"if [ \\$SOCAT_PEERADDR = 10.0.0.5 ] || [ \\$SOCAT_PEERADDR = 10.0.0.6 ]; then exec socat STDIO TCP:127.0.0.1:6000; else exit 1; fi\"
This example allows only 10.0.0.5 and 10.0.0.6 to reach the debugger.Do you need to allow connections from more than one specific host besides localhost? If the answer is “no”, the localhost‑only binding is sufficient; if “yes”, the proxy approach described above is required.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.