diff --git a/systemvm/patches/debian/config/opt/cloud/bin/passwd_server_ip.py b/systemvm/patches/debian/config/opt/cloud/bin/passwd_server_ip.py index 097d4fbdd34..747666607f9 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/passwd_server_ip.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/passwd_server_ip.py @@ -39,6 +39,7 @@ from SocketServer import ThreadingMixIn #, ForkingMixIn passMap = {} secureToken = None +listeningAddress = '127.0.0.1' lock = threading.RLock() def getTokenFile(): @@ -133,7 +134,7 @@ class PasswordRequestHandler(BaseHTTPRequestHandler): self.send_response(200) self.end_headers() clientAddress = self.client_address[0] - if clientAddress not in ['localhost', '127.0.0.1']: + if clientAddress not in ['localhost', '127.0.0.1', listeningAddress]: syslog.syslog('serve_password: non-localhost IP trying to save password: %s' % clientAddress) self.send_response(403) return @@ -162,7 +163,7 @@ class PasswordRequestHandler(BaseHTTPRequestHandler): def serve(HandlerClass = PasswordRequestHandler, ServerClass = ThreadedHTTPServer): - listeningAddress = '127.0.0.1' + global listeningAddress if len(sys.argv) > 1: listeningAddress = sys.argv[1] diff --git a/systemvm/patches/debian/config/opt/cloud/bin/savepassword.sh b/systemvm/patches/debian/config/opt/cloud/bin/savepassword.sh index 4a870fb3a7d..7fdc99f6328 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/savepassword.sh +++ b/systemvm/patches/debian/config/opt/cloud/bin/savepassword.sh @@ -30,7 +30,6 @@ do ;; esac done -SERVER_IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') TOKEN_FILE="/tmp/passwdsrvrtoken" TOKEN="" if [ -f $TOKEN_FILE ]; then @@ -39,5 +38,9 @@ fi ps aux | grep passwd_server_ip.py |grep -v grep 2>&1 > /dev/null if [ $? -eq 0 ] then - curl --header "DomU_Request: save_password" "http://$SERVER_IP:8080/" -F "ip=$VM_IP" -F "password=$PASSWORD" -F "token=$TOKEN" + ips=$(ip addr show dev eth0 | grep inet | grep eth0 | awk '{print $2}') + for ip in $ips; do + server_ip=$(echo $ip | awk -F'/' '{print $1}') + 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 & + done fi