Refresh blocklist firewall after restore

This commit is contained in:
Bob Mottram 2017-06-26 12:18:29 +01:00
parent dbce6a1a18
commit bcc5e80d21
3 changed files with 16 additions and 2 deletions

View File

@ -13,7 +13,7 @@
# License # License
# ======= # =======
# #
# Copyright (C) 2015-2016 Bob Mottram <bob@freedombone.net> # Copyright (C) 2015-2017 Bob Mottram <bob@freedombone.net>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@ -128,6 +128,8 @@ function restore_blocklist {
fi fi
rm -rf $temp_restore_dir rm -rf $temp_restore_dir
firewall_refresh_blocklist
fi fi
} }

View File

@ -13,7 +13,7 @@
# License # License
# ======= # =======
# #
# Copyright (C) 2015-2016 Bob Mottram <bob@freedombone.net> # Copyright (C) 2015-2017 Bob Mottram <bob@freedombone.net>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@ -120,6 +120,8 @@ function restore_blocklist {
fi fi
rm -rf $temp_restore_dir rm -rf $temp_restore_dir
firewall_refresh_blocklist
fi fi
} }

View File

@ -491,6 +491,16 @@ function firewall_block_domain {
fi fi
} }
function firewall_refresh_blocklist {
if [ ! -f /root/${PROJECT_NAME}-firewall-domains.cfg ]; then
return
fi
while read blocked_domain; do
firewall_block_domain $blocked_domain
done </root/${PROJECT_NAME}-firewall-domains.cfg
}
function firewall_unblock_domain { function firewall_unblock_domain {
unblocked_domain="$1" unblocked_domain="$1"
if grep "${unblocked_domain}" $FIREWALL_DOMAINS; then if grep "${unblocked_domain}" $FIREWALL_DOMAINS; then