/* das script benötigt folgende tabellen in der datenbank: * ssh_auth_clients spalten -> serial [int 11], public_key [text] * ssh_auth_server spalten -> id [int 11], public_key [text] * * du musst auf jeden fall den ping befehl anpassen und der pfad zum hostfile auf dem * apache2 lautet '/home/httpd/.ssh/known_host', evtl müsste das verzeichnis .ssh erstellt werden * * that's it, works4me (TM) */ include('include/dbconn.php'); echo '
'; echo '';
$pubkey = mysql_query('select public_key from ssh_auth_clients where serial='.$client.'');
while ($row = mysql_fetch_row ($pubkey)) {
# schreiben der .ssh/known_hosts file mit dem public rsa key des client,
# um die "yes" abfrage zu vermeiden
$hostfile = fopen ($home."/.ssh/known_hosts","w");
fwrite($hostfile,$ip." ".$row[0],strlen($row[0])+strlen($ip)+1);
fclose($hostfile);
# reboot des clients
passthru($pingcmd.' '.$ip.' &> /dev/null && exit 0 || exit 1',$retval);
if($retval==0) {
echo ' '.strtoupper($op.'ing client #'.$client.' ('.$ip.')... '); system($sshcmd.' '.$ip.' /sbin/'.$op); } else echo ' '.strtoupper('Client not online, try again later... '); } echo ' |