Skip to content

Commit

Permalink
Adjust firewalld logging
Browse files Browse the repository at this point in the history
Refs #70
Refs #73
  • Loading branch information
bviktor committed Mar 7, 2023
1 parent ec49e35 commit a831cb8
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 15 deletions.
9 changes: 9 additions & 0 deletions roles/install/files/firewalld-denied.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
:msg, regex, ".*_DROP: .* DPT=7777 .*" /var/log/firewalld-denied-kf2.log
& stop
:msg, regex, ".*_REJECT: .* DPT=7777 .*" /var/log/firewalld-denied-kf2.log
& stop

:msg, contains, "_DROP: " /var/log/firewalld-denied.log
& stop
:msg, contains, "_REJECT: " /var/log/firewalld-denied.log
& stop
4 changes: 0 additions & 4 deletions roles/install/files/kf2-ddos.conf

This file was deleted.

5 changes: 5 additions & 0 deletions roles/install/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@
systemd:
name: rsyslog.service
state: restarted

- name: Reload journald configuration
systemd:
name: systemd-journald.service
state: restarted
36 changes: 25 additions & 11 deletions roles/install/tasks/firewalld.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,33 @@
state: started
enabled: true

- name: Configure KF2 DDoS logging
- name: Redirect logging of denied packets
copy:
src: kf2-ddos.conf
dest: /etc/rsyslog.d/kf2-ddos.conf
src: firewalld-denied.conf
dest: /etc/rsyslog.d/firewalld-denied.conf
owner: root
group: root
mode: '0644'
notify: Reload rsyslog configuration

- name: Log packets denied by firewalld
lineinfile:
path: /etc/firewalld/firewalld.conf
regexp: '^LogDenied='
line: LogDenied=all
notify: Reload firewalld configuration
- name: Limit journald storage
ini_file:
path: /etc/systemd/journald.conf
section: Journal
option: SystemMaxUse
value: 100M
no_extra_spaces: true
create: false
backup: true
notify: Reload journald configuration

# This will be enabled on-demand via klf
#- name: Log packets denied by firewalld
# lineinfile:
# path: /etc/firewalld/firewalld.conf
# regexp: '^LogDenied='
# line: LogDenied=all
# notify: Reload firewalld configuration

- include_role:
name: bviktor.firewalld
Expand All @@ -41,6 +53,8 @@
- include_role:
name: bviktor.logrotate
vars:
name: kf2-ddos
pattern: /var/log/kf2-ddos.log
name: firewalld-denied
pattern: |-
/var/log/firewalld-denied.log
/var/log/firewalld-denied-kf2.log
retention: 7

0 comments on commit a831cb8

Please sign in to comment.