Add possibility to restart Fail2ban service
This commit is contained in:
parent
fb43eeeb47
commit
f47be2bebe
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
### Fix
|
### Fix
|
||||||
* Set empty dependencies line to fix Galaxy warning.
|
* Set empty dependencies line to fix Galaxy warning.
|
||||||
|
* Add possibility to restart Fail2ban service.
|
||||||
|
|
||||||
## v1.4
|
## v1.4
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ Highly inspired by [Mike Gleason firewall role][mikegleasonjr firewall github] (
|
||||||
* **nft_service_manage** : If `nftables` service should be managed with this role [default : `true`].
|
* **nft_service_manage** : If `nftables` service should be managed with this role [default : `true`].
|
||||||
* **nft_service_name** : `nftables` service name [default : `nftables`].
|
* **nft_service_name** : `nftables` service name [default : `nftables`].
|
||||||
* **nft_service_enabled** : Set `nftables` service available at startup [default : `true`].
|
* **nft_service_enabled** : Set `nftables` service available at startup [default : `true`].
|
||||||
|
* **nft__fail2ban_service** : If the Nftables service should also restart the Fail2ban service [default : `False`].
|
||||||
|
|
||||||
### OS Specific Variables
|
### OS Specific Variables
|
||||||
|
|
||||||
|
|
|
@ -128,3 +128,4 @@ nft_service_name: 'nftables'
|
||||||
nft_service_enabled: true
|
nft_service_enabled: true
|
||||||
nft_service_unit_path: '/lib/systemd/system/nftables.service'
|
nft_service_unit_path: '/lib/systemd/system/nftables.service'
|
||||||
nft_service_unit_content: 'lib/systemd/system/nftables.service.j2'
|
nft_service_unit_content: 'lib/systemd/system/nftables.service.j2'
|
||||||
|
nft__fail2ban_service: False
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description={{ nft_service_name }}
|
Description={{ nft_service_name }}
|
||||||
Documentation=man:nft(8) http://wiki.nftables.org
|
Documentation=man:nft(8) http://wiki.nftables.org
|
||||||
Before=fail2ban.service
|
;Before=fail2ban.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
@ -10,9 +10,15 @@ RemainAfterExit=yes
|
||||||
StandardInput=null
|
StandardInput=null
|
||||||
ProtectSystem=full
|
ProtectSystem=full
|
||||||
ProtectHome=true
|
ProtectHome=true
|
||||||
|
{% if nft__fail2ban_service %}
|
||||||
|
ExecStart=/usr/sbin/nft -f {{ nft_main_conf_path }} ; /bin/systemctl restart fail2ban.service
|
||||||
|
ExecReload=/usr/sbin/nft -f {{ nft_main_conf_path }} ; /bin/systemctl restart fail2ban.service
|
||||||
|
ExecStop=/bin/systemctl stop fail2ban.service ; /usr/sbin/nft flush ruleset
|
||||||
|
{% else %}
|
||||||
ExecStart=/usr/sbin/nft -f {{ nft_main_conf_path }}
|
ExecStart=/usr/sbin/nft -f {{ nft_main_conf_path }}
|
||||||
ExecReload=/usr/sbin/nft -f {{ nft_main_conf_path }}
|
ExecReload=/usr/sbin/nft -f {{ nft_main_conf_path }}
|
||||||
ExecStop=/usr/sbin/nft flush ruleset
|
ExecStop=/usr/sbin/nft flush ruleset
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
Loading…
Reference in New Issue