From charlesreid1

No edit summary
No edit summary
Line 1: Line 1:
Right now I am working through how to get an stunnel docker container up and running on a remote server, to serve up HTTP.
This page explains how to use stunnel in a Docker container to serve up different kinds of traffic over an encrypted SSL connection.


That work is part of building a set of containers (a boat) for a wifi project, and is on the [[Docker/Boats/Wifi]] page
=ssh traffic over port 443 using stunnel on docker=
 
Let's start with an example of how to forward SSH traffic from a client to a server over stunnel.
 
The goal here is to be able to SSH to a local port on the client, and have that connection transparently forwarded to the server:
 
<pre>
[client] $ ssh -p 2222 root@localhost
 
[server ~ via client] $ whoami
root
 
[server ~ via client] $ whoami
</pre>
 
==Set up client==
 
Start by setting up the client. The client want s to ssh to local port 2222, so have stunnel listen for traffic on 2222. Next, we want to pass the traffic to the server using port 443, so we will use the notation <code><server IP>:<server port></code> to direct traffic to the stunnel server's port 443:
 
<pre>
# client config,
# will ssh directly to local port 2222
# ssh -p 2222 root@localhost
# stunnel client connects to remote stunnel server at IP A.B.C.D over external port 443
 
output = /var/log/stunnel4/stunnel.log
cert = /etc/stunnel/stunnel.fullchain.pem
key = /etc/stunnel/stunnel.key.pem
pid = /var/run/stunnel4/stunnel.pid
client  = yes
[ssh]
accept = 2222
connect = A.B.C.D:443
</pre>
 
The client will also need a copy of the server's certificate and key files, which can be securely copied.
 
==Set up server==
 
 
 
 
 
 
 
 
 
 
{{DockerFlag}}
{{StunnelFlag}}

Revision as of 00:46, 31 March 2017

This page explains how to use stunnel in a Docker container to serve up different kinds of traffic over an encrypted SSL connection.

ssh traffic over port 443 using stunnel on docker

Let's start with an example of how to forward SSH traffic from a client to a server over stunnel.

The goal here is to be able to SSH to a local port on the client, and have that connection transparently forwarded to the server:

[client] $ ssh -p 2222 root@localhost

[server ~ via client] $ whoami
root

[server ~ via client] $ whoami

Set up client

Start by setting up the client. The client want s to ssh to local port 2222, so have stunnel listen for traffic on 2222. Next, we want to pass the traffic to the server using port 443, so we will use the notation <server IP>:<server port> to direct traffic to the stunnel server's port 443:

# client config,
# will ssh directly to local port 2222
# ssh -p 2222 root@localhost
# stunnel client connects to remote stunnel server at IP A.B.C.D over external port 443

output 	= /var/log/stunnel4/stunnel.log
cert 	= /etc/stunnel/stunnel.fullchain.pem
key	= /etc/stunnel/stunnel.key.pem
pid 	= /var/run/stunnel4/stunnel.pid
client  = yes
[ssh]
accept 	= 2222
connect = A.B.C.D:443

The client will also need a copy of the server's certificate and key files, which can be securely copied.

Set up server