6 ms·
By default, ssh-keygen leaks info about your computer (``user@host''). Passing -C "" takes care of this. I just throw a script in my ~/bin folder called `keyge
by sillysaurus3 10y ago
By default, ssh-keygen leaks info about your computer (``user@host''). Passing -C "" takes care of this.
I just throw a script in my ~/bin folder called `keygen`:
exec ssh-keygen -t rsa -b 4096 -C "" "$@"
- hk__2 10y agoWhy not just use an alias? alias keygen="ssh-keygen -t rsa -b 4096 -C ''"
- liw 10y agoAliases are per shell process. You need to reload your .bashrc (or whatever file you define aliases in) in every shell. Shell scripts are instantly available in all shell instances. Also, shell scripts can be invoked by shell scripts, which aliases can't.
- hk__2 10y agoI agree, but for something as simple as that I’d prefer a script to use `ssh-keygen` instead of relying on the presence of a one-line script in the PATH.
- Godel_unicode 10y agoIf you're concerned about hostname leakage in your pubkeys, you're almost certainly doing something wrong.
- sillysaurus3 10y agoIf you want SSH access to Github or Gitlab, you'll need to paste your pubkey there. Leaking your user@host can be a concern if you're trying to maintain anonymity, e.g. Gwern, particularly if your username is your real name. You can strip out the user@host part from the paste, but it's safer to just get rid of it. It's easy to accidentally paste the whole thing into an .ssh/authorized_keys file, for example. Admittedly this isn't an issue for most people.
- glandium 10y agoIf you're trying to maintain anonymity, why is your username your real name?
- sillysaurus3 10y agoEven if it's not, your default hostname when using a MacBook Pro is typically "<username>s-MacBook-Pro.local" which reveals you're using a MacBook Pro. That info leak probably doesn't matter, but generally you want to reveal as little information as possible.
- nitrogen 10y agoAs one example, a hostname leak might hypothetically be useful for a spearfishing+XSS attack.
- acranox 10y agoWhat kind of person cares enough about anonymity to change the comment in their ssh key, but not change the default hostname of their Mac? That person is very inconsistent.
- minitech 10y agoWhy does ssh-keygen include unnecessary information by default?
- throwaway7767 10y agoBecause it helps usability when the user is editing ~/.ssh/authorized_keys - if the default is not changed, the key comment has some context, so finding the right key is easier. I strip comments from my SSH keys too for the same reason you do. But most people don't seem to care and there is a reason for the default.
- deleted 10y ago
- repomies69 10y agoHow so? Why should I give out my username and host with the key? In many applications I see no need for them.
- parennoob 10y agoNo, this is a completely unnecessary piece of information that ssh is unnecessarily jamming into the pubkey. What possible use does including the hostname of the generating machine serve for public key authentication? Today it's my hostname. Tomorrow ssh-keygen (with default arguments) could start including more sensitive information, like the IPv6 address of my machine that's open to the internet and its exact OS version, and leave me open to a lot of attacks. Hence, I'm not going to trust the default arguments for it.
- dozzie 10y agoFirst, this field is important. It's not used for authentication in any way, as it's just an optional comment, ignored by sshd otherwise. It's not an information for sshd, though: it's information for human user. Without this comment you don't have an easy way to tell where the keys come from. Second, if you don't trust ssh-keygen, why the heck do you use it in the first place?
- parennoob 10y agoI didn't say I don't trust it, just that I don't trust that it won't leak private info when using the default arguments.
- dozzie 10y agoWhy it would suddenly leak such information? User+host is put in the comment field for dozen years already, if not longer (and has quite good explaination why it is there). Where does this distrust of yours come from? It's completely opaque to me.