diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-passwd-srvr b/patches/systemvm/debian/config/etc/init.d/cloud-passwd-srvr index 553fe0ae962..e6818415cfb 100755 --- a/patches/systemvm/debian/config/etc/init.d/cloud-passwd-srvr +++ b/patches/systemvm/debian/config/etc/init.d/cloud-passwd-srvr @@ -33,11 +33,11 @@ start() { [ "$ENABLED" != 0 ] || exit 0 pid=$(getpid) [ "$pid" != "" ] && echo "Password server is already running (pid=$pid)" && return 0 - nohup bash /opt/cloud/bin/passwd_server& + nohup bash /opt/cloud/bin/passwd_server & } getpid() { - pid=$(ps -ef | grep passwd_server | grep -v grep | awk '{print $2}') + pid=$(ps -ef | grep passwd_server_ip | grep -v grep | awk '{print $2}') echo $pid } diff --git a/patches/systemvm/debian/config/opt/cloud/bin/passwd_server b/patches/systemvm/debian/config/opt/cloud/bin/passwd_server index 95225b6a901..71349dd0336 100755 --- a/patches/systemvm/debian/config/opt/cloud/bin/passwd_server +++ b/patches/systemvm/debian/config/opt/cloud/bin/passwd_server @@ -16,18 +16,8 @@ # specific language governing permissions and limitations # under the License. -. /etc/default/cloud-passwd-srvr - -while [ "$ENABLED" == "1" ] -do - socat -lf /var/log/cloud.log TCP4-LISTEN:8080,reuseaddr,crnl,bind=0.0.0.0 SYSTEM:"/opt/cloud/bin/serve_password.sh \"\$SOCAT_PEERADDR\"" - - rc=$? - if [ $rc -ne 0 ] - then - logger -t cloud "Password server failed with error code $rc. Restarting socat..." - sleep 3 - fi - . /etc/default/cloud-passwd-srvr - -done +ips=$(ip addr show dev eth0 | grep inet | grep eth0 | awk '{print $2}' ); echo $ips +for ip in $ips; do + addr=$(echo $ip | awk -F'/' '{print $1}') + /opt/cloud/bin/passwd_server_ip $addr & +done; diff --git a/patches/systemvm/debian/config/opt/cloud/bin/passwd_server_ip b/patches/systemvm/debian/config/opt/cloud/bin/passwd_server_ip new file mode 100755 index 00000000000..8d62dffa231 --- /dev/null +++ b/patches/systemvm/debian/config/opt/cloud/bin/passwd_server_ip @@ -0,0 +1,32 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +. /etc/default/cloud-passwd-srvr +addr=$1; +while [ "$ENABLED" == "1" ] +do + socat -lf /var/log/cloud.log TCP4-LISTEN:8080,reuseaddr,crnl,bind=$addr SYSTEM:"/opt/cloud/bin/serve_password.sh \"\$SOCAT_PEERADDR\"" + + rc=$? + if [ $rc -ne 0 ] + then + logger -t cloud "Password server failed with error code $rc. Restarting socat..." + sleep 3 + fi + . /etc/default/cloud-passwd-srvr +done diff --git a/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh b/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh index f994aedc3ad..d8f8a6e6383 100755 --- a/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh +++ b/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh @@ -70,7 +70,6 @@ routing_svcs() { grep "redundant_router=1" /var/cache/cloud/cmdline > /dev/null RROUTER=$? chkconfig cloud off - chkconfig cloud-passwd-srvr on ; chkconfig haproxy on ; chkconfig ssh on chkconfig nfs-common off @@ -78,19 +77,21 @@ routing_svcs() { if [ $RROUTER -eq 0 ] then chkconfig dnsmasq off + chkconfig cloud-passwd-srvr off chkconfig keepalived on chkconfig conntrackd on chkconfig postinit on echo "keepalived conntrackd postinit" > /var/cache/cloud/enabled_svcs - echo "dnsmasq " > /var/cache/cloud/disabled_svcs + echo "dnsmasq cloud-passwd-srvr" > /var/cache/cloud/disabled_svcs else chkconfig dnsmasq on + chkconfig cloud-passwd-srvr on chkconfig keepalived off chkconfig conntrackd off - echo "dnsmasq " > /var/cache/cloud/enabled_svcs + echo "dnsmasq cloud-passwd-srvr " > /var/cache/cloud/enabled_svcs echo "keepalived conntrackd " > /var/cache/cloud/disabled_svcs fi - echo "cloud-passwd-srvr ssh haproxy apache2" >> /var/cache/cloud/enabled_svcs + echo "ssh haproxy apache2" >> /var/cache/cloud/enabled_svcs echo "cloud nfs-common portmap" > /var/cache/cloud/disabled_svcs } diff --git a/patches/systemvm/debian/config/opt/cloud/bin/serve_password.sh b/patches/systemvm/debian/config/opt/cloud/bin/serve_password.sh index c1f928ddcc8..b829b540666 100755 --- a/patches/systemvm/debian/config/opt/cloud/bin/serve_password.sh +++ b/patches/systemvm/debian/config/opt/cloud/bin/serve_password.sh @@ -20,6 +20,15 @@ # set -x +source /root/func.sh + +lock="passwdlock" +locked=$(getLockFile $lock) +if [ "$locked" != "1" ] +then + exit 1 +fi + PASSWD_FILE=/var/cache/cloud/passwords # $1 filename @@ -91,4 +100,4 @@ fi # echo -e \"\\\"\\\n\\\"\" -exit 0 +unlock_exit 0 $lock $locked diff --git a/patches/systemvm/debian/config/root/redundant_router/disable_pubip.sh b/patches/systemvm/debian/config/root/redundant_router/disable_pubip.sh index 84631f67951..af5edbfd2a1 100644 --- a/patches/systemvm/debian/config/root/redundant_router/disable_pubip.sh +++ b/patches/systemvm/debian/config/root/redundant_router/disable_pubip.sh @@ -21,4 +21,5 @@ while read i do ifconfig $i down done < /tmp/iflist +service cloud-passwd-srvr stop service dnsmasq stop diff --git a/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ b/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ index 0bb6ef0e6c5..ec5905d355d 100644 --- a/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ +++ b/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ @@ -25,4 +25,5 @@ do ifup $i done < /tmp/iflist ip route add default via [GATEWAY] dev eth2 && \ +service cloud-passwd-srvr restart && \ service dnsmasq restart