93 points · by NickBusey · 7y ago · 65 comments
These two part I found to be more annoying to deal with, although this is true for most VPN solutions (thinking about tinc, wireguard).
I don't understand why you couldn't have a small utility to take a human memorable password that maps to a weak-ass private key, then ratchet up to a secure keypair on the server once the initial connection is made:
1. Run utility in "server" mode.
2. Enter password "I am not the target of a state level actor atm" into utility
3. Utility maps your weak-ass password to a weak-ass private key, generates the pubkey from that, and consequently creates the Tor hidden service behind which your openssh server can now be accessed.
4. On the client, run the utility in "client" mode and type in your weak-ass password
5. Utility maps the password to the server's weakass kepair and generates the corresponding onion address from it.
6. Utility creates a tunnel over Tor to connect to that onion address.
7. Server and client are now connected, with no memorization of human unreadable strings. Hurray!
8. Once connected, the server generates a secure keypair and sends the corresponding new onion addy to the client over the current connection.
9. Client receives the new onion addy, disconnects, then connects to the new addy.
10. Repeat for each client. Once all clients are connected, server destroys the original hidden service.
We use it to connect to touring production racks using a consistent IP regardless of what concert venue ISP they might be connected to on a given day.
Careful though: installing the version of Tor which is included in Ubuntu’s distribution is not recommended, is often very out of date.
Use the Tor project’s PPA instead.
Many times people have assumed that Tor is only for 'dark web' and other things that there is no legitimate business using.
But as you say, escaping NAT is a perfect use-case. It's particularly good for escaping CGNAT, as to be honest there aren't many other ways to escape CGNAT and still have a 'listening' server, rather than just an always-open tunnel.
Edit: The Tor Project website has a useful section on how IT professionals use Tor, which covers some more interesting ones: https://www.torproject.org/about/torusers.html.en#itprofessi...
https://docs.travis-ci.com/user/running-build-in-debug-mode/
# Remove the bogus tor service Ubuntu installs by default
Is there a bug in the upstream package or something? Otherwise this just looks like a big step back from systemd to SysV — without automatic restarts the first time the daemon exits, you're locked out of the server.If you read the discussion in the link, this actually does do that. It just replaces the 'empty' service with the actual tor service. So you do get automatic restarts.
# Append the hidden service configuration to the Torrc file
echo -e "HiddenServiceDir /var/lib/tor/onion-ssh/\nHiddenServicePort 22 127.0.0.1:22" > /etc/tor/torrc
Unless the '>' is changed to ">>", this will overwrite the torrc file.Using ">" instead of ">>" means you don't end up with multiple copies of the same hidden service.
That said, I agree: it should append, but it should first check whether it has already added a hidden service to the file.
if [ $(grep "HiddenServicePort 22" /etc/tor/torrc | wc -l) -eq 0]Onion v2 (16 char addresses) uses old crypto (SHA1/DH/RSA1024) and has now been superseded by Onion v3 (56 char addresses, SHA3/ed25519/curve25519 and many other improvements).
https://trac.torproject.org/projects/tor/wiki/doc/NextGenOni...
Nice script BTW.
EDIT: I stand corrected, see @buildbuildbuild reply.
># Usage (as root): $ bash <(curl -s https://gitlab.com/grownetics/devops/raw/master/tor_ssh.sh)
Spoon feeding like this is why Windows has such a disgusting history of malware, and only encourages people to not think about what they are doing.
curl | sh is slightly problematic from untrusted servers that might change the script depending on whether or not it's piped to a shell, but from gitlab I just don't see a difference.
I played around with that idea in https://github.com/mkmik/runck but it obviously can used for installation instructions only if it's rather ubiquitous.
(I seem to recall there being a way for the server to reliably guess whether the file was being piped or saved to disc, as well, which would let you restrict the malicious version even more. Google is failing me at the moment, though.)
Here is one I wrote that shows your internet speed, but will also check to see if you have passwordless sudo. Even without sudo, I could spawn and persist a gateway port ssh proxy outbound to a VPS node, but with sudo, I could do much more.
curl -A Mozilla -s https://tinyvpn.org/misc/url_test.txt | bashYou'll eventually realize that the answer is that this advice has no value. What could potentially have value is reviewing the code before running it, which can be done either way.
- wget https://gitlab.com/grownetics/devops/raw/master/tor_ssh.sh
- less tor_ssh.sh
- sudo bash tor_ssh.sh
I get what you're trying to say but in that specific case I don't think it really applies.
Sure, I suppose the install directions should be more like, wget the file, cat it to be sure gitlab didn't serve you a malicious file instead(?), then run it.
Really not sure what this has to do with malware on Windows though.
1) Tor exit node operators will do all kinds of nasty things: e.g. MITM-ing your sessions, refusing to handle certain kinds of traffic, and recording everything.
2) If you use your regular SSH key (which you will, because you needed to use this script to do this), your SSH key fingerprint and thus your identity is still recorded by the remote host. Doh!
3) Everyone at the remote host will think you got haxed. Because you're logging in through Tor. Or else they'll think you're super shady.
That said, Tor is super fun to play around with. Just don't assume anything gives you real protection unless you're careful and really know the ins and outs.
2.) Why is this a problem? You already own the remote host, so you already know your identity.
3.) It will appear to the remote host as a login from the loopback device. And if you set this up you presumably own the remote host anyway so you don't care what its owner thinks.