]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/scripts/convert-to-location
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
22 CONF_DIR
="/var/ipfire"
23 FW_CONF_DIR
="$CONF_DIR/firewall"
24 HOSTS_CONF_DIR
="$CONF_DIR/fwhosts"
26 # Check if the old blocking configuration file exists.
27 if [ -f "$FW_CONF_DIR/geoipblock" ]; then
28 # Convert variable, if blocking is enabled or not.
29 sed -i 's/GEOIPBLOCK/LOCATIONBLOCK/g' "$FW_CONF_DIR/geoipblock"
31 # Rename file to the new name.
32 mv "$FW_CONF_DIR/geoipblock" "$FW_CONF_DIR/locationblock"
34 # Loop through the firewall config directory.
35 for file in "$FW_CONF_DIR/config" "$FW_CONF_DIR/input" "$FW_CONF_DIR/outgoing"; do
36 # Convert pattern which indicates location based rules to the new
38 sed -i 's/cust_geoip/cust_location/g' "$file"
41 # Rename indicator for location based groups to the new one.
42 sed -i 's/GeoIP Group/Location Group/g' "$HOSTS_CONF_DIR/customgeoipgrp"
44 # Rename file to the new name.
45 mv "$HOSTS_CONF_DIR/customgeoipgrp" "$HOSTS_CONF_DIR/customlocationgrp"
47 # Regenerate firewall chains.
48 /etc
/init.d
/firewall restart
50 # Restart IPsec for dropped iptables rules
51 if grep -q "ENABLED=on" /var
/ipfire
/vpn
/settings
; then
52 /etc
/init.d
/ipsec restart