import sys
import os
import signal
+import socket
import fcntl
import pdb
import getpass
print "Could not connect to Vsys. Giving up."
exit(1)
+ # get the ip address of the host, we'll need it when setting up sshd
+ hostname = socket.getfqdn()
+ hostipaddr = socket.gethostbyname(hostname)
+
wholestring = output.split("\n")
seenSSHKey = False
for eachline in wholestring:
h.close()
os.system("sudo rm /etc/ssh/sshd_config")
os.system("sudo cat /tmp/sshd_config /tmp/portFile > /tmp/newsshd_config")
+ os.system('sudo echo "ListenAddress ' + hostipaddr + '" >> /tmp/newsshd_config')
os.system("sudo mv /tmp/newsshd_config /etc/ssh/sshd_config")
elif line[0] == "vsys_sshKey.pub:":
pathname = homedir + "/.ssh/id_rsa.pub"
g.close()
dest = homedir + "/.ssh/authorized_keys"
os.system("cp " + pathname + " " + dest)
-
+
username = homedir[6:]
s = "sudo chown -R " + username + " " + homedir + "/.ssh"
os.system(s)