• 0 Posts
  • 292 Comments
Joined 7 months ago
cake
Cake day: June 4th, 2025

help-circle






  • The general process would look something like:

    1. Find all of the SSH keys you want to replace.
    2. 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:

    1. Rename the public and private keys to something like old_id_rsa and old_id_rsa.pub (obviously use the same type name as your key, just prefix old_)
    2. 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)
    3. 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.
    4. Generate your new SSH keys ssh-keygen -t ed25519
    5. Log in to each server and ADD the new ~/.ssh/id_ed25519.pub key to the authorized_keys file or equivalent mechanism. Do not remove the old public key yet.
    6. Remove the IdentityFile line from your ~/.ssh/config
    7. Check you can log in to all your systems. This will validate that your new key is working.
    8. Remove your old public key from the authorized_keys file 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.


  • That’s certainly an option, but depending on how paranoid you are that still typically means that a compromised server can overwrite all of its backup images on the NAS, which could leave you in trouble. If you can configure your NAS to only allow creation of new backups but not allow changing old ones, you might be ok.


  • The big difference between pull and push is which system has keys to access the other, and what an attacker could do with them. With your home network you might ultimately decide this isn’t too important, but it’s worth at least thinking about anyway.

    In a push setup, each machine has some way (likely an SSH key) to authenticate to the NAS and push backup files to it. Each server has a different key to access a different path on the NAS, so if a server is compromised the attacker only gets access to that part of the NAS data, and if the NAS gets compromised, the attacker can’t connect to anything but has access to the encrypted backups (you do encrypt the backups you care about, right?). This limits how much extra data the attacker can read, but has the downside you mentioned.

    In a pull setup, the NAS has to have a way to connect to each server, typically as root for file access permissions. This means that if a server is compromised the attacker doesn’t gain a way to access even a limited portion of the NAS, but if the NAS is compromised they gain access to keys to root access on every server, which is likely catastrophic.

    A compromise solution can work. Have each server back up to a local file, then give the NAS permission to retrieve only that file, rather than root access. Whilst rsync isn’t going to work for creating the single file backup, something like borg or restic would. This does mean you need more disk space on each server, but it also means that the server doesn’t need direct access to the NAS, and the NAS only needs unpriviledged access to each server, mitigating the risk of a compromise.








  • notabot@piefed.socialtoOglaf@discuss.onlineAhoy
    link
    fedilink
    English
    arrow-up
    8
    ·
    12 days ago

    This is an important point to remember. Before you go to sea, you should always curse your legs, that who or whatever has them will continuously dance until they drop from exhaustion.

    It might backfire a bit, but look at the desperate expression on that whale’s face and tell me it’s not worth it.