I have a project that calls users' SSH servers to do some tasks. For now, I am storing users' passwords at my service as hashed (Username, hashed password and salt), but the SSH password (username, encrypted password and host address) is only encrypted by a known secret I have stored in server configurations with admin access only. The user count was very low, so that seemed okay, but now I'd like to improve this situation because I'm afraid that if my database or server gets accessed, they can access my users' servers too.
My question is how to store SSH credential my service needs to do maintenance job for other users?
ssh
commands that run periodically and automatically and must be able to do so with no human intervention; 2) an offline copy of your db that contains all the variousssh
credential meta and which you're concerned might be stolen; and 3) you also want to mitigate the risk that your live server is accessed leaving the decryptedssh
credentials exposed?ssh
new creds, wait a bit, then connect to the client host and replace the creds, so connection to client hosts from the maintenance host is quickly disabled, eg. via api or as @mentallurg suggests usingssh
public keys inauthorized_keys