0

I am running the latest TailsOS and would like to run and access a web service locally for myself. Just opening the index.html file in the TOR browser does not work, so I need some minimal web server hosting my app directory.

I tried both busybox httpd and the node http server with no success. Whenever I try to open localhost:8000 or 127.0.0.1:8080 (both services are exposed on these ports respectively), I get nothing in my TOR browser. I also tried starting nginx but the service fails to start after installation (which should automatically start an nginx service).

I assume all of the above issues are firewall issues, but can't figure out why I wouldn't be able to access such services locally as I anyway do not plan to expose them to the internet. Any pointers how to make that work would help!

5
  • Do I understand you right that you want to run an Onion Service or do you just want to display a static HTML file? Do you have configured Tor to run an Onion Service? If so, how did you set it up? Commented Apr 15, 2020 at 21:05
  • @JensKubieziel I just want to display a HTML file. But File -> Open does not work as some components won't run when just loading static HTML files so I need to serve that as a local webserver. No need to run an Onion Service (unless that makes it easier).
    – SCBuergel
    Commented Apr 17, 2020 at 10:15
  • So in that case it might be sufficient to create a new directory, change into it and run python3 -m http.server 34343. Now you place a HTML file into that directory and point your browser to 127.0.0.1:34343 Commented Apr 17, 2020 at 20:22
  • Thank you @JensKubieziel I just tried exactly that with a minimal HTML file in a separate folder, went into that folder to start python3 -m http.server 34343 and then opened http://127.0.0.1:34343 as well as http://0.0.0.0:34343 but the Tor Browser simply says Unable to connect. Firefox can't establish a connection to the server at 0.0.0.0:34343.
    – SCBuergel
    Commented Apr 19, 2020 at 9:10
  • This doesn't work in Tor Browser. You can't connect to localhost. You'll need another browser. Commented Apr 19, 2020 at 15:56

2 Answers 2

1

To access localhost with Tor Browser in Tails you can use the following script

#!/bin/bash

grep -qxF "user_pref(\"network.proxy.no_proxies_on\", \"127.0.0.1\");"  '/home/amnesia/.tor-browser/profile.default/user.js' || echo "user_pref(\"network.proxy.no_proxies_on\", \"127.0.0.1\");"  >> '/home/amnesia/.tor-browser/profile.default/user.js'

what it does:

  • write with echo a rule in user.js allowing access to 127.0.0.1 (localhost)
  • the grep part checks if the line already exists before writing

(you need to restart the Tor Browser after that)

You also need to open the firewall, here is the rule I use to run Hugo on Tails (on port 1313):

# iptables -I OUTPUT -d localhost -o lo -p tcp --dport 1313 -m owner --uid-owner amnesia -j ACCEPT;

0

In tails, there is an option to use Unsafe Browser. It should be available in your version of Tails out of the box.

The Unsafe Browser is run by a separate clearnet user, wich is allowed to make TCP connections to any port, and UDP DNS queries; access to local services like Tor etc. are blocked so it cannot interfere with them if compromised. Restricting the TCP ports to HTTP(S) and DNS only is not done since some captive portals use non-standard ports. Port restrictions are a pretty weak defense any way since just one open port is enough to do anything.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .