diff --git a/src/freedombone-utils-firewall b/src/freedombone-utils-firewall index 574faffa..803ed5e5 100755 --- a/src/freedombone-utils-firewall +++ b/src/freedombone-utils-firewall @@ -110,19 +110,6 @@ function enable_ipv6 { echo 1 > /proc/sys/net/ipv6/conf/all/forwarding } -function update_external_ip { - ip_update_script=/usr/bin/externalipupdate - echo '#!/bin/bash' >> $ip_update_script - echo "existing_ip=\$(cat $CONFIGURATION_FILE | grep \"EXTERNAL_IPV4_ADDRESS=\" | head -n 1 | awk -F '=' '{print \$2}')'" >> $ip_update_script - echo "curr_ip=\$(nslookup . $EXTERNAL_IP_LOOKUP_URL | grep Address | tail -n 1 | awk -F ' ' '{print \$2}')" >> $ip_update_script - echo 'if [[ "$curr_ip" != "$existing_ip" ]]; then' >> $ip_update_script - echo " sed -i \"s|EXTERNAL_IPV4_ADDRESS=.*|EXTERNAL_IPV4_ADDRESS=\${curr_ip}|g\" $CONFIGURATION_FILE" >> $ip_update_script - echo ' iptables-save > /etc/firewall.conf' >> $ip_update_script - echo 'fi' >> $ip_update_script - - cron_add_mins 10 $ip_update_script -} - function firewall_disable_vpn { iptables -D INPUT -i ${FIREWALL_EIFACE} -m state --state NEW -p udp --dport 1194 -j ACCEPT iptables -D INPUT -i tun+ -j ACCEPT diff --git a/src/freedombone-utils-network b/src/freedombone-utils-network index 9812a9b8..f1e45cea 100755 --- a/src/freedombone-utils-network +++ b/src/freedombone-utils-network @@ -85,4 +85,17 @@ function get_ipv6_address { echo $(echo "$retval" | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }') } +function update_external_ip { + ip_update_script=/usr/bin/externalipupdate + echo '#!/bin/bash' >> $ip_update_script + echo "existing_ip=\$(cat $CONFIGURATION_FILE | grep \"EXTERNAL_IPV4_ADDRESS=\" | head -n 1 | awk -F '=' '{print \$2}')'" >> $ip_update_script + echo "curr_ip=\$(nslookup . $EXTERNAL_IP_LOOKUP_URL | grep Address | tail -n 1 | awk -F ' ' '{print \$2}')" >> $ip_update_script + echo 'if [[ "$curr_ip" != "$existing_ip" ]]; then' >> $ip_update_script + echo " sed -i \"s|EXTERNAL_IPV4_ADDRESS=.*|EXTERNAL_IPV4_ADDRESS=\${curr_ip}|g\" $CONFIGURATION_FILE" >> $ip_update_script + echo ' iptables-save > /etc/firewall.conf' >> $ip_update_script + echo 'fi' >> $ip_update_script + + cron_add_mins 10 $ip_update_script +} + # NOTE: deliberately no exit 0