Skip to content

Commit

Permalink
replace tf specific sshd configuration by a separate file that is inc…
Browse files Browse the repository at this point in the history
…luded in sshd_config
  • Loading branch information
mboisson committed Jan 22, 2025
1 parent 4768455 commit 4c65098
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion common/configuration/puppet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ runcmd:
- chmod 755 /etc # avoid issue with Rocky 9.4
- test ! -d /${sudoer_username} && userdel -f -r ${sudoer_username} && cloud-init clean -r
- restorecon -R /${sudoer_username}
- echo -e "match User tf\n\tAuthorizedKeysFile /etc/ssh/authorized_keys.%u\n\tAuthenticationMethods publickey" >> /etc/ssh/sshd_config
- echo -e "Include /etc/ssh/sshd_config.d/50-authenticationmethods.conf" >> /etc/ssh/sshd_config
- sed -i '/HostKey \/etc\/ssh\/ssh_host_ecdsa_key/ s/^#*/#/' /etc/ssh/sshd_config
- chmod 644 /etc/ssh/ssh_host_*_key.pub
- chgrp ssh_keys /etc/ssh/ssh_host_*_key.pub
Expand Down Expand Up @@ -134,6 +134,12 @@ write_files:
- content: restrict%{ if contains(tags, "puppet") },pty%{ else }%{ for host, ip in puppetservers },permitopen="${ip}:22"%{ endfor },port-forwarding,command="/sbin/nologin"%{ endif } ${tf_ssh_public_key}
path: /etc/ssh/authorized_keys.tf
permissions: "0644"
- conent: |
Match User tf
AuthorizedKeysFile /etc/ssh/authorized_keys.%u
AuthenticationMethods publickey
path: /etc/ssh/sshd_config.d/50-authenticationmethods.conf
permissions: "0600"
- content: |
facts : {
blocklist : [
Expand Down

0 comments on commit 4c65098

Please sign in to comment.