Skip to content

Commit

Permalink
Add fail2ban for login nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
tom91136 committed Nov 7, 2024
1 parent 273e028 commit a87bf9e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions playbook-svc-login.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@
- include_tasks: tasks/backup_or_restore_host_keys.yml
- include_tasks: tasks/setup_unattended_security_updates.yml

- name: Setup fail2ban
ansible.builtin.dnf:
name: ["fail2ban"]

- name: Configure fail2ban_config
ansible.builtin.template:
src: "ssh.conf.fail2ban.j2"
dest: /etc/fail2ban/jail.d/ssh.conf

- name: Enable fail2ban service
ansible.builtin.systemd_service:
name: fail2ban
state: restarted
enabled: true

- name: Setup missing Slurm dependencies
ansible.builtin.dnf:
name: ["/bin/mailx", "Lmod"]
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions templates/ssh.conf.fail2ban.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[sshd]
enabled = true
maxretry = 6
bantime = 90m
ignoreip = 127.0.0.1

0 comments on commit a87bf9e

Please sign in to comment.