proxy remoti

This commit is contained in:
cmaffio
2016-05-11 15:18:31 +02:00
parent 3f68b14259
commit 6e8811e3a6
2 changed files with 27 additions and 1 deletions

View File

@@ -104,6 +104,33 @@ function genera ($DB_ID) {
}
fclose($fp);
exec ("sudo /opt/squid/sbin/squid -k reconfigure");
remote ($DB_ID);
}
function remote ($DB_ID) {
$query = " SELECT
host,
port,
usr,
pwd,
path,
command
FROM
proxy_remote
WHERE
attivo = 1
";
$res = mysql_query( $query, $DB_ID );
while ($dato = mysql_fetch_array ( $res )) {
$connection = ssh2_connect($dato['host'], $dato['port']);
ssh2_auth_password($connection, $dato['usr'], $dato['pwd']);
ssh2_scp_send($connection, 'squid_acl/listip', $dato['path'].'/listip', 0644);
$stream = ssh2_exec($connection, $dato['command']);
}
}
?>