Dev/Whonix friendly applications best practices
Please parse a /etc/your-application.d configuration folder so Linux distributions such as Debian and Whonix can set defaults (such as proxy / stream isolation configuration). Users are of course free to overrule these defaults using the usual configuration files in the user's home folder.
Please parse only configuration files with a file extension such as
.conf. This is because graphical editors such as kate create backup files such as
file-name~ or apt-get / dpkg creating files such as
config-file-name.dpkg-old which would lead to unexpected results.
- Please set a socks user name for Stream Isolation. (
- Please use
add_onionTor control protocol command / Tor ephemeral onion services.
ephemeral: Means the onion service will be gone after the Tor control connection is closed. It's however possible and usual to retrieve onion service private key and to restore it at next run.
Tor ephemeral onion services are a lot a lot better for Whonix than preconfigued Tor hidden services.
- Listen on all interfaces rather than just localhost. (This is required since the incoming onion service connection comes from the network, not from localhost.)
# In Whonix, listen on 0.0.0.0 instead of 127.0.0.1 (#220) if os.path.exists('/usr/share/anon-ws-base-files/workstation'): host = '0.0.0.0' else: host = '127.0.0.1'
Related: Listen Port Convention
- Don't listen on a random local server port.
- Listen on a specific local server port or port range.
VIRTPROT(remote virtual port on the onion service) does not matter.
Tor Settings Autodetection
- Auto detect Tor settings through
These are unix domain socket files.
Ports would also work but nowadays unix domain socket files are much more advisable since these are less likely to leak.
- The application should not crash if Tor ControlPort replies something unexpected such as
510 Command filtered.
- Show an error message if Whonix is detected and seeing
510 Command filtered:
Error talking to the Tor controller.\nIf you're using Whonix, check out https://www.whonix.org/wiki/ProgramName to make ProgramName work.
- onionshare has a Tor settings dialog. But not really needed in Whonix.
- Bonus: Make a list of Tor control commands you are using so an onion-grater profile can be written.
- Bonus: Write an onion-grater profile.
- See also Tor friendly applications best practices.
- onionshare uses
17600 - 17659. That is handy, so we can match for it using
(176[0-5][0-9])in the onionshare onion-grater whitelist config.
- That way onionshare (running inside a compromised workstation) cannot open arbitrary ports on the workstation. For example, not to the real Tor ControlPort and circumvent the filtering. (We use Tor
ControlPortnow for this reason.) There are no local ports open on Whonix-Gateway besides Tor
TransPort, but if there was (let's say for example for brltty), then we don't want connections to it.
- That allows us to set a limit on how many Tor hidden services (a compromised) workstation can create.
- It's also useful so users don't have to open all incoming ports in Whonix-Workstation Firewall.
- onionshare uses
This is a wiki. Want to improve this page? Help is welcome and volunteer contributions are happily considered! See Conditions for Contributions to Whonix, then Edit! IP addresses are scrubbed, but editing over Tor is recommended. Edits are held for moderation.