News for hackers. Stuff that matters.
Re:Show HN: A WireGuard Powered Remote Shell by codetrotter on Sunday May 12, 2024 @09:07AM (#40334149)
What does this bring over binding sshd to the Wireguard interface address?

That’s what I do currently with some of my hosts.

Re:Show HN: A WireGuard Powered Remote Shell by ghxst on Sunday May 12, 2024 @10:12AM (#40334648)
Is there a small writeup available somewhere about this? I like the idea.
Re:Show HN: A WireGuard Powered Remote Shell by OMGWTF on Sunday May 12, 2024 @10:25AM (#40334729)
I guess you just need to configure `ListenAddress` in your `/etc/ssh/sshd_config` properly (see `man sshd_config`).
Re:Show HN: A WireGuard Powered Remote Shell by inbetween on Sunday May 12, 2024 @10:44AM (#40334877)
You also need to change the boot behavior of sshd to wait for wireguard (tailscale in my case) to be available. I had to add a couple of lines to the ssh systemd unit.
Re:Show HN: A WireGuard Powered Remote Shell by codetrotter on Sunday May 12, 2024 @11:09AM (#40335093)
Yep. And also pay attention during package and system upgrades on some systems. In certain cases it messes up this ordering, and you end up with sshd starting before Wireguard again and then sshd doesn’t find any interface with the specified address, which in turn makes it so that it won’t bind to that address. Making the machine unreachable until you manually fix it again.
Re:Show HN: A WireGuard Powered Remote Shell by napkin on Sunday May 12, 2024 @11:22AM (#40335182)
A less finnicky approach would be binding to 0.0.0.0, then configuring incoming firewall policy. By default deny, then allow SSH through wireguard network. Or by default allow then deny SSH through public network.
Re:Show HN: A WireGuard Powered Remote Shell by codetrotter on Sunday May 12, 2024 @01:54PM (#40336209)
I like that idea a lot. I may start doing that.
Re:Show HN: A WireGuard Powered Remote Shell by semi on Sunday May 12, 2024 @05:41PM (#40337816)
if you want to get fancy and/or over engineered you would use systemd templated units to setup [email protected] and a ListenAddress in the config listening on %i. Then you could bring up sshd@(expectedip).service for each expected IP

.. but that doesn't gain all that much tbh.if anything the only hesitation I'd have on listening to * and relying on firewall rules is if the service comes up before its configured. but exposing sshd isn't even that bad

Re:Show HN: A WireGuard Powered Remote Shell by sureglymop on Sunday May 12, 2024 @12:52PM (#40335824)
Yeah I would do it with nftables so you don't have to change the sshd listen address.
Re:Show HN: A WireGuard Powered Remote Shell by RealStickman_ on Sunday May 12, 2024 @01:47PM (#40336162)
You can create an override file for sshd to avoid issues due to package config changes.

https://www.freedesktop.org/software/systemd/man/latest/syst...

Re:Show HN: A WireGuard Powered Remote Shell by codetrotter on Sunday May 12, 2024 @01:53PM (#40336203)
I did something like that but somehow after an upgrade I still lost access to one of my systems that I had set up like that. This machine is physically in a different city from me so I rarely have the chance to go there. And lately I’ve even been in another country.
Re:Show HN: A WireGuard Powered Remote Shell by eyegor on Sunday May 12, 2024 @11:31AM (#40335240)
Why don't you just add sshd restart as an interface PostUp step in the client's wireguard config file?
Re:Show HN: A WireGuard Powered Remote Shell by kardos on Sunday May 12, 2024 @01:19PM (#40336006)
So allow sshd to start in a failed mode and then restart it?
Re:Show HN: A WireGuard Powered Remote Shell by inbetween on Sunday May 12, 2024 @05:27PM (#40337733)
it only takes 3 lines in a systemd override fille (which I think don't suffer the overwrite-on-upgrade problem). To my mind, that keeps the startup logic nicely local in service files.
Re:Show HN: A WireGuard Powered Remote Shell by augusto-moura on Sunday May 12, 2024 @01:26PM (#40336042)
I heard that ssh is kinda of an unnecessary step, since wireguard is already encrypted by default. Even legacy rsh should work fine in that setup. But I'm still not convinced, having double encryption is not a real performance problem in the real world. And I prefer it, just to be safe
Re:Show HN: A WireGuard Powered Remote Shell by yencabulator on Sunday May 12, 2024 @05:24PM (#40337713)
SSH can authenticate a user, wireguard (as typically deployed) only authenticates a computer.

SSH can sometimes authenticate intent, like Yubikey touch.

Using wireguard for authentication is a mistake. The category of mistake is usually referred to as ambient authority, often exploited via a confused deputy.

Re:Show HN: A WireGuard Powered Remote Shell by jmole on Sunday May 12, 2024 @10:53PM (#40339386)
I think you are misunderstanding the use of wireguard here - this is a userspace wireguard connection, so the process has the same permissions as the user executing it.

In one sense, this is no different than adding a public key to ~/ssh/authorized_keys.

If you control the key, you control the authentication.

Re:Show HN: A WireGuard Powered Remote Shell by yencabulator on Sunday May 12, 2024 @11:29PM (#40339551)
In the case of the project linked, yes. I'm responding to the comment that said

> I heard that ssh is kinda of an unnecessary step

Re:Show HN: A WireGuard Powered Remote Shell by augusto-moura on Monday May 13, 2024 @12:20AM (#40339757)
rsh would fill the same gap for authentication, (or even raw telnet), or anything that integrates with unix users.

What makes SSH different is the encrypting part. The keys were only introduced to be used by the encryption algorithms. Users and multiple identities were a core detail of nixes much before SSH

Re:Show HN: A WireGuard Powered Remote Shell by yencabulator on Monday May 13, 2024 @01:11AM (#40339994)
rsh relies on the client host to not lie, that's quite a different level of guarantee than touching a Yubikey.
Re:Show HN: A WireGuard Powered Remote Shell by augusto-moura on Tuesday May 14, 2024 @11:33PM (#40362806)
Ok, I get what you mean rlogin and rsh are not safe because of inumerous legacy problems. But I think you get what I meant as well, authorization problems can be solved without SSH.

I said that even rsh would do because will can ignore all the weird outdated stuff and just login with an user and password, same as a local login. In that case telnet would also work.

However, I truly believe that cryptographic keys are way superior to passwords. And going back to them would be a huge step back