Compare commits
2
Commits
fd58ee2c16
...
c36f269406
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c36f269406 | ||
|
|
19a62a43ca |
@@ -5,8 +5,3 @@
|
||||
systemd:
|
||||
name: systemd-journald
|
||||
state: restarted
|
||||
|
||||
- name: restart_fail2ban
|
||||
systemd:
|
||||
name: fail2ban
|
||||
state: restarted
|
||||
|
||||
@@ -1,9 +1,27 @@
|
||||
# Debian 12+ ships no syslog daemon, so there is no /var/log/auth.log and the
|
||||
# file-based sshd jail refuses to start; read sshd from the journal instead.
|
||||
- name: Read the sshd jail from the journal
|
||||
copy:
|
||||
dest: /etc/fail2ban/jail.d/sshd-systemd.conf
|
||||
content: |
|
||||
[sshd]
|
||||
backend = systemd
|
||||
notify: restart_fail2ban
|
||||
# CrowdSec reads the same logs and bans through its bouncers. fail2ban is
|
||||
# removed only where both are running, so a host never ends up without a ban
|
||||
# mechanism.
|
||||
- name: Check the CrowdSec services
|
||||
command: systemctl is-active crowdsec crowdsec-firewall-bouncer
|
||||
register: crowdsec_active
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
tags: fail2ban
|
||||
|
||||
- name: Stop and disable fail2ban
|
||||
systemd:
|
||||
name: fail2ban
|
||||
state: stopped
|
||||
enabled: false
|
||||
when: crowdsec_active.rc == 0
|
||||
failed_when: false
|
||||
tags: fail2ban
|
||||
|
||||
- name: Remove fail2ban
|
||||
apt:
|
||||
name: fail2ban
|
||||
state: absent
|
||||
purge: true
|
||||
when: crowdsec_active.rc == 0
|
||||
tags: fail2ban
|
||||
|
||||
@@ -16,5 +16,4 @@
|
||||
- curl
|
||||
- rsync
|
||||
- zstd
|
||||
- fail2ban
|
||||
state: latest
|
||||
|
||||
@@ -16,12 +16,14 @@
|
||||
install_recommends: false
|
||||
state: present
|
||||
|
||||
# A node reaching its own address arrives at Traefik from its cilium_host address, which the
|
||||
# NetBird allowlist rejects; it takes the other nodes.
|
||||
- name: Pin the ingest name to the NetBird addresses
|
||||
ansible.builtin.blockinfile:
|
||||
path: /etc/hosts
|
||||
marker: "# {mark} journal_upload"
|
||||
block: |
|
||||
{% for address in journal_upload.addresses %}
|
||||
{% for address in journal_upload.addresses | reject('in', ansible_facts.all_ipv4_addresses) %}
|
||||
{{ address }} {{ journal_upload.host }}
|
||||
{% endfor %}
|
||||
notify: Restart systemd-journal-upload
|
||||
|
||||
Reference in New Issue
Block a user