run sudo visudo
root ALL=(ALL) ALL
wwwrun ALL=NOPASSWD: /usr/sbin/iptables
<?php
$ip=$_SERVER['REMOTE_ADDR'];
echo " Welcome your IP $ip has been white listed";
$web=shell_exec("sudo iptables -I INPUT 2 -m state --state NEW,RELATED,ESTABLISHED -m tcp -p tcp --dport 80 -s $ip -j ACCEPT");
$sip=shell_exec("sudo iptables -I INPUT 2 -m state --state NEW,RELATED,ESTABLISHED -m udp -p udp --dport 28614 -s $ip -j ACCEPT"
?>
https://exain.wordpress.com/2007/11/24/execute-system-commands-via-php/
No hay comentarios:
Publicar un comentario