For information Fail2ban read the files in alphabetical order in this folder. If you have a file jail-perso.conf and another zen.conf with identical parameter, zen.conf erase the jail-perso.conf parameter. You can use this to add parameters or erase yunohost parameters without hook.
Good to know, however I like hooks to easily restore or install yunohost servers (including tons of config files everywhere).
I use conf_regen hooks too but i use customs jails in /etc/fail2ban/jail.d before use them . I don’t write hook to replace them and I use /etc/yunohost/hooks.d/backup/99-conf_custom (and the restore file too) to save/restore them and many additionals files. Use conf_regen hooks to modify config file and backup hook 99-conf_custom to save all types of files is a great combination ![]()
Yes, I do the same. And a few days ago, I noticed this app that allows to add custom path/files to the backup without managing the hook ourselves.
I did not test it yet, but it may be quite handy.
also modify
sed -i \'/smtpd_recipient_restrictions/a\ ….
with (note /i instead of /a )
sed -i '/reject_non_fqdn_recipient,/i\…
to make sure this gets applied after your default rules.
The hook only do what the documentation on spamhaus says :
We recommend putting these lines at the top of the smtpd_recipient_restrictions section.
Could you explain why the hook should’nt follow the spamhaus documentation?
I notice that a change was made since i post the hook, the las tline is now at the first place and [2..255] was changed with [2.11] , i don’t know the consequence of this change or if the first recommendation is still valid.
with the /a version, you will insert the spamhaus rules before these two lines:
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
and rules are applied in order. Which means messages sent from your local server or properly authenticated will go through the spamhaus filters for no reason. On my setup, this has sometimes very unpredictably prevented me from sending emails.
The modified version makes sure to preserve the rules order with the two permit lines first.
You could use this command to list all the settings
yunohost settings list