Manage onion services #124
Replies: 34 comments
-
Let's say I have a set of hidden services I want to add a set of clients, Line 163 in eb88bba And if I loose trust a set of clients and want to remove them from the authorized list of multiple services, this should be done too. Some scripts are required to be run with the |
Beta Was this translation helpful? Give feedback.
-
also Please Add option to import and export hidden services and torrc file from home directory, because directly to /var/lib/tor cannot copy files from scp an example, and export too, need special rights., for my is complicated, because, need to edit torrc file. |
Beta Was this translation helpful? Give feedback.
-
@connected201 Thank you for this. Process should be to |
Beta Was this translation helpful? Give feedback.
-
Tasks
|
Beta Was this translation helpful? Give feedback.
-
Current problem I need help to bypass.
If selecting ssh and test service, I want to display only alice. https://en.wikipedia.org/wiki/Intersection_(set_theory) I need to do with bash the intersection of multiple sets. Okay, this seems to help https://stackoverflow.com/a/28161520 echo ${array1[@]} ${array2[@]} ${array3[@]} | tr ' ' '\n' | sort | uniq -c count number of arrays and math with values that represent the same number. |
Beta Was this translation helpful? Give feedback.
-
Taking the official documentation about setting up an Onion Service as a reference, are these files necessary for the client authorisation? If I understand it right, with it, the owner of the server can decide who can access it and who not. How is it with a public server - let's say torbox.ch on an onion address? Does such a server need these .auth files too? |
Beta Was this translation helpful? Give feedback.
-
Yes, those files are necessary for servers with client auth. 2019 guide and the clean community guide. The nomenclatures I use for clarification: Hidden servers are appropriate to set up Client Authorization to manage who can view the service and access it, without the client key, the service page does not even load, protecting the privacy and against DOS attacks. torbox.ch is supposed to be seen and used by anyone, so it should not require a client key. I know it is hard to grasp without testing, but I did a lot of improvements to the script and will try to release them soon after enough testing. More about client auth: |
Beta Was this translation helpful? Give feedback.
-
Take a look here https://github.com/nyxnor/onion-cli Everything there has a reason, if it does not sound right, ask me. echo "Client Private key for ${SERVICE}"
echo
echo "RAW:"
echo
echo "Address = "${TOR_ADDRESS}
echo "Key = "${PRIV_KEY}
echo "Conf = "${TORRC_CLIENT_KEY}
echo
echo
echo "EXPLAINED:"
echo
echo " BROWSER -> Typing the key in the GUI"
echo " * In the browser, enter the service address = "${TOR_ADDRESS}
echo " * A small window will be prompted, enter the key = "${PRIV_KEY}
echo
echo " BROWSER and DAEMON 2 -> Adding the key to torrc to be read automatically"
echo " * Add the line containing ClientOnionAuthDir to the torrc file accordingly to your setup (remove identation):"
echo " - Browser = [Tor_Browser_folder]/Browser/TorBrowser/Data/Tor/torrc"
echo " ClientOnionAuthDir TorBrowser/Data/Tor/onion_auth"
echo " - Daemon = /etc/tor/torrc"
echo " ClientOnionAuthDir /var/lib/tor/onion_auth/"
echo
echo " * Add the private key (note: same content for Browser and Daemon but different paths):"
echo " - Browser = [Tor_Browser_folder]/Browser/TorBrowser/Data/Tor/onion_auth/bob.auth_private"
echo " - Daemon = /var/lib/tor/onion_auth/bob.auth_private"
echo " "${TORRC_CLIENT_KEY}
echo
echo " * Restart the instance"
echo " - Browser = Close and open again the Tor Browser Bundle"
echo " - Daemon = Reload the daemon = $ sudo pkill -sighup tor"
echo
echo " * Go to the service address = "${TOR_ADDRESS} |
Beta Was this translation helpful? Give feedback.
-
The cleanest guide to understadn client auth: https://matt.traudt.xyz/posts/creating-private-v3-FgbdRTFr/ |
Beta Was this translation helpful? Give feedback.
-
Updated repo https://github.com/nyxnor/onion-cli I recently started using Qubes-Whonix and it enhances the security of the system overall, a lot for onion services. Some parts of the scripts may not work on whonix (HiddenServicePort target as unix:path do not work because it is a VM), but I am using them as a security guide, even though debian is no whonix, we can harden debian too. Take a look here https://www.whonix.org/wiki/Onion_Services#Security_Recommendations I made Demonstration video of some of the functionalities: https://twitter.com/nyxnor/status/1434033535678091270 |
Beta Was this translation helpful? Give feedback.
-
CLIonion-video.mp4TUIOverall view of the TUI, it just calls the cli script. tui-onion.mp4 |
Beta Was this translation helpful? Give feedback.
-
very nice, it will be implement in next release of torbox? |
Beta Was this translation helpful? Give feedback.
-
Regarding the implementation, my idea is to do it in several steps:
How about the time table
After completing the above points, we will start with the implementation of the hidden services. |
Beta Was this translation helpful? Give feedback.
-
Can you make a github repo of the torbox.ch website so I can test publishing it? I see it is wordpress and they use cloudflare ( Note that publishing a website is just one of the utilities one can do with onion domain. I use for instant messaging communication with XMPP an onion domain. Note that implementing a website with or without client auth won't differ much, few clicks with the menu or some arguments with the CLI, which is way fast than doing manually. My timetable is difficult to estimate,
|
Beta Was this translation helpful? Give feedback.
-
If one just want to publish a website via terminal, there is onionshare-cli, I like what they do but I am not sure it fits TorBox because it saves all information to a single chosen file, so they do not modify local torrc and HiddenServiceDir. Anyway, onionshare-cli is really helpful for setting a website to chat, send and receive files, publish a webpage and can add client auth on top of each previous action. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Unfortunately, it will take me a little longer to integrate it into TorBox. My job (the one that pays my bills) is putting me under a bit of workload again. |
Beta Was this translation helpful? Give feedback.
-
No problem, with that I have more time to test and to find a job :) About you integrating into TorBox, note that you just need to clone and follow the steps on the readme, maybe add one option on the menu to redirect to onion services menu. There is no secret. But if you really decide to go deep and integrate each option your way, that is okay but I tried to integrate TorBox to Raspiblitz and it worked the first time, but with each new commit and release of TorBox, it becomes harder to keep upgrading individually the files I've changed. The same goes for integrating OnionService to TorBox. (The end result is that I am still building a custom script to change hardcoded paths of TorBox with sed and try to not break things when bulking with sed, which is difficult when dealing with multiple files). |
Beta Was this translation helpful? Give feedback.
-
About the long information first comment #80 (comment) I have completed all it is possible to do scripting for an onion service. The rest is OpSec that depends on the operator such as:
OpSec recommendation to use unix domain as the HiddenServicePort VIRTPORT TARGET is done already for example. |
Beta Was this translation helpful? Give feedback.
-
I didn't decide yet on which approach I will integrate onionservice-cli and onionservice-tui into TorBox. At first sight, it seems that I can take onionservice-cli as it is but have to (re-)write my version of onionservice-tui. One reason I will not only copy your work without understanding the code is that I will also try to contribute to your work. I already did a fork of your project, and if I find something I can contribute, I will make a pull request. Anyway, great work! |
Beta Was this translation helpful? Give feedback.
-
Feel honored, thanks for the fork. Having any questions about Also the TUI problem is the color (that you can set with .dialogrc) or because I use |
Beta Was this translation helpful? Give feedback.
-
What are the advantages of |
Beta Was this translation helpful? Give feedback.
-
FreeBSD's dialog man (read whiptail section in there also)
|
Beta Was this translation helpful? Give feedback.
-
green dialogrc to fit torbox
|
Beta Was this translation helpful? Give feedback.
-
I studied the code of the "onionservice" scripts, and I'm starting to implement some of the features in TorBox v.0.4.3. "onionservice" gives users the possibility to use "tcp socket" or "UNIX socket". Because "UNIX socket" is the more secure way, I ask myself if I should use this selection as default in TorBox. Are there some disadvantages if "UNIX socket" is used instead of "tcp socket"? |
Beta Was this translation helpful? Give feedback.
-
I have nothing to complain about unix socket. There is an old bug with nginx unix socket but was fixed. Just drop below if interested.There was a problem of it not being removed when [using SIGQUIT for the nginx process](https://trac.nginx.org/nginx/ticket/952), but it was fixed 17 months ago according to [this commit](https://trac.nginx.org/nginx/changeset/7cbf6389194b9170514e514ca7ee495369c9c8ac/nginx). I am saying this because this issue stood unfixed for more than 6 years since the issue was opened and people still refer to it for not using unix socket and not search it was closed, maybe trauma. |
Beta Was this translation helpful? Give feedback.
-
git pull my main branch, I fixed a bug that was implemented here https://github.com/radio24/onionservice/commit/85f95ba6961c01eeb9a1352dc698947c2ac9f20e, fix here nyxnor/onionjuggler@3958e6d |
Beta Was this translation helpful? Give feedback.
-
@nyxnor How should we treat this thread?
|
Beta Was this translation helpful? Give feedback.
-
discussions, there will be always something new to add and other people to report their experiences |
Beta Was this translation helpful? Give feedback.
-
Git over Tor
git clone https://github.com/bitcoin/bitcoin let's maintain anonymity with torsocks git clone http://nxshomzlgqmwfwhcnyvbznyrybh3gotlfgis7wkv7iur2yj2rarlhiad.onion/git/bitcoin.git
## or resolve with the built-in git proxy:
#git -c http.proxy=socks5h://127.0.0.1:9050 clone http://nxshomzlgqmwfwhcnyvbznyrybh3gotlfgis7wkv7iur2yj2rarlhiad.onion/git/bitcoin.git
cd bitcoin continue with: git config --add remote.origin.proxy "socks5h://127.0.0.1:9050" ## make sure that pulls go through the proxy. If you already have the repository: git remote add orionwl http://nxshomzlgqmwfwhcnyvbznyrybh3gotlfgis7wkv7iur2yj2rarlhiad.onion/git/bitcoin.git
git config --add remote.orionwl.proxy "socks5h://127.0.0.1:9050" ## make sure that pulls go through the proxy. now after editing the files, adding or removing them, committing the changes, the git commands that requests that host will resolve through the proxy, the commands being git fetch orionwl If you want all hosts to resolve through the tor proxy to that git repository: cd bitcoin
git config http.proxy 'socks5://127.0.0.1:9050' If you want all git repositories to use that proxy: git config --global http.proxy 'socks5://127.0.0.1:9050' SSH over TorInstead of using the 56-char.onion to reach for the host, torsocks ssh torbox@5rraorbx5dd3cuutxcue36cp4oschvlmltzzelzlr7yokf2m77h5vgyd.onion alias it. printf "
Host tor-router
User torbox
HostName 5rraorbx5dd3cuutxcue36cp4oschvlmltzzelzlr7yokf2m77h5vgyd.onion
IdentityFile ~/.ssh/id_ed25519
ProxyCommand nc -X 5 -x localhost:9050 %h %p
" | tee -a ~/.ssh/config now you only need to ssh tor-router Notes:
ssh -o "User=root" tor-router To ignore all options from the config file, use: ssh -F /dev/null torbox@5rraorbx5dd3cuutxcue36cp4oschvlmltzzelzlr7yokf2m77h5vgyd.onion |
Beta Was this translation helpful? Give feedback.
-
My old mod: https://github.com/nyxnor/raspiblitz/blob/tor-patch/home.admin/config.scripts/tor.onion-service.sh
New mod: https://github.com/nyxnor/CLI-onion-services/blob/main/tor.onion-service.sh
Currently, the script CREATES, DELETES (optionally purge to delete the onion address), ADD and REMOVE auth, see CREDENTIALS.
My script configure client auth server side, but the client side needs to be configure manually. I explained the commands deeply when running the script with echo, but it should be shortened to only display the string necessary and a guide in torbox page or text/ folder explaining how to do so.
This post was edited for reference.
This is informational material of things to be implemented and reviewed if were. This is more a long term goal than a complete todo list. The texts were extracted from each link mentioned above them, only the most useful information.
Instructions
Matt Traudt HS Setup
TPO setup onion service
(Optional) Step 5: Running multiple onion services
If you want to forward multiple virtual ports for a single onion service, just add more HiddenServicePort lines. If you want to run multiple onion services from the same Tor client, just add another HiddenServiceDir line. All the following HiddenServicePort lines refer to this HiddenServiceDir line, until you add another HiddenServiceDir line:
Or in Apache with Tor service listening on port 80:
Client Auth
If you are generating a private key for an onion site, the user does not necessarily need to edit Tor Browser's torrc. It is possible to enter the private key directly in the Tor Browser interface.
Onion-location
Nginx
To configure an Onion-Location header, the service operator should first configure an Onion service.
Step 1. Create an Onion service by setting the following in torrc:
Step 2. Edit website configuration file
In /etc/nginx/conf.d/.conf add the Onion-Location header and the onion service address. For example:
The configuration file with the Onion-Location should look like this:
Step 3. Test website configuration
The web server should confirm that the new syntax is working:
Step 4. Restart nginx
If you get an error message, something has gone wrong and you cannot continue until you've figured out why this didn't work.
Step 5. Testing your Onion-Location
To test if the Onion-Location is working, fetch the web site HTTP headers, for example:
Look for onion-location entry and the onion service address. Or, open the web site in Tor Browser and a purple pill will appear in the address bar.
The identical behaviour of Onion-Location includes the option of defining it as a HTML http-equiv attribute. This may be used by websites that prefer (or need) to define an Onion-Location by modifying the served HTML content instead of adding a new HTTP header. The Onion-Location header would be equivalent to a added in the HTML head element of the webpage. Replace <your-onion-service-address.onion> with the onion service that you want to redirect.
TPO community OpSec
Riseup OpSec - Leaking the real server
Riseup OpSec - Be careful of localhost bypasses!
But then the service itself needs to support unix sockets, otherwise you have to setup some socat redirection from tcp <→ unix (nginx, twisted, lighttpd all support this).
audit carefully: carefully audit, and regularly re-audit your system for configurations that allow localhost/127.0.0.1, but prohibit everywhere else and configure those to work around the problem (for example make /server-status operate on a different IP; make the webserver listen on a different port for /server-status; make it password protected, etc.).
DoS Guidelines - Vanguards done,
HiddenServiceExportCircuitID
seems to be the only other plausible solution.Onionscan - Search for vulnerabilities in the HS
Special note for TorBox as it acts as a relay
Beta Was this translation helpful? Give feedback.
All reactions