First stage for ssh key rotate and remove scripts

This commit is contained in:
Clemens Schwaighofer
2024-05-15 18:41:43 +09:00
parent cba0f964e7
commit 950dc33cb9
5 changed files with 315 additions and 79 deletions

View File

@@ -4,8 +4,26 @@
- copy to server to
- $ADMIN/.ssh (to be ended for admin user)
- /etc/ssh/authorized_keys--master
- /etc/ssh/authorized_keys/$ADMIN
- /etc/ssh/authorized_keys/$USER
Then remove old key
Store ssh key name for current period
## Scripts
### rotate-ssh-keys.sh
Will create a new key and deploy on the server and move the PEM part to the
local SSH folder
### remove-old-ssh-keys.sh
Will check in the previous ssh public key folder and remove this entry from the remote server
### Options
- -h override single host name
- -u override user name for a host
- -f force key change
- -n dry run