-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrun.sh
54 lines (42 loc) · 1.37 KB
/
run.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
: ${LDAP_URI:?"Missing variable LDAP_URI"}
: ${PROXY_URI:?"Missing variable PROXY_URI"}
: ${BASIC_AUTH_STRING:="LDAP authentication"}
: ${REQUIRE_COND:="Require valid-user"}
: ${LISTEN_PORT:=80}
: ${LOGLEVEL:=warn}
: ${ENABLE_WEBSOCKET:=yes}
: ${SERVERNAME:=localhost.localdomain}
: ${ENABLE_XFF_LOG:=yes}
if [[ -v LDAP_BIND_DN ]]; then
if [[ -v LDAP_BIND_USER_PATTERN ]]; then
echo "LDAP_BIND_DN and LDAP_BIND_USER_PATTERN parameters are exclusive."
exit 2
fi
fi
if [[ -v HTTPS_CERT_PEM ]]; then
if [[ ! -v HTTPS_KEY_PEM ]]; then
echo "Missing variable HTTPS_KEY_PEM"
exit 1
fi
echo -e "$HTTPS_CERT_PEM" > /usr/local/apache2/conf/proxy_ldap.cert.pem
echo -e "$HTTPS_KEY_PEM" > /usr/local/apache2/conf/proxy_ldap.key.pem
[[ -v DHPARAM_PEM ]] && {
echo "$DHPARAM_PEM" > /usr/local/apache2/conf/proxy_ldap.cert.pem;
}
fi
[[ -v LDAPS_CACERT_PEM ]] && {
echo "$LDAPS_CACERT_PEM" > /ldap_cacert.pem
}
eval "cat > /usr/local/apache2/conf/proxy_ldap.conf << EOF
$(cat /proxy_ldap.conf.template)
EOF"
sed -i -e 's/^Listen/# Listen/' /usr/local/apache2/conf/httpd.conf
pushd /usr/local/apache2/conf/
[ "${ENABLE_XFF_LOG}" == "yes" ] && ln -sf log_format_xff.conf log_format.conf || ln -sf log_format_normal.conf log_format.conf
popd
[[ -v DISPLAY_CONFIG ]] && {
cat /usr/local/apache2/conf/proxy_ldap.conf
}
# base image CMD
httpd-foreground