Hi All,

  I'm really struggling to make stunnel working for more than a few hours. (and the client is yelling hard...) (I solved some other issue : logging per website and making more than one stunnel works)

  To put it in a nutshell : 
below some information about my configuration... ask for more if needed.

Thanks for any helps,
Regards,
Thomas.


Distribution & Pachage info (x64 system)
######################################################################
root@ns0:/var/log/stunnel4# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.10
DISTRIB_CODENAME=oneiric
DISTRIB_DESCRIPTION="Ubuntu 11.10"

root@ns0:/var/log/stunnel4# aptitude show stunnel4
Package: stunnel4
New: yes
State: installed
Automatically installed: no
Version: 3:4.35-2build1
######################################################################


lynx try : 
######################################################################
root@ns0:/var/log/stunnel4# lynx https://extranet.serviceplus-hse.com

Looking up extranet.serviceplus-hse.com
Making HTTPS connection to extranet.serviceplus-hse.com
Retrying connection without TLS.
Looking up extranet.serviceplus-hse.com
Making HTTPS connection to extranet.serviceplus-hse.com
Alert!: Unable to make secure connection to remote host.

lynx: Can't access startfile https://extranet.serviceplus-hse.com/
######################################################################

ps -edf :
######################################################################
    1 24773 24762 18168 ?           -1 S      109   0:00 /usr/bin/stunnel4 /etc/stunnel/base.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 PWD=/
    1 24774 24762 18168 ?           -1 S      109   0:00 /usr/bin/stunnel4 /etc/stunnel/base.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 PWD=/
    1 24775 24762 18168 ?           -1 S      109   0:00 /usr/bin/stunnel4 /etc/stunnel/base.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 PWD=/
    1 24776 24762 18168 ?           -1 S      109   0:00 /usr/bin/stunnel4 /etc/stunnel/base.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 PWD=/
    1 24777 24762 18168 ?           -1 S      109   0:00 /usr/bin/stunnel4 /etc/stunnel/base.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 PWD=/
    1 24778 24778 24778 ?           -1 Ss     109   0:00 /usr/bin/stunnel4 /etc/stunnel/base.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 PWD=/
    1 24787 24762 18168 ?           -1 S      109   0:00 /usr/bin/stunnel4 /etc/stunnel/extranet.serviceplus-hse.com.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 P
    1 24788 24762 18168 ?           -1 S      109   0:00 /usr/bin/stunnel4 /etc/stunnel/extranet.serviceplus-hse.com.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 P
    1 24789 24762 18168 ?           -1 S      109   0:00 /usr/bin/stunnel4 /etc/stunnel/extranet.serviceplus-hse.com.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 P
    1 24790 24762 18168 ?           -1 S      109   0:00 /usr/bin/stunnel4 /etc/stunnel/extranet.serviceplus-hse.com.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 P
    1 24791 24762 18168 ?           -1 S      109   0:00 /usr/bin/stunnel4 /etc/stunnel/extranet.serviceplus-hse.com.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 P
    1 24792 24792 24792 ?           -1 Ss     109   0:00 /usr/bin/stunnel4 /etc/stunnel/extranet.serviceplus-hse.com.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 P
    1 24801 24762 18168 ?           -1 S      109   0:00 /usr/bin/stunnel4 /etc/stunnel/mansonthomas.com.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 PWD=/
    1 24802 24762 18168 ?           -1 S      109   0:00 /usr/bin/stunnel4 /etc/stunnel/mansonthomas.com.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 PWD=/
    1 24803 24762 18168 ?           -1 S      109   0:00 /usr/bin/stunnel4 /etc/stunnel/mansonthomas.com.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 PWD=/
    1 24804 24762 18168 ?           -1 S      109   0:00 /usr/bin/stunnel4 /etc/stunnel/mansonthomas.com.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 PWD=/
    1 24805 24762 18168 ?           -1 S      109   0:00 /usr/bin/stunnel4 /etc/stunnel/mansonthomas.com.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 PWD=/
    1 24806 24806 24806 ?           -1 Ss     109   0:00 /usr/bin/stunnel4 /etc/stunnel/mansonthomas.com.conf TERM=screen-bce PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin LANG=en_US.UTF-8 PWD=/
######################################################################


/etc/stunnel/base.conf
######################################################################
debug = 7


sslVersion = SSLv3
cert=/etc/stunnel/sites/123monsite.com/123monsite.com.crt
key=/etc/stunnel/sites/123monsite.com/123monsite.com.key


; security enhancements for UNIX systems
; for chroot a copy of some devices and files is needed within the jail
;chroot = /var/lib/stunnel4/
setuid = stunnel4
setgid = stunnel4
; PID is created inside the chroot jail
pid = /var/run/stunnel4/stunnel4.pid


socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
output = /var/log/stunnel4/stunnel.log

[https-123monsite.com]
accept=88.190.17.222:443
connect=127.0.0.1:82
######################################################################


/etc/stunnel/extranet.serviceplus-hse.com.conf
######################################################################
debug = 7
output = /var/log/stunnel4/extranet.serviceplus-hse.com_stunnel.log
setuid = stunnel4
setgid = stunnel4
pid = /var/run/stunnel4/extranet.serviceplus-hse.com.pid
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1


[extranet.serviceplus-hse.com]
key           = /etc/stunnel/sites/extranet.serviceplus-hse.com/extranet.serviceplus-hse.com.key
cert          = /etc/stunnel/sites/extranet.serviceplus-hse.com/extranet.serviceplus-hse.com.crt
accept        = 88.190.217.54:443
connect       = 127.0.0.1:82   

sslVersion = SSLv3
TIMEOUTclose  = 0
######################################################################




Last logs : /var/log/stunnel4/extranet.serviceplus-hse.com_stunnel.log
######################################################################
2012.04.03 23:02:47 LOG6[24792:140152610346752]: SSL accepted: previous session reused
2012.04.03 23:02:47 LOG7[24792:140152610346752]: remote socket: FD=1 allocated (non-blocking mode)
2012.04.03 23:02:47 LOG6[24792:140152610346752]: connect_blocking: connecting 127.0.0.1:82
2012.04.03 23:02:47 LOG7[24792:140152610346752]: connect_blocking: s_poll_wait 127.0.0.1:82: waiting 10 seconds
2012.04.03 23:02:47 LOG5[24792:140152610346752]: connect_blocking: connected 127.0.0.1:82
2012.04.03 23:02:47 LOG5[24792:140152610346752]: Service extranet.serviceplus-hse.com connected remote server from 127.0.0.1:60624
2012.04.03 23:02:47 LOG7[24792:140152610346752]: Remote FD=1 initialized
2012.04.03 23:02:47 LOG7[24792:140152610346752]: Option TCP_NODELAY set on remote socket
2012.04.03 23:02:58 LOG7[24792:140152610346752]: Socket closed on read
2012.04.03 23:02:58 LOG7[24792:140152610346752]: Sending SSL write shutdown
2012.04.03 23:02:58 LOG7[24792:140152610346752]: SSL alert (write): warning: close notify
2012.04.03 23:02:58 LOG6[24792:140152610346752]: SSL_shutdown successfully sent close_notify
2012.04.03 23:02:58 LOG3[24792:140152610346752]: transfer: s_poll_wait: TIMEOUTclose exceeded: closing
2012.04.03 23:02:58 LOG5[24792:140152610346752]: Connection closed: 167313 bytes sent to SSL, 1871 bytes sent to socket
2012.04.03 23:02:58 LOG7[24792:140152610346752]: Service extranet.serviceplus-hse.com finished (0 left)
2012.04.03 23:33:20 LOG7[24792:140152610629408]: local socket: FD=0 allocated (non-blocking mode)
2012.04.03 23:33:20 LOG7[24792:140152610629408]: Service extranet.serviceplus-hse.com accepted FD=0 from 82.224.128.241:52114
2012.04.03 23:33:20 LOG7[24792:140152610346752]: Service extranet.serviceplus-hse.com started
2012.04.03 23:33:20 LOG7[24792:140152610346752]: Option TCP_NODELAY set on local socket
2012.04.03 23:33:20 LOG7[24792:140152610346752]: Waiting for a libwrap process
2012.04.03 23:33:20 LOG7[24792:140152610346752]: Acquired libwrap process #0
2012.04.03 23:33:20 LOG7[24792:140152610346752]: Releasing libwrap process #0
2012.04.03 23:33:20 LOG7[24792:140152610346752]: Released libwrap process #0
2012.04.03 23:33:20 LOG7[24792:140152610346752]: Service extranet.serviceplus-hse.com permitted by libwrap from 82.224.128.241:52114
2012.04.03 23:33:20 LOG5[24792:140152610346752]: Service extranet.serviceplus-hse.com accepted connection from 82.224.128.241:52114
2012.04.03 23:33:20 LOG7[24792:140152610346752]: SSL state (accept): before/accept initialization
2012.04.03 23:33:20 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 read client hello B
2012.04.03 23:33:20 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 write server hello A
2012.04.03 23:33:20 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 write certificate A
2012.04.03 23:33:20 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 write key exchange A
2012.04.03 23:33:20 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 write server done A
2012.04.03 23:33:20 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 flush data
2012.04.03 23:33:20 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 read client key exchange A
2012.04.03 23:33:20 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 read finished A
2012.04.03 23:33:20 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 write change cipher spec A
2012.04.03 23:33:20 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 write finished A
2012.04.03 23:33:20 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 flush data
2012.04.03 23:33:20 LOG7[24792:140152610346752]:    7 items in the session cache
2012.04.03 23:33:20 LOG7[24792:140152610346752]:    0 client connects (SSL_connect())
2012.04.03 23:33:20 LOG7[24792:140152610346752]:    0 client connects that finished
2012.04.03 23:33:20 LOG7[24792:140152610346752]:    0 client renegotiations requested
2012.04.03 23:33:20 LOG7[24792:140152610346752]:   21 server connects (SSL_accept())
2012.04.03 23:33:20 LOG7[24792:140152610346752]:   20 server connects that finished
2012.04.03 23:33:20 LOG7[24792:140152610346752]:    0 server renegotiations requested
2012.04.03 23:33:20 LOG7[24792:140152610346752]:    9 session cache hits
2012.04.03 23:33:20 LOG7[24792:140152610346752]:    0 external session cache hits
2012.04.03 23:33:20 LOG7[24792:140152610346752]:    7 session cache misses
2012.04.03 23:33:20 LOG7[24792:140152610346752]:    4 session cache timeouts
2012.04.03 23:33:20 LOG6[24792:140152610346752]: SSL accepted: new session negotiated
2012.04.03 23:33:20 LOG6[24792:140152610346752]: Negotiated ciphers: DHE-RSA-CAMELLIA256-SHA SSLv3 Kx=DH Au=RSA Enc=Camellia(256) Mac=SHA1
2012.04.03 23:33:20 LOG7[24792:140152610346752]: remote socket: FD=1 allocated (non-blocking mode)
2012.04.03 23:33:20 LOG6[24792:140152610346752]: connect_blocking: connecting 127.0.0.1:82
2012.04.03 23:33:20 LOG7[24792:140152610346752]: connect_blocking: s_poll_wait 127.0.0.1:82: waiting 10 seconds
2012.04.03 23:33:20 LOG5[24792:140152610346752]: connect_blocking: connected 127.0.0.1:82
2012.04.03 23:33:20 LOG5[24792:140152610346752]: Service extranet.serviceplus-hse.com connected remote server from 127.0.0.1:36240
2012.04.03 23:33:20 LOG7[24792:140152610346752]: Remote FD=1 initialized
2012.04.03 23:33:20 LOG7[24792:140152610346752]: Option TCP_NODELAY set on remote socket
2012.04.03 23:33:27 LOG7[24792:140152610346752]: Socket closed on read
2012.04.03 23:33:27 LOG7[24792:140152610346752]: Sending SSL write shutdown
2012.04.03 23:33:27 LOG7[24792:140152610346752]: SSL alert (write): warning: close notify
2012.04.03 23:33:27 LOG6[24792:140152610346752]: SSL_shutdown successfully sent close_notify
2012.04.03 23:33:27 LOG3[24792:140152610346752]: transfer: s_poll_wait: TIMEOUTclose exceeded: closing
2012.04.03 23:33:27 LOG5[24792:140152610346752]: Connection closed: 537 bytes sent to SSL, 620 bytes sent to socket
2012.04.03 23:33:27 LOG7[24792:140152610346752]: Service extranet.serviceplus-hse.com finished (0 left)
2012.04.03 23:33:27 LOG7[24792:140152610629408]: local socket: FD=0 allocated (non-blocking mode)
2012.04.03 23:33:27 LOG7[24792:140152610629408]: Service extranet.serviceplus-hse.com accepted FD=0 from 82.224.128.241:52123
2012.04.03 23:33:27 LOG7[24792:140152610346752]: Service extranet.serviceplus-hse.com started
2012.04.03 23:33:27 LOG7[24792:140152610346752]: Option TCP_NODELAY set on local socket
2012.04.03 23:33:27 LOG7[24792:140152610346752]: Waiting for a libwrap process
2012.04.03 23:33:27 LOG7[24792:140152610346752]: Acquired libwrap process #0
2012.04.03 23:33:27 LOG7[24792:140152610346752]: Releasing libwrap process #0
2012.04.03 23:33:27 LOG7[24792:140152610346752]: Released libwrap process #0
2012.04.03 23:33:27 LOG7[24792:140152610346752]: Service extranet.serviceplus-hse.com permitted by libwrap from 82.224.128.241:52123
2012.04.03 23:33:27 LOG5[24792:140152610346752]: Service extranet.serviceplus-hse.com accepted connection from 82.224.128.241:52123
2012.04.03 23:33:27 LOG7[24792:140152610346752]: SSL state (accept): before/accept initialization
2012.04.03 23:33:27 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 read client hello B
2012.04.03 23:33:27 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 write server hello A
2012.04.03 23:33:27 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 write change cipher spec A
2012.04.03 23:33:27 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 write finished A
2012.04.03 23:33:27 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 flush data
2012.04.03 23:33:28 LOG7[24792:140152610346752]: SSL state (accept): SSLv3 read finished A
2012.04.03 23:33:28 LOG7[24792:140152610346752]:    7 items in the session cache
2012.04.03 23:33:28 LOG7[24792:140152610346752]:    0 client connects (SSL_connect())
2012.04.03 23:33:28 LOG7[24792:140152610346752]:    0 client connects that finished
2012.04.03 23:33:28 LOG7[24792:140152610346752]:    0 client renegotiations requested
2012.04.03 23:33:28 LOG7[24792:140152610346752]:   22 server connects (SSL_accept())
2012.04.03 23:33:28 LOG7[24792:140152610346752]:   21 server connects that finished
2012.04.03 23:33:28 LOG7[24792:140152610346752]:    0 server renegotiations requested
2012.04.03 23:33:28 LOG7[24792:140152610346752]:   10 session cache hits
2012.04.03 23:33:28 LOG7[24792:140152610346752]:    0 external session cache hits
2012.04.03 23:33:28 LOG7[24792:140152610346752]:    7 session cache misses
2012.04.03 23:33:28 LOG7[24792:140152610346752]:    4 session cache timeouts
2012.04.03 23:33:28 LOG6[24792:140152610346752]: SSL accepted: previous session reused
2012.04.03 23:33:28 LOG7[24792:140152610346752]: remote socket: FD=1 allocated (non-blocking mode)
2012.04.03 23:33:28 LOG6[24792:140152610346752]: connect_blocking: connecting 127.0.0.1:82
2012.04.03 23:33:28 LOG7[24792:140152610346752]: connect_blocking: s_poll_wait 127.0.0.1:82: waiting 10 seconds
2012.04.03 23:33:28 LOG5[24792:140152610346752]: connect_blocking: connected 127.0.0.1:82
2012.04.03 23:33:28 LOG5[24792:140152610346752]: Service extranet.serviceplus-hse.com connected remote server from 127.0.0.1:36256
2012.04.03 23:33:28 LOG7[24792:140152610346752]: Remote FD=1 initialized
2012.04.03 23:33:28 LOG7[24792:140152610346752]: Option TCP_NODELAY set on remote socket
2012.04.03 23:33:41 LOG7[24792:140152610346752]: Socket closed on read
2012.04.03 23:33:41 LOG7[24792:140152610346752]: Sending SSL write shutdown
2012.04.03 23:33:41 LOG7[24792:140152610346752]: SSL alert (write): warning: close notify
2012.04.03 23:33:41 LOG6[24792:140152610346752]: SSL_shutdown successfully sent close_notify
2012.04.03 23:33:41 LOG3[24792:140152610346752]: transfer: s_poll_wait: TIMEOUTclose exceeded: closing
2012.04.03 23:33:41 LOG5[24792:140152610346752]: Connection closed: 186584 bytes sent to SSL, 3275 bytes sent to socket
2012.04.03 23:33:41 LOG7[24792:140152610346752]: Service extranet.serviceplus-hse.com finished (0 left)
2012.04.04 06:25:04 LOG7[24792:140152610629408]: Dispatching signals from the signal pipe
######################################################################