mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-03-27 19:37:22 +01:00
added persistence by adding a couple lines to /etc/network/interfaces. It will automatically load at start, save each time the cron.daily runs, so if you need to reboot the ipset is loaded again.
This commit is contained in:
@@ -7,13 +7,13 @@
|
||||
source setup/functions.sh # load our functions
|
||||
source /etc/mailinabox.conf # load global vars
|
||||
|
||||
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | debconf-set-selections
|
||||
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | debconf-set-selections
|
||||
apt_install -y ipset
|
||||
ipset create blacklist hash:net
|
||||
iptables -I INPUT -m set --match-set blacklist src -j DROP
|
||||
cp conf/blacklist/blacklist /etc/cron.daily/blacklist
|
||||
chmod a+x /etc/cron.daily/blacklist
|
||||
time /etc/cron.daily/blacklist
|
||||
apt_install -y iptables-persistent
|
||||
iptables-save > /etc/iptables.up.rules
|
||||
sed -i -e "\$apre-up ipset restore < /etc/ipset.up.rules" /etc/network/interfaces
|
||||
sed -e "\$apost up iptables-restore < /etc/iptables.up.rules" /etc/network/interfaces
|
||||
echo "Blacklist has been installed. It will run daily automatically."
|
||||
Reference in New Issue
Block a user