1

I am trying to add SSL support to my node.js app, while connecting via socket.io. The traffic to socket.io is going to port 80. I would like stunnel to grab encrypted traffic from port 443, unencrypt it, and forward it to post 80.

I have private.key, certificate and public key at hand, and I couldn't find how I should configure them all to work.

An example of working configuration file for stunnel would be great. I had a look at Websockets Over SSL: Stunnel, Varnish, Nginx, Node.js, Websockets Over SSL: Stunnel, HAProxy, Node.js and this gist, but couldn't use any of them to achieve my goal.

Thanks!

Kuf
  • 449
  • 2
  • 8
  • 24

1 Answers1

0

I had a problem with the certificate file. In case anyone else will have issues, this is what I eventually did:

The PEM file

the file structure of the file should be as follow:

-----BEGIN CERTIFICATE-----
.
.
.
.
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
.
.
.
.
.
.
-----END RSA PRIVATE KEY-----

/etc/stunnel/stunnel.conf

The stunnel configuration file:

cert = /etc/stunnel/stunnel.pem
[node]
accept = 443
connect = 80
Kuf
  • 449
  • 2
  • 8
  • 24