Diag half2 Please Ignore Delete Me
Getwebup
1 min read
t
line: 'PasswordAuthentication no'
notify: restart sshd
- name: Disable root SSH login
lineinfile:
path: /etc/ssh/sshd_config
regexp: '^#?PermitRootLogin'
line: 'PermitRootLogin no'
notify: restart sshd
- name: Install ufw and fail2ban
apt:
name: ['ufw', 'fail2ban']
state: present
- name: Allow SSH, HTTP, HTTPS through ufw
ufw:
rule: allow
port: "{{ item }}"
loop: ['22', '80', '443']
- name: Enable ufw
ufw:
state: enabled
policy: deny
handlers:
- name: restart sshd
service:
name: sshd
state: restarted