News for hackers. Stuff that matters.
Re:Show HN: Caddy-SSH by tptacek on Monday March 28, 2022 @02:19PM (#30833730)
No they don't. Passwords are worse than certificates or keypairs, categorically.
Re:Show HN: Caddy-SSH by willcipriano on Monday March 28, 2022 @02:21PM (#30833766)
> No they don't

SSH into one of your boxes from my machine real quick.

Re:Show HN: Caddy-SSH by reggegg on Monday March 28, 2022 @02:42PM (#30834014)
What's the use case for using your personal unix account on someone else's computer?
Re:Show HN: Caddy-SSH by willcipriano on Monday March 28, 2022 @02:53PM (#30834148)
I've done it from work computers where the USB ports are disabled but I want to hit my personal dev machine at home to get at my notes and calendar.

I've established impromptu SSH tunnels from other people's machines to my local network so that I could watch my media on their TV.

If you dropped me naked on the other side of the planet I could get a copy of my identity documentation and access my email, bank accounts, etc from any internet connected machine I find.

Re:Show HN: Caddy-SSH by tptacek on Monday March 28, 2022 @02:56PM (#30834181)
You get that passwords over first-time SSH from untrusted computers or untrusted networks aren't safe at all, right? That posting those passwords is literally a sport at hacker conferences, and has been for over 2 decades?

This whole thread is a little alarming.

Re:Show HN: Caddy-SSH by willcipriano on Monday March 28, 2022 @03:04PM (#30834293)
You get that waking outside isn't safe at all right? Mugging is as old as civilization and don't get me started on cars.

Life is about trade offs, if someone really wants to spend the time to get access to my home dev box then I may have to spend a couple days on the phone with the bank and restoring from my offline backups. Big whoop.

Your home is likely insecure from my standards. Do you have a firearm at the ready? Do you know how to use it? Does your family have codewords to communicate without letting others on to your plan? How hard is it to kick in your doors? Not just the front door, but the bedrooms. Do you have a dog to wake you in the night? How stocked are you, can you last a month with no resupply? Do you even have a panic room?

I protect what matters beacuse you can't protect everything.

Re:Show HN: Caddy-SSH by tptacek on Monday March 28, 2022 @03:14PM (#30834396)
How are we still talking about this? SSH doesn't work the way you appear to think it does. Passwords don't solve the first-use problem; in fact, the first-use problem makes passwords much less safe than keys.
Re:Show HN: Caddy-SSH by willcipriano on Monday March 28, 2022 @03:16PM (#30834419)
Yes and your cheap hollow core door doesn't solve the ending the life of everyone you care about problem. Why are you more concerned about passwords than that?

I know the risks well, I don't find them to be worth the hassle of avoiding them.

Re:Show HN: Caddy-SSH by getcrunk on Monday March 28, 2022 @03:49PM (#30834769)
Iirc ssh passwords aren't sent in the clear. Is that really the case?

Edit: I looked it up to confirm. First time password is encrypted analogous to tls

Re:Show HN: Caddy-SSH by tptacek on Monday March 28, 2022 @05:09PM (#30835589)
No, it's not analogous to TLS. TLS has trust anchors: the key exchange in a TLS handshake is secure, even on first contact with a server. The key exchange in a first-contact SSH handshake is trivially MITM'd. An attacker with control of your network (or, obviously, your machine) can simply steal your password.
Re:Show HN: Caddy-SSH by getcrunk on Monday March 28, 2022 @08:03PM (#30837074)
I'm sorry I should have said it uses diffie hellman key exchange. And you are correct it can be mitm. I see that as its primary intrinsic weakness. (Password entropy, storage, are separate problems)

I would contrast this with the weakness of keys being that if the devs keys are compromised so are all the other servers he has access too. (I can memorize my passwords, or write them on a note card. Say what you will about that, it's out of band.)

In light of that the question as to what's best is your threat model. Poor opsec per dev or an upstream network sniffer.

Thanks for all your input all over this thread. I'm revisiting my convictions.

Would you disagree with I've said?

Re:Show HN: Caddy-SSH by tialaramex on Monday March 28, 2022 @08:53PM (#30837436)
But you've now swapped out part of the authentication. If you want to claim that, for some threat models, "One password per server" is better than "One key" then, sure, so use "One key per server" and now keys are better again.

Also - I suspect this Caddy server doesn't support it, but OpenSSH does - you can use FIDO and then the keys physically are objects in the real world, from say Yubico or a dozen other vendors so now "losing the keys" is like losing your office keys, except that when they give you a new one they can trivially make the old one stop working.

Re:Show HN: Caddy-SSH by getcrunk on Monday March 28, 2022 @10:07PM (#30837931)
A users keys are unlikely to be compromised singly. You would get them all. Whatever malware exfils the keys would take all that it finds.
Re:Show HN: Caddy-SSH by tedunangst on Monday March 28, 2022 @04:29PM (#30835192)
My mail server crashed while I was on vacation without my laptop.
Re:Show HN: Caddy-SSH by boomlinde on Tuesday March 29, 2022 @08:23AM (#30841576)
Of all the use cases I can imagine, enabling password logins just so I can meaningfully type my password into strange computers is among the least compelling.
Re:Show HN: Caddy-SSH by lilyball on Monday March 28, 2022 @02:22PM (#30833775)
How do you log into a server for the first time without a password? How do you log into a server from a brand new machine without access to your previous machine or sharing certs?
Re:Show HN: Caddy-SSH by tialaramex on Monday March 28, 2022 @09:13PM (#30837565)
So there are three different scenarios wrapped up in this question and they're all interesting.

A. The server is new, and I'm setting it up presumably remotely e.g. in "the cloud". Ideally the autonomous setup should provision keys for me in this case, since they're public it's fine to even publish scripts which do this. However it's true that there are a lot of systems out there which instead give you a password for first login (or worse they have a fixed default!) which is sad.

B. The server has existing users, but not me. If we're not using certificates then I need an existing user to authorise me to use the machine, providing public keys is no different than anything else they might fill out, like my name, they will need a trustworthy source for all of it. For systems I have no other prior relationship to beyond that I am, as you see, tialaramex, I tell them to add the github keys for tialaramex, which are of course published. I will replace those after successfully connecting to their SSH server.

C. I've used this server but not from this machine. FIDO resident keys solve this (you can extract the resident key to a new client from your physical device, the device still needs to be present to actually authenticate) but I will also use SSH to connect to my home bastion and have that authenticate while I do setup once. I can SSH from my phone, so if this can't work then somehow I don't have my phone or access to my home, setting up SSH keys is a low priority in that case.

However it's true that none of this is yet ordinary.

Re:Show HN: Caddy-SSH by jrockway on Monday March 28, 2022 @03:17PM (#30834424)
When you install Ubuntu it asks you for your Github username and pulls your public key from there, making having the corresponding private key the only way to log into the system.

If you lose all your key material, then I wouldn't expect for you to ever be able to log into the system. Passwords have the same problem; if there's some machine you can only remotely connect to and you forget your password, you simply won't be accessing that computer anymore.

Re:Show HN: Caddy-SSH by tptacek on Monday March 28, 2022 @02:25PM (#30833801)
Keep following your own logic. If you don't have a preexisting key relationship and you can't trust the network, are passwords safe? [Y/N]
Re:Show HN: Caddy-SSH by randomsilence on Monday March 28, 2022 @03:50PM (#30834776)
If you cannot trust the network, where is the advantage of keypairs over passwords?

If you have a one-time password, worse case is that some man in the middle gets that password.

If you engage in a proof of private key ownership for your login, a man in the middle can use that exchange to log into another server that has the same public key.

Re:Show HN: Caddy-SSH by tptacek on Monday March 28, 2022 @04:46PM (#30835363)
First, if you use an SSH CA, you don't necessarily have the first-use problem at all; that's part of the point of SSH CAs. You've resolved that problem the same way TLS does.

Second, an attacker targeting your keypair-backed SSH session on an insecure first-use gets your session; against a password, they get your password, which is strictly worse.

It's not my claim that keypairs neatly solve the first-use problem with SSH (though: that problem can be solved, with more keypairs). It's that keys are categorically better than passwords. Which, of course, they are.

The alarming thing about this thread is that there's a couple people here that clearly seem to believe logging in with a password to a "new" SSH server is safe. It's literally the basis for the "Wall of Sheep" at hacker conferences; they were doing it at Usenix when I was there in 1998.

Re:Show HN: Caddy-SSH by heinrich5991 on Monday March 28, 2022 @10:31PM (#30838081)
> If you engage in a proof of private key ownership for your login, a man in the middle can use that exchange to log into another server that has the same public key.

No, this is not true. The proof of private key ownership is bound to that specific SSH session (identified by some shared secret established via DH). This means the attackers options are: MITM the DH: Then your authentication won't work against any server. Don't MITM the DH but forward your authentication to the wrong server: Then you're on the wrong server (you might not notice), but the attacker cannot look into your session or modify anything.

Re:Show HN: Caddy-SSH by remram on Monday March 28, 2022 @03:53PM (#30834819)
He can do it once, maybe, if you don't authenticate the server. With a password, he can do it any number of time, to any number of targets, and there's no way to catch it.

Yes, it is still not perfect, but here's the advantage.

Re:Show HN: Caddy-SSH by mynameisvlad on Monday March 28, 2022 @02:38PM (#30833965)
> and you can't trust the network

Why is this a requirement? Not having a configured machine does not imply an untrusted network. Maybe all my computers recently and unexpectedly got wiped and I'm trying to rebuild my home network.

Re:Show HN: Caddy-SSH by tptacek on Monday March 28, 2022 @02:41PM (#30834011)
Repeat exercise, but with untrusted computer. [Y/N]

If you trust literally every component involved in the exchange, is rsh safe? [Y/N]

Re:Show HN: Caddy-SSH by wadim on Monday March 28, 2022 @02:42PM (#30834012)
Depends on how the server was setup. Ubuntu has offered importing public keys from github for quite a while in its installer. If you're using terraform/ansible/some other IaC tool, adding a key is probably just 1-2 lines of code. Some OS, like Guix or NixOS, also allow you to define them in a config file. Worst case you can just do something like `curl -L github.com/username.keys >> .ssh/authorized_keys`.
Re:Show HN: Caddy-SSH by tptacek on Monday March 28, 2022 @02:43PM (#30834023)
This is also part of the reason big fleet operators like SSH CAs, since they work for host keys and solve the key continuity problem.