Lots of really braindead advice in there too, like disabling RDRAND because there might be a backdoor.. come on.. even Linus knows that's obvious bullshit.[1]
[1] https://nakedsecurity.sophos.com/2013/09/11/rudest-man-in-li...
Lots of really braindead advice in there too, like disabling RDRAND because there might be a backdoor.. come on.. even Linus knows that's obvious bullshit.[1]
[1] https://nakedsecurity.sophos.com/2013/09/11/rudest-man-in-li...
this seems to be a recent cargo cult rooted in the fact that people tend to choose weak passwords and/or reuse them, but there is technically nothing wrong about it and the opensshd defaults (MaxStartups) make bruteforcing reasonable username/password combinations unfeaseable.
A private key is just a very long password that is stored on disk and if there is no password on the key-file, it is stored there in plaintext an can be used by every other application (e.g. browser)
I’m comfortable with telling people to turn off password auth on their sshd’s and treat password auth as the exception rather than the rule.
Also, it’s generally a nicer user experience.
Sure it's possible to: have a strong password, use it only for a single machine, keep it in a good password safe, never reuse it anywhere, have the discipline to not make it short/easy to type/easy to remember, change it every time a server is compromised, etc....
Or you could get all that for free with public keys. Yes a private key is like a very long password, but the important part is that it never leaves the client side and it's safe to use on every computer you want access to without the hassle of remembering one password per server.
If you access many machines, how will you know when one is compromised? How will you prevent an attacker from logging in as you?
Public keys really are the better way to handle user auth, less of a minefield for regular users.
I'll go along with that, thou i consider a secret that resides in my brain vastly more secure than one residing on my disk.
With passwords you are sending it to remote computers where it could be compromised. Thus the standard practice of forcing all users to change their passwords when a server is compromised.
...so, this isn't great advice either. Password vaults are important..... at which point, you can just use a complex unique password.
Even better is to use SSH certificates. That way you don't have to deal with authorized (usually permanent) keys.
Once the SSH CA is installed in the host, the client can generate temporary asymmetric keys and sign them with the CA key before every connection.
There are a few ways to set up this scenario, here's one using Vault:
https://www.vaultproject.io/docs/secrets/ssh/signed-ssh-cert...
My setups just used puppet to manage a authorized key directory on each machine (basically one line of code), assuming you have a working puppet setup of course.
I'd consider either approach significantly more secure than passwords which is a much worse approach.
Absolutely 100% not. You're missing the most important aspect of PKI based authentication, the asymmetry. With symmetric authentication technologies, like passwords, the only way a user can authenticate is to hand over to the server (which might be malicious) everything that the server needs to impersonate that user.
Practically, this means that when I root the Linux server in your environment, and start up 3snake, I'm going to start collecting the passwords of every person who logs in, and I can use those passwords to escalate privileges around the network. This is not even a little bit possible in an environment where SSH key authentication is enforced.
If the user does not verify the remote host's fingerprint (vast majority doesn't), they could be sending the password to an attacker / honeypot or just wrong server / password. And if they reuse passwords, server can record passwords and someone could try them elsewhere.
If you're using passwords, it is very likely the password was copy-pasted to an inappropriate host (or passwords common for many hosts). It is also very likely the first connection to a server from a given computer was without verifying the remote host (server fingerprint), users are likely try and accept all kinds of things if they connection doesn't work, and I've even seen people disable host key verification so they wouldn't be bothered when a server is reinstalled / ip is reused.
Local accessibility of private keys is a significant issue, but if a program can read .ssh/..., it can usually also alias ssh=store-pasword-and-ssh, so using password doesn't help that much, vs. it's other issues.
If you're using passwords for yourself, it may be manageable, but I never give other people ssh login access using passwords.
¹ using asymmetric cryptography
From a quick skim of current sources, much of that has recently been rolled back"
At the very least, that looks like there might be something in it. I don't know crypto well enough to say for sure, but it looks like Linus needs to re-read rand.h from what that article says about the state of the comments and previous rolled back changes from Intel. It does make one wonder if Linus' arrogance and rudeness could be used as cover for a genuine backdoor.
And because of this, Intel or whoever would need to have weakened each and every entropy source you use to make anything of it.
Two sources of entropy xor'd will always be as strong as the best source. Done properly it's perfectly fine mixing rng sources you don't trust.
(secret bits) xor (bits from /dev/xrandom) xor (bits from RDRAND)
is very weak encryption. But of course, there is no reason to believe RDRAND is dependent on any of the usual random sources.
> is very weak encryption.
It's as strong as the strongest source. This easily proven mathematically.
X xor X = 0
The result is just a sequence of zeros, which is not "as strong as the strongest source". In practice, people may take lots of different "random" sources as input to their random generators to make them "more" random. But if you don't take care to check if they are independent, you may have a problem.
Mathematical results will lead you to surprising conclusions if apply them in the wrong context!
The bigger issue is "Don't copy a private key. Ever. Period."
How would you even do this? Don't the various private key containers make this quite difficult?
All these “security truisms” tend to ignore the real world. When you remove features, people will work around it in a less secure way.
These same people probably also joke about the marketing folks down the hall leaving post-it notes with their password on their monitor.
Security is the first casualty in the battle for convenience.
Genuine question, this is why I have a private key on the server in out office so I can clone our private repos.
Can you use your local private key then?
But maybe you've got a different use case? I'd start with "why are you using git directly on a (production?) server?"
Why is it bad to git clone on a production server? Let's assume I'm not an idiot please, just misguided. This isn't reddit.
Let's also assume I'm using an ssh key that is only used for the purposes of pulling the repo, no write access, never reused (deploy keys as the git* services call them)
It's really hard to see these tips as anything but parroting someone else if nobody throws down a reason
At small scale it's fine. Plenty of useful and valuable stuff runs on a handful of servers that have consistent identities etc and people manage them interactively. Process lives in people's heads or (better) a wiki.
At large scale it's a completely bonkers thing to do. There are tons of nodes; it doesn't make sense to mutate just one unless something has gone badly wrong. Interactive login to a production system should be triggering an incident or at least linked to one. Really you shouldn't be mutating systems in any kind of "manual" way because that kind of change is supposed to be locked down to authorised deployment methods. The current state of the system has to be legible to other team members and other teams, and the easiest way to do that is by looking at what's gone through the deployment process, which is usually navigable via a dashboard.
In the middle, it's possible you could have a deployment system that relies on "git clone" with a key on the instance. That would be a little weird because git is not a great way to store or distribute build artefacts. Not crazy though - could make sense in some situations.
Other potential problems:
- bad checkout location may mean unexpected content is available via .git paths on the web
- anyone with access to the server can copy the key and have external access to both the history of the project and all new commits - they can see the PRs with proposed security fixes before they get merged
- repository may contain domain names, credentials and other things which don't need to be deployed, but can be useful for the attacker doing recon
- potentially exposing information about customers if they got mentioned in the history
It's not terrible to use git directly. There are just ways you can deploy a little bit better if it's worth your time investment.
> Why is it bad to git clone on a production server? Let's assume
> I'm not an idiot please, just misguided. This isn't reddit.
This cargocult ritual is for those who manage farms of identical servers. If you have a single production server with no load balancing, it's fine.But be careful, Git does not handle file permissions well by default. If you have a directory or file that needs special permissions (like a cron job script) then you should set `core.fileMode` to `false` in your git config.
Then it's not cargo-culting, since for farms of identical servers manually checking out a repo is going to cause you pain.
To be hotly debated but regardless of the most secure production deployment environment you should have production environments like layered images and all required installs on a private company image repo where the company vpc deploys through a build server that deploys image tags to a private company image repo in which an ingress pulls down from after running things like clair and what have you to make sure at the very least you have the latest library versions running with the most recent patches on stable and can deploy replicas as across many servers/nodes through an intermediary deployment architecture whether it be k8s or nomad (which also allows for VMs not just containers) in which you could standardize and highly specify seccomp profiles app armour and any custom kernel modules or what have you.
Anyone using the same server to git clone (messing around in a private development box) to deploy production services would be a no go for me.
Any gitclone should be automated from a jenkins or similar build where org repo keys are authed before pushing to a private company repo (which also required with)
The only thing more annoying than the comments scoffing at how basic the advice is the reflection of how basic the production deployment techniques of the scoffers are. Nothing should be so non standardized in production as got cloning on a prod server ad hoc.
Ssh keys on a server seem an irrelevant situation to me in any production scale server I've worked in.
What I would really prefer is to be able to use git over ssh with U2F, i.e a hardware key, in place of a private SSH key this should work the same from the server as the client. U2F is already in openSSH but I am not sure how long it will take before it is commonly available and added to git hosting services... i'm also not sure if the protocol will work through the terminal to an openSSH client on a server.
I already use hardware keys for OTP with SSH (yubico pam) which makes doing ssh between servers secure and easy without private keys, and without client software compatibility issues since it's just a keyboard-interactive mode as far as SSH is concerned... In fact if you are also hosting your own git service you could use this for git cloning over ssh right now and not bother waiting for U2F.
Care to elaborate? First time I hear this.
It's shocking to me how people overlook HTTP as a tool for passing files around.
See also croc
How, exactly, do you expect people to do things like use git or pivot from Server A to Server B over SSH?
Yeah, when pushing up files from a client to a server, or pulling down files, SSH makes sense, but for server to server, there's no need to use something with a full control channel for a simple file transfer.
As to your question on how to use jump hosts, that's what -J is for.
ssh -J ServerA ServerB
In this case the key would act more like an access token for a specific operation that you're trying to perform, rather than as a key to a generally usable account.
$ ssh-keygen -t rsa
$ mv .ssh/id_rsa.pub .ssh/authorized_keys
$ cat .ssh/id_rsa
$ exit
logoutWhy not add libcrack (constraints) and auto-expiration of passwords instead of locking people out completely?
Also adding fail2ban is a very effective solution to prevent brute forcing.
> and for the love of god, stop leaving private SSH keys on servers
Why not? Unencrypted private keys are dangerious, OK, but I fail to see the problem with a good password protected private key?
If the user has a super secure password shared with a different, compromised service, libcrack will not detect that.
> and auto-expiration of passwords
Expiry results in passwords like: (prefix)Dec2020, (prefix)5, or cycling the last 2/3 entries. Keys can be relatively easily revoked and are guaranteed not guessable.
There's a module[0] for that (TM).
> Expiry results in passwords like: (prefix)Dec2020, (prefix)5
libcrack can enforce similarity and rotation checks too [1].
> or cycling the last 2/3 entries.
There's also another module[2] just for that.
> Keys can be relatively easily revoked and are guaranteed not guessable.
You're right but, a good password policy and infrastructure is not a simple straw man which can be set alight with a simple match. PAM can be a bit hard to understand but, once understood, it's pretty easy to create complex rules and flows.
If you get your workstation compromised somehow, you can always lose your keys. Then you need another password on top of your key to keep it encrypted.
At the end of the day, a good security policy is required. Keys, passwords, fingerprints and other identifiers are just tools. If you can design your defenses and moats well, you can secure your system with any method you want.
[0]: https://github.com/skx/pam_pwnd
[1]: http://www.linux-pam.org/Linux-PAM-html/sag-pam_cracklib.htm...
How can it do that without the server storing plain text passwords?
> Unless you're root
I'm not sure I get this part, why does being root change things?
Also, root can change any user’s password without entering the current one.
If you're exposing SSH to outer world, minimizing attack surface by removing users and/or passwords is good. OTOH, if you're not exposing these services outside, or putting them behind a VPN maybe with people connecting from unsecured locations, adding a password is always a good idea in my book.
A laptop maybe stolen, a workstation maybe breached if someone is not careful and losing a key create bigger consequence.
So maybe instead of a tug of war about which method is the silver bullet, we should discuss about which one is better, under which circumstances.
SSH and Kerberos has been around for decades, but few companies have it implemented.
It completely removes the need for SSH keys and their related management, user/group management, etc., which is a huge security and administration win.
Companies serious about security just have a trusted person hand out hardware with signed keys on it.
Large scale: You generate a keypair and give the public key to Vault or whatever, which signs it with the CA that all servers know to trust.
Did you read your own link?