1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-12-23 01:39:27 +02:00
dockerfiles/stunnel/docker-entrypoint.sh

27 lines
481 B
Bash
Raw Normal View History

2016-07-11 07:14:59 +02:00
#!/bin/sh
cd /etc/stunnel
cat > stunnel.conf <<_EOF_
foreground = yes
setuid = stunnel
setgid = stunnel
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
cert = /etc/stunnel/stunnel.pem
client = ${CLIENT:-no}
[${SERVICE}]
accept = ${ACCEPT}
connect = ${CONNECT}
_EOF_
if ! [ -f stunnel.pem ]
then
openssl req -x509 -nodes -newkey rsa:2048 -days 3650 -subj '/CN=stunnel' \
-keyout stunnel.pem -out stunnel.pem
chmod 600 stunnel.pem
fi
exec stunnel "$@"