OBS-URL: https://build.opensuse.org/package/show/devel:BCI:Tumbleweed/stunnel-image?expand=0&rev=114
27 lines
774 B
Bash
27 lines
774 B
Bash
#!/bin/bash
|
|
|
|
set -eo pipefail
|
|
|
|
STUNNEL_CERT="${STUNNEL_CERT:-/etc/stunnel/stunnel.pem}"
|
|
STUNNEL_KEY="${STUNNEL_KEY:-/etc/stunnel/stunnel.key}"
|
|
STUNNEL_CLIENT="${STUNNEL_CLIENT:-no}"
|
|
|
|
if [[ -n ${STUNNEL_DEBUG} ]]; then
|
|
echo "debug = ${STUNNEL_DEBUG}" > /etc/stunnel/conf.d/000debug.conf
|
|
fi
|
|
|
|
conf="/etc/stunnel/conf.d/container-ssl.conf"
|
|
echo "cert = ${STUNNEL_CERT}" > $conf
|
|
echo "key = ${STUNNEL_KEY}" >> $conf
|
|
|
|
|
|
if [[ -n "${STUNNEL_SERVICE_NAME}" ]] && [[ -n "${STUNNEL_ACCEPT}" ]] && [[ -n "${STUNNEL_CONNECT}" ]]; then
|
|
conf="/etc/stunnel/conf.d/container.conf"
|
|
echo "[${STUNNEL_SERVICE_NAME}]" > $conf
|
|
echo "accept = ${STUNNEL_ACCEPT}" >> $conf
|
|
echo "connect = ${STUNNEL_CONNECT}" >> $conf
|
|
echo "client = ${STUNNEL_CLIENT}" >> $conf
|
|
fi
|
|
|
|
exec "$@"
|