balta2ar / brotab

Control your browser's tabs from the command line
MIT License
389 stars 27 forks source link

Talking to a remote instance of brotab #49

Closed mad-ady closed 2 years ago

mad-ady commented 3 years ago

I'd like to integrate a Firefox instance that runs remotely (on my work PC) with rofi and brotab. I've used the following guide to integrate a local Firefox instance with brotab and rufi (http://adrianpopagh.blogspot.com/2020/12/quick-launcher-with-firefox-tabs-rofi.html), and I'm trying to see how to query the remote brotab instance.

I can see that brotab supports a --target option that takes an IP and port. Couldn't find the value for the port, but I could find it like this:

$ ps -ef | grep brotab
adrianp   657657  657255  0 14:20 pts/1    00:00:00 /usr/bin/python3 /usr/local/bin/bt_mediator /home/adrianp/.mozilla/native-messaging-hosts/brotab_mediator.json brotab_mediator@example.org
adrianp   678690  622794  0 14:44 pts/7    00:00:00 grep brotab
 $ netstat -tpan | grep 657657 
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 127.0.0.1:4625          0.0.0.0:*               LISTEN      657657/python3 

The problem (for me) is that it's bound to 127.0.0.1, and not to 0.0.0.0 (which I suspect is a security issue if left unfirewalled)...

I can do ssh port forwarding and it works:

$ ssh -L 8888:127.0.0.1:4625 remote-host
$ brotab --target 127.0.0.1:8888 list

But that would require me to do port forwarding always and keep a ssh open.

My question is - how can I convince brotab to bind to 0.0.0.0 instead of 127.0.0.1? I'll do iptables filtering to keep my tab data private. Thanks for the project!

balta2ar commented 2 years ago

@mad-ady yes you can do that in #68. Create a config:

$ cat ~/.config/brotab/brotab.env
HTTP_IFACE=0.0.0.0

Then you can see in the logs:

env.py:29:load_dotenv Loading .env file: /home/bz/.config/brotab/brotab.env