-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint
executable file
·40 lines (34 loc) · 1.21 KB
/
entrypoint
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
set -euo pipefail
: ${TASKDDATA?:TASKDDATA directory must be set}
: ${PKI?:PKI directory must be set}
# Generate self signed certificate if none exists
if [ ! -f "${PKI}/ca.cert.pem" ]; then
cd "${PKI}"
if [ ! -z "${CERT_CN+x}" ]; then
sed -i "s/\(CN=\).*/\1'${CERT_CN}'/" vars
fi
if [ ! -z "${CERT_ORGANIZATION+x}" ]; then
sed -i "s/\(ORGANIZATION=\).*/\1'${CERT_ORGANIZATION}'/" vars
fi
if [ ! -z "${CERT_COUNTRY+x}" ]; then
sed -i "s/\(COUNTRY=\).*/\1'${CERT_COUNTRY}'/" vars
fi
if [ ! -z "${CERT_STATE+x}" ]; then
sed -i "s/\(STATE=\).*/\1'${CERT_STATE}'/" vars
fi
if [ ! -z "${CERT_LOCALITY+x}" ]; then
sed -i "s/\(LOCALITY=\).*/\1'${CERT_LOCALITY}'/" vars
fi
./generate
taskd config --force client.cert "${PKI}/client.cert.pem"
taskd config --force client.key "${PKI}/client.key.pem"
taskd config --force server.cert "${PKI}/server.cert.pem"
taskd config --force server.key "${PKI}/server.key.pem"
taskd config --force server.crl "${PKI}/server.crl.pem"
taskd config --force ca.cert "${PKI}/ca.cert.pem"
taskd config --force log "${TASKDDATA}/taskd.log"
taskd config --force pid.file "/tmp/taskd.pid"
taskd config --force server 0.0.0.0:53589
fi
exec "$@"