initial terraform code

This commit is contained in:
Oli
2022-10-09 21:13:41 +00:00
parent f73b890e18
commit 8072eb9434
9 changed files with 314 additions and 0 deletions

19
cloud.userdata Normal file
View File

@@ -0,0 +1,19 @@
#cloud-config
users:
- name: oli
primary_group: oli
groups: sudo
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFpczZfQ5MrfjSYz8MnDHG4sM2cQ8cIsj3ALDGtmW3zu
package_update: true
package_upgrade: true
runcmd:
- 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 3/' /etc/ssh/sshd_config
- systemctl restart sshd.service