update
This commit is contained in:
7
roles/01-server_hardening/tasks/01-update-system.yml
Normal file
7
roles/01-server_hardening/tasks/01-update-system.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
- name: Update apt cache for Debian/Ubuntu
|
||||
apt:
|
||||
update_cache: yes
|
||||
cache_valid_time: 3600
|
||||
when: ansible_os_family == "Debian"
|
||||
tags: ['system-update']
|
11
roles/01-server_hardening/tasks/02-configure-ssh.yml
Normal file
11
roles/01-server_hardening/tasks/02-configure-ssh.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
- name: Configure SSH daemon
|
||||
template:
|
||||
src: sshd_config.j2
|
||||
dest: /etc/ssh/sshd_config
|
||||
backup: yes
|
||||
mode: '0600'
|
||||
owner: root
|
||||
group: root
|
||||
notify: restart sshd
|
||||
tags: ['ssh-config']
|
@@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: Install UFW firewall
|
||||
package:
|
||||
name: ufw
|
||||
state: present
|
||||
tags: ['firewall-install']
|
7
roles/01-server_hardening/tasks/04-install-fail2ban.yml
Normal file
7
roles/01-server_hardening/tasks/04-install-fail2ban.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
--
|
||||
- name: Install fail2ban
|
||||
package:
|
||||
name: fail2ban
|
||||
state: present
|
||||
when: fail2ban_enabled
|
||||
tags: ['fail2ban-install']
|
11
roles/01-server_hardening/tasks/05-additional-hardening.yml
Normal file
11
roles/01-server_hardening/tasks/05-additional-hardening.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
- name: Disable unused services
|
||||
systemd:
|
||||
name: "{{ item }}"
|
||||
state: stopped
|
||||
enabled: no
|
||||
loop:
|
||||
- bluetooth
|
||||
- cups
|
||||
ignore_errors: yes
|
||||
tags: ['disable-services']
|
20
roles/01-server_hardening/tasks/main.yml
Normal file
20
roles/01-server_hardening/tasks/main.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
- name: Include system update tasks
|
||||
include_tasks: 01-update-system.yml
|
||||
tags: ['hardening', 'system-update']
|
||||
|
||||
- name: Include SSH configuration tasks
|
||||
include_tasks: 02-configure-ssh.yml
|
||||
tags: ['hardening', 'ssh']
|
||||
|
||||
- name: Include firewall configuration tasks
|
||||
include_tasks: 03-configure-firewall.yml
|
||||
tags: ['hardening', 'firewall']
|
||||
|
||||
- name: Include fail2ban installation tasks
|
||||
include_tasks: 04-install-fail2ban.yml
|
||||
tags: ['hardening', 'fail2ban']
|
||||
|
||||
- name: Include additional hardening tasks
|
||||
include_tasks: 05-additional-hardening.yml
|
||||
tags: ['hardening', 'additional']
|
Reference in New Issue
Block a user