diff --git a/xCAT/postscripts/allowcred.awk b/xCAT/postscripts/allowcred.awk new file mode 100755 index 000000000..305c103d0 --- /dev/null +++ b/xCAT/postscripts/allowcred.awk @@ -0,0 +1,14 @@ +#!/usr/bin/awk -f +BEGIN { + listener = "/inet/tcp/300/0/0" + quit = "no" + + + while (match(quit,"no") && (listener |& getline) > 0) { + if (match($0,"CREDOKBYYOU?")) { + print "CREDOKBYME" |& listener + quit="yes" + } + } + close(listener) +} diff --git a/xCAT/postscripts/getcredentials.awk b/xCAT/postscripts/getcredentials.awk index ddcb2a8ad..edab825bc 100755 --- a/xCAT/postscripts/getcredentials.awk +++ b/xCAT/postscripts/getcredentials.awk @@ -1,6 +1,5 @@ #!/usr/bin/awk -f BEGIN { - listener = "/inet/tcp/300/0/0" server = "/inet/tcp/0/127.0.0.1/400" quit = "no" @@ -11,14 +10,6 @@ BEGIN { print " "ARGV[1]"" |& server print "" |& server - while (match(quit,"no") && (listener |& getline) > 0) { - if (match($0,"CREDOKBYYOU?")) { - print "CREDOKBYME" |& listener - quit="yes" - } - } - close(listener) - while (server |& getline) { print $0 } diff --git a/xCAT/postscripts/remoteshell b/xCAT/postscripts/remoteshell index 373a046eb..831b466c5 100755 --- a/xCAT/postscripts/remoteshell +++ b/xCAT/postscripts/remoteshell @@ -56,6 +56,8 @@ sleep 1 umask 0077 mkdir -p /root/.ssh/ +allowcred.awk & +sleep 1 getcredentials.awk ssh_root_key | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /root/.ssh/id_rsa if ! grep "PRIVATE KEY" /root/.ssh/id_rsa > /dev/null 2>&1 ; then rm /root/.ssh/id_rsa