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

27 lines
482 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
libressl req -x509 -nodes -newkey rsa:2048 -days 3650 -subj '/CN=stunnel' \
-keyout stunnel.pem -out stunnel.pem
chmod 600 stunnel.pem
fi
exec stunnel "$@"