1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-11-30 09:16:41 +02:00
dockerfiles/stunnel/docker-entrypoint.sh
2016-07-11 13:14:59 +08:00

27 lines
481 B
Bash
Executable File

#!/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 "$@"