Files
terraform/terraform/modules/docker-network/templates/scripts/ssh-setup.sh.tftpl
T
2martens eba8edf610 change: Add support for manager and worker nodes in Docker swarm
change: Extract port 80/443 to separate firewalls
2025-08-03 15:05:35 +02:00

15 lines
835 B
Plaintext

#!/bin/sh
sed -i -e '/^\(#\|\)PermitRootLogin/s/^.*$/PermitRootLogin no/' /etc/ssh/sshd_config
sed -i -e '/^\(#\|\)PasswordAuthentication/s/^.*$/PasswordAuthentication no/' /etc/ssh/sshd_config
sed -i -e '/^\(#\|\)X11Forwarding/s/^.*$/X11Forwarding no/' /etc/ssh/sshd_config
sed -i -e '/^\(#\|\)MaxAuthTries/s/^.*$/MaxAuthTries 2/' /etc/ssh/sshd_config
sed -i -e '/^\(#\|\)AllowTcpForwarding/s/^.*$/AllowTcpForwarding no/' /etc/ssh/sshd_config
sed -i -e '/^\(#\|\)AllowAgentForwarding/s/^.*$/AllowAgentForwarding no/' /etc/ssh/sshd_config
sed -i -e '/^\(#\|\)AuthorizedKeysFile/s/^.*$/AuthorizedKeysFile .ssh\/authorized_keys/' /etc/ssh/sshd_config
%{if manager_node ~}
sed -i '$a AllowUsers ${admin_user} terraform github' /etc/ssh/sshd_config
%{else ~}
sed -i '$a AllowUsers ${admin_user} terraform' /etc/ssh/sshd_config
%{endif ~}