File tree Expand file tree Collapse file tree
systemvm/patches/debian/config/opt/cloud/bin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,13 +46,17 @@ def getTokenFile():
4646 return '/tmp/passwdsrvrtoken'
4747
4848def getPasswordFile ():
49- return '/var/cache/cloud/passwords'
49+ return '/var/cache/cloud/passwords-%s' % listeningAddress
5050
5151def initToken ():
5252 global secureToken
53- secureToken = binascii .hexlify (os .urandom (16 ))
54- with open (getTokenFile (), 'w' ) as f :
55- f .write (secureToken )
53+ if os .path .exists (getTokenFile ()):
54+ with open (getTokenFile (), 'r' ) as f :
55+ secureToken = f .read ()
56+ if not secureToken :
57+ secureToken = binascii .hexlify (os .urandom (16 ))
58+ with open (getTokenFile (), 'w' ) as f :
59+ f .write (secureToken )
5660
5761def checkToken (token ):
5862 return token == secureToken
@@ -152,6 +156,7 @@ def do_POST(self):
152156 if not ip or not password :
153157 syslog .syslog ('serve_password: empty ip/password[%s/%s] received from savepassword' % (ip , password ))
154158 return
159+ syslog .syslog ('serve_password: password saved for VM IP %s' % ip )
155160 setPassword (ip , password )
156161 savePasswordFile ()
157162 return
Original file line number Diff line number Diff line change 3838ps aux | grep passwd_server_ip.py | grep -v grep 2>&1 > /dev/null
3939if [ $? -eq 0 ]
4040then
41- ips=$( ip addr show dev eth0 | grep inet | grep eth0 | awk ' {print $2}' )
41+ ips=$( ip addr show | grep inet | awk ' {print $2}' )
4242 for ip in $ips ; do
4343 server_ip=$( echo $ip | awk -F' /' ' {print $1}' )
4444 curl --header " DomU_Request: save_password" " http://$server_ip :8080/" -F " ip=$VM_IP " -F " password=$PASSWORD " -F " token=$TOKEN " > /dev/null 2> /dev/null &
You can’t perform that action at this time.
0 commit comments