Ver código fonte

Refresh blocklist firewall after restore

Bob Mottram 7 anos atrás
pai
commit
bcc5e80d21

+ 3
- 1
src/freedombone-restore-local Ver arquivo

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

+ 3
- 1
src/freedombone-restore-remote Ver arquivo

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

+ 10
- 0
src/freedombone-utils-firewall Ver arquivo

@@ -491,6 +491,16 @@ function firewall_block_domain {
491 491
     fi
492 492
 }
493 493
 
494
+function firewall_refresh_blocklist {
495
+    if [ ! -f /root/${PROJECT_NAME}-firewall-domains.cfg ]; then
496
+        return
497
+    fi
498
+
499
+    while read blocked_domain; do
500
+        firewall_block_domain $blocked_domain
501
+    done </root/${PROJECT_NAME}-firewall-domains.cfg
502
+}
503
+
494 504
 function firewall_unblock_domain {
495 505
     unblocked_domain="$1"
496 506
     if grep "${unblocked_domain}" $FIREWALL_DOMAINS; then