local-users reference - hardening

Security Hardening Guidance

SSH keys

It is highly recommended to periodically review the SSH keys that have been added to your juju units and ensure that only authorized users have access. SSH keys provide secure, (potentially) passwordless login to your systems, but if not properly managed, they can become a security risk.

Over time, it’s common for employees or contractors to leave the company or change roles. If their SSH keys are not promptly removed, they may retain access to sensitive systems and data, potentially exposing the organization to unauthorized access.

By regularly auditing the SSH keys:

  • You can identify unused or outdated keys.
  • Ensure that only current and authorized personnel have access.
  • Remove keys associated with users who no longer need access, such as employees who have left the company.
  • This proactive measure helps maintain security hygiene and reduces the risk of data breaches or misuse of system resources.

An easy way to check the authorized users is:

  1. Find what is the configuration file on ssh-authorized-keys. E.g: $HOME/.ssh/authorized_keys

  2. List the users on this file:

awk '{print $NF}' ~/.ssh/authorized_keys

lp:johndoe
gh:janedoe
  1. In case you need to remove an user, access the file and remove the line from the identified user.