mirror of https://github.com/apache/cloudstack.git
VPC : password server, start password server when guest network is created
This commit is contained in:
parent
5d301f2af5
commit
b59c3c8885
|
|
@ -650,11 +650,9 @@ EOF
|
|||
|
||||
enable_svc dnsmasq 1
|
||||
enable_svc haproxy 1
|
||||
enable_svc cloud-passwd-srvr 1
|
||||
enable_svc cloud 0
|
||||
disable_rpfilter_domR
|
||||
enable_fwding 1
|
||||
chkconfig nfs-common off
|
||||
cp /etc/iptables/iptables-vpcrouter /etc/iptables/rules
|
||||
setup_sshd $ETH0_IP "eth0"
|
||||
cp /etc/vpcdnsmasq.conf /etc/dnsmasq.conf
|
||||
|
|
|
|||
|
|
@ -95,6 +95,20 @@ routing_svcs() {
|
|||
echo "cloud nfs-common portmap" > /var/cache/cloud/disabled_svcs
|
||||
}
|
||||
|
||||
vpcrouting_svcs() {
|
||||
chkconfig cloud off
|
||||
chkconfig haproxy on ;
|
||||
chkconfig ssh on
|
||||
chkconfig nfs-common off
|
||||
chkconfig portmap off
|
||||
chkconfig dnsmasq on
|
||||
chkconfig keepalived off
|
||||
chkconfig conntrackd off
|
||||
chkconfig apache2 off
|
||||
echo "ssh haproxy dnsmasq" >> /var/cache/cloud/enabled_svcs
|
||||
echo "cloud cloud-passwd-srvr apache2 nfs-common portmap keepalived conntrackd" > /var/cache/cloud/disabled_svcs
|
||||
}
|
||||
|
||||
dhcpsrvr_svcs() {
|
||||
chkconfig cloud off
|
||||
chkconfig cloud-passwd-srvr on ;
|
||||
|
|
@ -188,6 +202,16 @@ then
|
|||
fi
|
||||
fi
|
||||
|
||||
if [ "$TYPE" == "vpcrouter" ]
|
||||
then
|
||||
vpcrouting_svcs
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
printf "Failed to execute vpcrouting_svcs\n" >$logfile
|
||||
exit 6
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$TYPE" == "dhcpsrvr" ]
|
||||
then
|
||||
dhcpsrvr_svcs
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ setup_dnsmasq() {
|
|||
}
|
||||
|
||||
desetup_dnsmasq() {
|
||||
logger -t cloud "Setting up dnsmasq for network $ip/$mask "
|
||||
logger -t cloud "Desetting up dnsmasq for network $ip/$mask "
|
||||
|
||||
sed -i -e "/^[#]*dhcp-option=tag:interface-$dev,option:router.*$/d" /etc/dnsmasq.d/cloud.conf
|
||||
sed -i -e "/^[#]*dhcp-option=tag:interface-$dev,6.*$/d" /etc/dnsmasq.d/cloud.conf
|
||||
|
|
@ -101,6 +101,20 @@ desetup_dnsmasq() {
|
|||
sleep 1
|
||||
}
|
||||
|
||||
setup_passwdsvcs() {
|
||||
logger -t cloud "Setting up password service for network $ip/$mask, eth $dev "
|
||||
nohup bash /opt/cloud/bin/vpc_passwd_server $ip &
|
||||
}
|
||||
|
||||
desetup_passwdsvcs() {
|
||||
logger -t cloud "Desetting up password service for network $ip/$mask, eth $dev "
|
||||
pid=`ps -ef | grep socat | grep $ip | grep -v grep | awk '{print $2}'`
|
||||
if [ -n "$pid" ]
|
||||
then
|
||||
kill -9 $pid
|
||||
fi
|
||||
}
|
||||
|
||||
create_guest_network() {
|
||||
logger -t cloud " $(basename $0): Create network on interface $dev, gateway $gw, network $ip/$mask "
|
||||
# setup ip configuration
|
||||
|
|
@ -125,6 +139,7 @@ create_guest_network() {
|
|||
create_acl_chain
|
||||
setup_dnsmasq
|
||||
setup_apache2
|
||||
setup_passwdsvcs
|
||||
}
|
||||
|
||||
destroy_guest_network() {
|
||||
|
|
@ -140,6 +155,7 @@ destroy_guest_network() {
|
|||
destroy_acl_chain
|
||||
desetup_dnsmasq
|
||||
desetup_apache2
|
||||
desetup_passwdsvcs
|
||||
}
|
||||
|
||||
#set -x
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
ip=$1
|
||||
while [ -n "$ip" ]
|
||||
do
|
||||
socat -lf /var/log/cloud.log TCP4-LISTEN:8080,reuseaddr,crnl,bind=$ip SYSTEM:"/opt/cloud/bin/serve_password.sh"
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]
|
||||
then
|
||||
logger -t cloud "Password server failed with error code $rc. Restarting socat..."
|
||||
sleep 3
|
||||
fi
|
||||
done
|
||||
Loading…
Reference in New Issue