Created
December 11, 2024 06:34
-
-
Save manuel-schoebel/fb250fb8a3d998249156e4ca7fbe2048 to your computer and use it in GitHub Desktop.
hetzner-docker-cloudinit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
package_update: true | |
package_upgrade: true | |
packages: | |
- fail2ban | |
- ufw | |
- docker.io | |
- docker-compose | |
- unattended-upgrades | |
- git | |
- awscli | |
- postfix | |
groups: | |
- docker | |
system_info: | |
default_user: | |
groups: [docker] | |
runcmd: | |
- printf "[sshd]\nenabled = true\nbanaction = iptables-multiport" > /etc/fail2ban/jail.local | |
- systemctl enable fail2ban | |
- ufw allow OpenSSH | |
- ufw allow https | |
- ufw allow http | |
- ufw enable | |
- 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 | |
- aws --version | |
- reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment