I moved over to certificates a while ago.
Welp time to add this to the backlog of things I wanna do
So what happens when the certificate expires? Do you get locked out if you don't have physical access?
Re-gen the keys. In this environment, you would have PKI setup and automation to handle cert renewal.
Having the certs expire is an advantage, security-wise. Auth will expire with certs, stolen creds can be instantly invalidated.
Like the other commenter said, they're expiring regularly. Host keys expire ~monthly and there's a cronjob to reach out to the certificate authority server to renew them. User certs expire ~daily and the first time I ssh on any given day I have to authenticate with the CA. Recently tied it to PocketID for SSO.
Sooo, CA unreachable means connection dead, which is a manageable risk. But giving a third party the authority over my SSH access sounds like a great way to make it convenient for state actors to invade my privacy.
I mean, the CA is also self hosted so I'm not sure what you think the extra attack vector is here.
Trategie is vulnerable and deprecated. You might want to try its secure successor Strategie
Do you think they are compromised? Generally you have to invalidate the public keys in any .ssh_hosts file that accepts them, and create new ones instead. I generally install .ssh_hosts on remote machines using an ansible playbook. I don't have any automation to cycle them but I guess I would also do that with ansible if I thought it were needed.
Ansible may be old school by now, but it works for me. Maybe the cool kids are using something newer now. I want to look into nix or guix one of these days.
nix for local machine config, Terraform for VM wrangling, and Ansible to orchestrate it all
Can you expand a little bit on that please?
Man, I really need to learn ansible…
Learn Linux TV on YouTube has an awesome series on it.
The general process would look something like:
- Find all of the SSH keys you want to replace.
- For each of thise keys, identify everywhere you use it to authenticate, and write this down! This list will form the basis of the rest of the plan. Make sure you list all of the accounts/servers you log in to, and don't forget things like github or other external systems if you use them.
You'll need to perform the following steps for each SSH key you are replacing:
- Rename the public and private keys to something like
old_id_rsaandold_id_rsa.pub(obviously use the same type name as your key, just prefixold_) - In your
~/.ssh/config, add a line telling SSH to use the old key as well as the new ones:IdentityFile ~/.ssh/old_id_rsa(change the key filename as aporopriate) - Check you can still log in to the servers you could log in to before. It should still be using the old key, just with a different filename, so it should still work.
- Generate your new SSH keys
ssh-keygen -t ed25519 - Log in to each server and ADD the new
~/.ssh/id_ed25519.pubkey to theauthorized_keysfile or equivalent mechanism. Do not remove the old public key yet. - Remove the
IdentityFileline from your~/.ssh/config - Check you can log in to all your systems. This will validate that your new key is working.
- Remove your old public key from the
authorized_keysfile on each server you log in to.
Depending on your threat model you're going to want to do this more or less often, and so you may want to consider automating it with sonething like ansible if it'll be a regular job.
- Find all of the SSH keys you want to replace.
I hate this part.
Selfhosted
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.
Rules:
-
Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.
-
No spam posting.
-
Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.
-
Don't duplicate the full text of your blog or github here. Just post the link for folks to click.
-
Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).
-
No trolling.
-
No low-effort posts. This is subjective and will largely be determined by the community member reports.
Resources:
- selfh.st Newsletter and index of selfhosted software and apps
- awesome-selfhosted software
- awesome-sysadmin resources
- Self-Hosted Podcast from Jupiter Broadcasting
Any issues on the community? Report it using the report flag.
Questions? DM the mods!