Forum Moderators: coopster
function do_iptable($ip) {
$shellObj= \MTS\Factories::getDevices()->getLocalHost()->getShell('bash', false);
// Pass the shellObj to the following function with root credentials.
\MTS\Factories::getActions()->getRemoteUsers()->changeUser($shellObj, 'root', 'password');
// no actual return but in case future...
$rtn = $shellObj->exeCmd("/srv/phptabip $ip");
$shellObj->terminate();
return($rtn); #!/bin/bash
#
# add given IP to iptables Dynamic port 443 from php
# assumed incoming ip is valid format
# do not add to rules.v4
ip=$1
if [ "$ip" == "" ]; then exit
fi
/usr/sbin/iptables -I Dynamic -s $ip -p tcp --dport 443 -j DROP