From c60787b5f3cb4ca20c08a3793daab8ee4b185c7a Mon Sep 17 00:00:00 2001 From: Alexandre Pujol Date: Thu, 7 Apr 2022 21:10:16 +0100 Subject: [PATCH] feat: add initial version of fail2ban. --- apparmor.d/profiles-a-f/fail2ban-client | 23 +++++++++++++++ apparmor.d/profiles-a-f/fail2ban-server | 37 +++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 apparmor.d/profiles-a-f/fail2ban-client create mode 100644 apparmor.d/profiles-a-f/fail2ban-server diff --git a/apparmor.d/profiles-a-f/fail2ban-client b/apparmor.d/profiles-a-f/fail2ban-client new file mode 100644 index 00000000..5eef6ddd --- /dev/null +++ b/apparmor.d/profiles-a-f/fail2ban-client @@ -0,0 +1,23 @@ +# apparmor.d - Full set of apparmor profiles +# Copyright (C) 2022 Alexandre Pujol +# SPDX-License-Identifier: GPL-2.0-only + +abi , + +include + +@{exec_path} = /{usr/,}bin/fail2ban-client +profile fail2ban-client @{exec_path} { + include + include + include + + @{exec_path} mr, + + /{usr/,}bin/ r, + /{usr/,}bin/python3.[0-9]* r, + + /etc/fail2ban/{,**} r, + + include if exists +} \ No newline at end of file diff --git a/apparmor.d/profiles-a-f/fail2ban-server b/apparmor.d/profiles-a-f/fail2ban-server new file mode 100644 index 00000000..f8f7f45e --- /dev/null +++ b/apparmor.d/profiles-a-f/fail2ban-server @@ -0,0 +1,37 @@ +# apparmor.d - Full set of apparmor profiles +# Copyright (C) 2022 Alexandre Pujol +# SPDX-License-Identifier: GPL-2.0-only + +abi , + +include + +@{exec_path} = /{usr/,}bin/fail2ban-server +profile fail2ban-server @{exec_path} flags=(attach_disconnected) { + include + include + include + + @{exec_path} mr, + + /{usr/,}bin/{,ba,da}sh rix, + /{usr/,}{s,}bin/xtables-nft-multi rix, + /{usr/,}{s,}bin/iptables rix, + + /{usr/,}bin/ r, + /{usr/,}bin/python3.[0-9]* r, + + /etc/fail2ban/{,**} r, + + /var/lib/fail2ban/fail2ban.sqlite3 rwk, + /var/log/auth.log r, + /var/log/fail2ban.log w, + + @{run}/fail2ban/fail2ban.pid w, + @{run}/fail2ban/fail2ban.sock w, + @{run}/resolvconf/resolv.conf r, + + owner @{PROC}/@{pid}/fd/ r, + + include if exists +} \ No newline at end of file