Docker Image with nginx and configurable websocket proxy with SSL client certifcate authorization.
I started to build this image to proxy Mosquitto MQTT websockets, but it will work with every websocket connection.
Use this Image as baseimage for your own projects that need SSL Client Certificates on iOS devices:
FROM dersimn/nginx-websocket-proxy-client-certificate:3
COPY www /www
ENV WS_PROXY_PATH="/my-websocket-location"
ENV WHITELIST_LOCAL_IP="false"
ENV WHITELIST_IP="10.1.1.0/24 192.168.1.0/24"
See next section for more options.
This image can proxy-pass the Websocket connections, by setting the env variable WS_PROXY. The target path for the proxy can be configured with WS_PROXY_PATH, it defaults to /ws.
docker run -d --restart=always \
-v $(pwd)/www:/www:ro \
-e "WS_PROXY=10.1.1.50:9001" \
-p 80:80 \
dersimn/nginx-websocket-proxy-client-certificate
If you provide an SSL key/cert pair in /ssl, the Docker Image will also enable HTTPS:
/ssl/nginx.key/ssl/nginx.crtAdditionally you can enable client-authentification via SSL certificates, by providing:
/ssl/client.crtIn case you have revoked clients, also prodive a /ssl/client.crl file.
A nice tutorial on how to generate your own certificates, is located here.
docker run -d --restart=always \
-v $(pwd)/www:/www:ro \
-v $(pwd)/ssl:/ssl:ro \
-e "WS_PROXY=10.1.1.50:9001" \
-p 80:80 \
-p 443:443 \
dersimn/nginx-websocket-proxy-client-certificate
If you want to change the default ports, specify it like this: -p 8001:80 -p 8443:443 -e "HTTPS_REDIRECT_PORT=8443".
HTTPS and client-auth are optional for clients connecting from a local IP, according to these IP ranges:
If you don't want this behaviour, set -e WHITELIST_LOCAL_IP=false to force SSL and client-auth for everyone. You can also add own IP ranges to the whitelist with -e WHITELIST_IP="10.1.1.0/24 192.168.1.0/24".
https://github.com/dersimn/nginx-websocket-proxy-client-certificate
Content type
Image
Digest
sha256:f681919c3…
Size
65.5 MB
Last updated
over 2 years ago
docker pull dersimn/nginx-websocket-proxy-client-certificate