HAproxy + Stunnel (https) + CentOS 6
Neste artigo vou abordar a configuração do Load Balance com o software HAproxy e Stunnel.
Toda configuração será feita no CentOS 6 i386.
Toda configuração será feita no CentOS 6 i386.
Parte 5: Script para inicializar o Stunnel
#!/bin/bash
# VARIAVEIS
GREP="/bin/grep"
EGREP="/bin/egrep"
PROG="stunnel"
KILLALL="/usr/bin/killall"
# TESTANDO SE EXISTE O ARQUIVO
test -x /usr/bin/stunnel || exit 0
RETVAL=0
########## START ##########
start() {
if [ ! -f /var/lock/subsys/stunnel ]; then
/usr/bin/stunnel
RETVAL=$?
if [ $RETVAL = 0 ]; then
touch /var/lock/subsys/stunnel
echo $"Starting $PROG: OK"
else
exit 1
fi
fi
return $RETVAL
}
stop() {
if [ -e /var/lock/subsys/stunnel ]; then
$KILLALL /usr/bin/stunnel
RETVAL=$?
if [ $RETVAL = 0 ]; then
rm -rf /var/lock/subsys/stunnel
echo $"Stop $PROG: OK"
else
exit 1
fi
fi
return $RETVAL
}
restart(){
if [ -e /var/lock/subsys/stunnel ]; then
$KILLALL /usr/bin/stunnel
RETVAL=$?
if [ $RETVAL = 0 ]; then
rm -rf /var/lock/subsys/stunnel
echo $"Stop $PROG: OK"
else
exit 1
fi
fi
if [ ! -f /var/lock/subsys/stunnel ]; then
/usr/bin/stunnel
RETVAL=$?
if [ $RETVAL = 0 ]; then
touch /var/lock/subsys/stunnel
echo $"Starting $PROG: OK"
else
exit 1
fi
fi
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"ESCOLHA UM ITEM AO LADO: $0 {start|stop|restart}"
exit 2
esac
exit $?
Logo em seguida, iremos criar a chamada para inicialização no Stunnel no boot do S.O.:
# ln -s /etc/init.d/stunnel /etc/rc3.d/S99stunnel
em primeiro lugar bom artigo. Ainda não tive a oportunidade de testá-lo apesar de já ter ouvido falar.
Tenho uma dúvido.
Quando o cliente acessa o endereço HTTP(no exemplo acima CentOS-1 192.168.1.55) e esta requisição bate nos HTTP's Servers CentOS-2 ou CentOS-3 qual IP irá aparecer nestes Https Servers, o IP do cliente ou o Ip do CentOS-1 ?
[]s