Compare commits
2
Commits
fd58ee2c16
...
c36f269406
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c36f269406 | ||
|
|
19a62a43ca |
@@ -5,8 +5,3 @@
|
|||||||
systemd:
|
systemd:
|
||||||
name: systemd-journald
|
name: systemd-journald
|
||||||
state: restarted
|
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
|
# CrowdSec reads the same logs and bans through its bouncers. fail2ban is
|
||||||
# file-based sshd jail refuses to start; read sshd from the journal instead.
|
# removed only where both are running, so a host never ends up without a ban
|
||||||
- name: Read the sshd jail from the journal
|
# mechanism.
|
||||||
copy:
|
- name: Check the CrowdSec services
|
||||||
dest: /etc/fail2ban/jail.d/sshd-systemd.conf
|
command: systemctl is-active crowdsec crowdsec-firewall-bouncer
|
||||||
content: |
|
register: crowdsec_active
|
||||||
[sshd]
|
changed_when: false
|
||||||
backend = systemd
|
failed_when: false
|
||||||
notify: restart_fail2ban
|
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
|
- curl
|
||||||
- rsync
|
- rsync
|
||||||
- zstd
|
- zstd
|
||||||
- fail2ban
|
|
||||||
state: latest
|
state: latest
|
||||||
|
|||||||
@@ -16,12 +16,14 @@
|
|||||||
install_recommends: false
|
install_recommends: false
|
||||||
state: present
|
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
|
- name: Pin the ingest name to the NetBird addresses
|
||||||
ansible.builtin.blockinfile:
|
ansible.builtin.blockinfile:
|
||||||
path: /etc/hosts
|
path: /etc/hosts
|
||||||
marker: "# {mark} journal_upload"
|
marker: "# {mark} journal_upload"
|
||||||
block: |
|
block: |
|
||||||
{% for address in journal_upload.addresses %}
|
{% for address in journal_upload.addresses | reject('in', ansible_facts.all_ipv4_addresses) %}
|
||||||
{{ address }} {{ journal_upload.host }}
|
{{ address }} {{ journal_upload.host }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
notify: Restart systemd-journal-upload
|
notify: Restart systemd-journal-upload
|
||||||
|
|||||||
Reference in New Issue
Block a user