-
Notifications
You must be signed in to change notification settings - Fork 12
/
start.sh
77 lines (61 loc) · 1.73 KB
/
start.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/sh
# All values are written to /etc/cntlm.conf and also displayed for ease of use.
# (Passwords are not displayed).
if [[ -z "${CUSTOM_CONFIG}" ]]; then
# No custom config. Add all information.
if [[ -z "${USERNAME}" ]]; then
echo "USERNAME not defined."
exit 1
else
echo "Username ${USERNAME}" | tee /etc/cntlm.conf
fi
if [[ -z "${DOMAIN}" ]]; then
echo "DOMAIN not defined."
exit 1
else
echo "Domain ${DOMAIN}" | tee -a /etc/cntlm.conf
fi
if ! [[ -z "${PASSWORD}" ]]; then
echo "Password ${PASSWORD}" >> /etc/cntlm.conf
echo "Password -HIDDEN-"
fi
if [[ -z "${PROXY}" ]]; then
echo "PROXY not defined."
exit 1
else
for i in $(echo ${PROXY} | sed "s/;/ /g")
do
echo "Proxy ${i}" | tee -a /etc/cntlm.conf
done
fi
if [[ -z "${NOPROXY}" ]]; then
NOPROXY='localhost, 127.0.0.*, 10.*, 192.168.*'
fi
echo "NoProxy ${NOPROXY}" | tee -a /etc/cntlm.conf
if [[ -z "${LISTEN}" ]]; then
LISTEN='0.0.0.0:3128'
fi
echo "Listen ${LISTEN}" | tee -a /etc/cntlm.conf
if ! [[ -z "${AUTH}" ]]; then
echo "Auth ${AUTH}" | tee -a /etc/cntlm.conf
fi
if ! [[ -z "${PASSLM}" ]]; then
echo "PassLM ${PASSLM}" | tee -a /etc/cntlm.conf
fi
if ! [[ -z "${PASSNT}" ]]; then
echo "PassNT ${PASSNT}" | tee -a /etc/cntlm.conf
fi
if ! [[ -z "${PASSNTLMV2}" ]]; then
echo "PassNTLMv2 ${PASSNTLMV2}" | tee -a /etc/cntlm.conf
fi
else
# Custom config will be mounted. Skip everything.
echo "Custom config will be used. Skipping all custom settings."
fi
# first arg is `-H` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- /usr/sbin/cntlm -c /etc/cntlm.conf "$@"
else
set -- /usr/sbin/cntlm -c /etc/cntlm.conf -f ${OPTIONS}
fi
exec "$@"