Apply formatting

This commit is contained in:
James Grogan 2024-09-29 14:06:05 +01:00
parent a6382a9b96
commit 9a70b6206b
12 changed files with 136 additions and 121 deletions

View file

@ -5,14 +5,17 @@ from .util import run_op
logger = logging.getLogger(__name__)
class SshConfig:
def __init__(self):
self.config_path = Path("/etc/ssh/ssh_config")
self.target_values = {"PermitRootLogin": "No",
"PasswordAuthentication": "No",
"ChallengeResponseAuthentication": "No",
"UsePAM": "No"}
self.target_values = {
"PermitRootLogin": "No",
"PasswordAuthentication": "No",
"ChallengeResponseAuthentication": "No",
"UsePAM": "No",
}
def sync_target_values(self):
logger.info(f"Updating ssh config in: {self.config_path}")
@ -23,8 +26,7 @@ class SshConfig:
logger.info(f"Restarting ssh service: {op}")
run_op(op)
def copy_ssh_dir_to_user(self, username:str):
def copy_ssh_dir_to_user(self, username: str):
op = f"rsync --archive --chown={username}:{username} ~/.ssh /home/{username}"
logger.info(f"Copying ssh dir to user: {op}")
run_op(op)