File: //proc/self/root/proc/self/root/scripts.20110531.215904.25158/trustme
#!/usr/bin/perl
# cpanel4 - scripts Copyright(c) 1997-2002 cPanel, Inc..
# All rights Reserved.
# copyright@cpanel.net http://cpanel.net
# This code is subject to the cpanel license. Unauthorized copying is prohibited
chomp($kk = <STDIN>);
($host,$root) = split(/\s/, $kk);
if (! -e "/root/.ssh/identity") {
system("/usr/bin/ssh-keygen -t rsa1 -f /root/.ssh/identity -P \"\"");
}
if (! -e "/root/.ssh/identity2") {
system("/usr/bin/ssh-keygen -t rsa -f /root/.ssh/id_rsa -P \"\"");
system("/usr/bin/ssh-keygen -t dsa -f /root/.ssh/id_dsa -P \"\"");
}
open(IP,"/root/.ssh/identity.pub");
chomp($ip = <IP>);
close(IP);
if ($ip !~ /^\d+/) {
$ip =~ s/^\S+\s//g;
}
open(SSHS,">/root/.sshscript");
print SSHS "echo Script ok\n";
print SSHS "mkdir /root/.ssh\n";
print SSHS "chmod 700 /root/.ssh\n";
print SSHS ("echo \'$ip\' >> /root/.ssh/authorized_keys\n");
print SSHS "chmod 700 /root/.ssh/authorized_keys\n";
print SSHS "echo Copy Complete\n";
close(SSHS);
open(SC,"|/scripts/ssh.expect $host");
print SC "$root";
close(SC);
sleep(1);
print "\n\n";
open(SC2,"|/scripts/ssh2.expect $host");
print SC2 "$root";
close(SC2);
sleep(1);
print "Trust Relationship Created!\n";