Eu finalmente consegui fazer funcionar. Agora tenho o seguinte arquivo stunnel.conf
:
; Certificate
cert = stunnel.pem
;FIPS
fips=no
; Protocol version (all, SSLv2, SSLv3, TLSv1)
sslVersion = all
; Some performance tunings
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
; Some debugging stuff useful for troubleshooting
debug = 7
output = stunnel.log
; Use it for client mode
client = yes
; Service-level configuration
[FIX]
accept = 127.0.0.1:port
connect = proxy:80
protocol=connect
protocolHost= target-server:443
TIMEOUTconnect = 5
Basicamente eu quero ligar a um servidor FIX através de um proxy. A conexão agora é feita, mas parece que o servidor não está aceitando minha conexão. Eu vejo isso nos logs stunnel:
2013.04.26 14:05:06 LOG7[12312:13560]: SSL state (connect): before/connect initialization
2013.04.26 14:05:06 LOG7[12312:13560]: SSL state (connect): SSLv2/v3 write client hello A
2013.04.26 14:05:06 LOG7[12312:13560]: SSL state (connect): SSLv3 read server hello A
2013.04.26 14:05:06 LOG7[12312:13560]: SSL state (connect): SSLv3 read server certificate A
2013.04.26 14:05:06 LOG7[12312:13560]: SSL state (connect): SSLv3 read server done A
2013.04.26 14:05:06 LOG7[12312:13560]: SSL state (connect): SSLv3 write client key exchange A
2013.04.26 14:05:06 LOG7[12312:13560]: SSL state (connect): SSLv3 write change cipher spec A
2013.04.26 14:05:06 LOG7[12312:13560]: SSL state (connect): SSLv3 write finished A
2013.04.26 14:05:06 LOG7[12312:13560]: SSL state (connect): SSLv3 flush data
2013.04.26 14:05:06 LOG7[12312:13560]: SSL state (connect): SSLv3 read finished A
2013.04.26 14:05:06 LOG7[12312:13560]: 1 items in the session cache
2013.04.26 14:05:06 LOG7[12312:13560]: 1 client connects (SSL_connect())
2013.04.26 14:05:06 LOG7[12312:13560]: 1 client connects that finished
2013.04.26 14:05:06 LOG7[12312:13560]: 0 client renegotiations requested
2013.04.26 14:05:06 LOG7[12312:13560]: 0 server connects (SSL_accept())
2013.04.26 14:05:06 LOG7[12312:13560]: 0 server connects that finished
2013.04.26 14:05:06 LOG7[12312:13560]: 0 server renegotiations requested
2013.04.26 14:05:06 LOG7[12312:13560]: 0 session cache hits
2013.04.26 14:05:06 LOG7[12312:13560]: 0 external session cache hits
2013.04.26 14:05:06 LOG7[12312:13560]: 0 session cache misses
2013.04.26 14:05:06 LOG7[12312:13560]: 0 session cache timeouts
Acho que posso precisar inserir um login e uma senha. Alguém sabe como fazer isso com stunnel? Eu tentei protocolCredentials
mas não funciona.