mirror of
https://github.com/2martens/terraform.git
synced 2026-10-17 13:36:51 +02:00
Added extra cloud-init for kubernetes hosts
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#cloud-config
|
||||
users:
|
||||
- name: 2martensAdmin
|
||||
groups: users, admin
|
||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||
shell: /bin/bash
|
||||
ssh_authorized_keys:
|
||||
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBjYkz73HbsFtRAOfS5QB9xDbOajU9C4gpDp+OjQkLir 2martens@Jims-Air.fritz.box"
|
||||
packages:
|
||||
- fail2ban
|
||||
- ufw
|
||||
package_update: true
|
||||
package_upgrade: true
|
||||
runcmd:
|
||||
- printf "[sshd]\nenabled = true\nbanaction = iptables-multiport" > /etc/fail2ban/jail.local
|
||||
- systemctl enable fail2ban
|
||||
- ufw allow OpenSSH
|
||||
- ufw allow 16443 comment Kubernetes
|
||||
- ufw allow 80 comment HTTP
|
||||
- ufw allow 443 comment HTTPS
|
||||
- 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
|
||||
- sed -i '$a AllowUsers 2martensAdmin' /etc/ssh/sshd_config
|
||||
- curl https://packages.hetzner.com/hcloud/deb/hc-utils_0.0.4-1_all.deb -o /tmp/hc-utils_0.0.4-1_all.deb -s
|
||||
- apt install /tmp/hc-utils_0.0.4-1_all.deb
|
||||
- mkdir -p /var/snap/microk8s/common/
|
||||
- curl https://repo.2martens.de/files/microk8s-config.yaml -o /var/snap/microk8s/common/.microk8s.yaml
|
||||
- snap install microk8s --channel 1.28-strict/stable
|
||||
- reboot
|
||||
Reference in New Issue
Block a user