diff --git a/firewall/firewall_library.php b/firewall/firewall_library.php index f1cf65c..4ac344c 100644 --- a/firewall/firewall_library.php +++ b/firewall/firewall_library.php @@ -2,10 +2,11 @@ function genera () { // $file_in = "/etc/sysconfig/scripts/SuSEfirewall2-custom"; - $file_in = "tmp/fw.new"; - $file_out = "tmp/fw.new"; +// $file_in = "tmp/fw.new"; +// $file_out = "tmp/fw.new"; + $FW_conf = carica_conf ("Firewall"); - $FW = file ($file_in); + $FW = file ($FW_conf['file_in']); $prima = array (); $dopo = array (); $vecchie_u = array (); @@ -51,16 +52,15 @@ function genera () { elimina ($regola); } - $new = array_merge($prima,$nuove_ext[1], $dopo); - file_put_contents ($file_out, $new, LOCK_EX); - + file_put_contents ($FW_conf['file_out'], $new, LOCK_EX); + $comando = "sudo cp ".$FW_conf['file_out']." ".$FW_conf['file_in']; + exec ($comando); } function genera_ext () { - global $UTENTE, $DB_ID, $CONF; + global $UTENTE, $DB_ID, $CONF, $FW_conf; - $FW_conf = carica_conf ("Firewall"); $query = " SELECT firewall_versoesterno_regole.id, diff --git a/firewall/firewall_vpn.php b/firewall/firewall_vpn.php new file mode 100755 index 0000000..14fef75 --- /dev/null +++ b/firewall/firewall_vpn.php @@ -0,0 +1,104 @@ + +
+ + + + Utenza + + Accesso VPN + + + + + + + + +
+riga(); +$query = " SELECT + id, + utenza, + tipo, + ip, + DATE_FORMAT(data, '%d.%m.%Y %H:%i:%s') AS data, + attivo + FROM + firewall_vpn + ORDER BY + utenza + "; + +$res = mysql_query( $query, $DB_ID ); +while ($dato = mysql_fetch_array ( $res )) { +?> + + + + Regola attiva + + Regola non attiva + + + + + + + + + + + + + + + +riga(); +} +$tabella->close(); +view_footer(); +?> diff --git a/firewall/tmp/fw.new b/firewall/tmp/fw.new index 21706a1..29d1c58 100644 --- a/firewall/tmp/fw.new +++ b/firewall/tmp/fw.new @@ -1,16 +1,16 @@ fw_custom_after_chain_creation() { # REGOLE DINAMICHE -### START REGOLA-U1 ### +### START REGOLA-U1 PERMANENTE ### iptables -N REGOLA-U1 -iptables -I REGOLA-U1 -p tcp -o bond0 -s 192.168.1.1 --sport 25 -d 151.1.219.70 --dport 443 -j ACCEPT -iptables -I REGOLA-U1 -p tcp -i bond0 -d 192.168.1.1 --dport 25 -s 151.1.219.70 --sport 443 -j ACCEPT +iptables -I REGOLA-U1 -p tcp -o -s 192.168.1.1 --sport 25 -d 151.1.219.70 --dport 443 -j ACCEPT +iptables -I REGOLA-U1 -p tcp -i -d 192.168.1.1 --dport 25 -s 151.1.219.70 --sport 443 -j ACCEPT iptables -I FORWARD -j REGOLA-U1 -### STOP REGOLA-U1 ### +### STOP REGOLA-U1 PERMANENTE ### ### START REGOLA-U3 ### iptables -N REGOLA-U3 -iptables -I REGOLA-U3 -p udp -o bond0 -s 192.168.1.3 --sport 45 -d 151.1.219.70 --dport 6754 -j ACCEPT -iptables -I REGOLA-U3 -p udp -i bond0 -d 192.168.1.3 --dport 45 -s 151.1.219.70 --sport 6754 -j ACCEPT +iptables -I REGOLA-U3 -p udp -o -s 192.168.1.3 --sport 45 -d 151.1.219.70 --dport 6754 -j ACCEPT +iptables -I REGOLA-U3 -p udp -i -d 192.168.1.3 --dport 45 -s 151.1.219.70 --sport 6754 -j ACCEPT iptables -I FORWARD -j REGOLA-U3 ### STOP REGOLA-U3 ### # FINE REGOLE DINAMICHE