Repository navigation
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
·104 lines (97 loc) · 4.54 KB
/
Copy pathdocker-entrypoint.sh
File metadata and controls
executable file
·104 lines (97 loc) · 4.54 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
# ProFTPD config
if [ -z "${PROFTPD_SERVER_NAME}" ]
then sed -i "s/{{PROFTPD_SERVER_NAME}}/Debian/" /etc/proftpd/proftpd.conf
else sed -i "s/{{PROFTPD_SERVER_NAME}}/${PROFTPD_SERVER_NAME}/" /etc/proftpd/proftpd.conf
fi
if [ -z "${PROFTPD_LISTEN_PORT}" ]
then sed -i "s/{{PROFTPD_LISTEN_PORT}}/21/" /etc/proftpd/proftpd.conf
else sed -i "s/{{PROFTPD_LISTEN_PORT}}/${PROFTPD_LISTEN_PORT}/" /etc/proftpd/proftpd.conf
fi
if [ -z "${PROFTPD_PASSIVE_PORTS}" ]
then sed -i "s/{{PROFTPD_PASSIVE_PORTS}}/49152 65534/" /etc/proftpd/proftpd.conf
else sed -i "s/{{PROFTPD_PASSIVE_PORTS}}/${PROFTPD_PASSIVE_PORTS}/" /etc/proftpd/proftpd.conf
fi
if [ -z "${PROFTPD_MASQUERADE_ADDRESS}" ]
then sed -i "s/{{PROFTPD_MASQUERADE_ADDRESS}}/1.2.3.4/" /etc/proftpd/proftpd.conf
else sed -i "s/{{PROFTPD_MASQUERADE_ADDRESS}}/${PROFTPD_MASQUERADE_ADDRESS}/" /etc/proftpd/proftpd.conf
fi
if [ -z "${PROFTPD_DYN_MASQ_REFRESH}" ]
then sed -i "s/{{PROFTPD_DYN_MASQ_REFRESH}}/28800/" /etc/proftpd/proftpd.conf
else sed -i "s/{{PROFTPD_DYN_MASQ_REFRESH}}/${PROFTPD_DYN_MASQ_REFRESH}/" /etc/proftpd/proftpd.conf
fi
if [ -z "${PROFTPD_MAX_INSTANCES}" ]
then sed -i "s/{{PROFTPD_MAX_INSTANCES}}/30/" /etc/proftpd/proftpd.conf
else sed -i "s/{{PROFTPD_MAX_INSTANCES}}/${PROFTPD_MAX_INSTANCES}/" /etc/proftpd/proftpd.conf
fi
# http://www.proftpd.org/docs/modules/mod_core.html#AllowForeignAddress
if [ -z "${PROFTPD_ALLOW_FOREIGN_ADDESS}" ]
then sed -i "s/{{PROFTPD_ALLOW_FOREIGN_ADDESS}}/off/" /etc/proftpd/proftpd.conf
else sed -i "s/{{PROFTPD_ALLOW_FOREIGN_ADDESS}}/${PROFTPD_ALLOW_FOREIGN_ADDESS}/" /etc/proftpd/proftpd.conf
fi
# ProFTPD LDAP config
if [ -z "${PROFTPD_LDAP_SERVER}" ]
then sed -i "s/{{PROFTPD_LDAP_SERVER}}/ldap.example.com/" /etc/proftpd/ldap.conf
else sed -i "s/{{PROFTPD_LDAP_SERVER}}/${PROFTPD_LDAP_SERVER}/" /etc/proftpd/ldap.conf
fi
if [ -z "${PROFTPD_LDAP_BIND_DN}" ]
then sed -i "s/{{PROFTPD_LDAP_BIND_DN}}/cn=admin,dc=example,dc=com/" /etc/proftpd/ldap.conf
else sed -i "s/{{PROFTPD_LDAP_BIND_DN}}/${PROFTPD_LDAP_BIND_DN}/" /etc/proftpd/ldap.conf
fi
if [ -z "${PROFTPD_LDAP_BIND_DN_PASSWORD}" ]
then sed -i "s/{{PROFTPD_LDAP_BIND_DN_PASSWORD}}/supersecurepassword/" /etc/proftpd/ldap.conf
else sed -i "s/{{PROFTPD_LDAP_BIND_DN_PASSWORD}}/${PROFTPD_LDAP_BIND_DN_PASSWORD}/" /etc/proftpd/ldap.conf
fi
if [ -z "${PROFTPD_LDAP_USERS}" ]
then sed -i "s/{{PROFTPD_LDAP_USERS}}/30/" /etc/proftpd/ldap.conf
else sed -i "s/{{PROFTPD_LDAP_USERS}}/${PROFTPD_LDAP_USERS}/" /etc/proftpd/ldap.conf
fi
if [ -z "${PROFTPD_LDAP_USERS_FILTER}" ]
then sed -i "s/{{PROFTPD_LDAP_USERS_FILTER}}/(&(cn=\%v)(objectclass=person))/" /etc/proftpd/ldap.conf
else sed -i "s/{{PROFTPD_LDAP_USERS_FILTER}}/${PROFTPD_LDAP_USERS_FILTER}/" /etc/proftpd/ldap.conf
fi
if [ -z "${PROFTPD_LDAP_GENERATE_HOMEDIR}" ]
then sed -i "s/{{PROFTPD_LDAP_GENERATE_HOMEDIR}}/on/" /etc/proftpd/ldap.conf
else sed -i "s/{{PROFTPD_LDAP_GENERATE_HOMEDIR}}/${PROFTPD_LDAP_GENERATE_HOMEDIR}/" /etc/proftpd/ldap.conf
fi
# ProFTPD TLS config
if [ -z "${PROFTPD_TLS_ENABLE}" ]
then sed -i "s/{{PROFTPD_TLS_ENABLE}}/on/" /etc/proftpd/tls.conf
else sed -i "s/{{PROFTPD_TLS_ENABLE}}/${PROFTPD_TLS_ENABLE}/" /etc/proftpd/tls.conf
fi
if [ -z "${PROFTPD_TLS_RSA_CERTIFICATE_FILE}" ]
then sed -i "s/{{PROFTPD_TLS_RSA_CERTIFICATE_FILE}}/\/etc\/ssl\/certs\/proftpd\.crt/" /etc/proftpd/tls.conf
else sed -i "s:{{PROFTPD_TLS_RSA_CERTIFICATE_FILE}}:${PROFTPD_TLS_RSA_CERTIFICATE_FILE}:" /etc/proftpd/tls.conf
fi
if [ -z "${PROFTPD_TLS_RSA_CERTIFICATE_KEY_FILE}" ]
then sed -i "s/{{PROFTPD_TLS_RSA_CERTIFICATE_KEY_FILE}}/\/etc\/ssl\/private\/proftpd\.key/" /etc/proftpd/tls.conf
else sed -i "s:{{PROFTPD_TLS_RSA_CERTIFICATE_KEY_FILE}}:${PROFTPD_TLS_RSA_CERTIFICATE_KEY_FILE}:" /etc/proftpd/tls.conf
fi
if [ -z "${PROFTPD_CA_CERTIFICATE_FILE}" ]
then sed -i "/.*TLSCACertificateFile.*/d" /etc/proftpd/tls.conf
else sed -i "s:{{PROFTPD_CA_CERTIFICATE_FILE}}:${PROFTPD_CA_CERTIFICATE_FILE}:" /etc/proftpd/tls.conf
fi
if [ -z "${PROFTPD_TLS_REQUIRED}" ]
then sed -i "s/{{PROFTPD_TLS_REQUIRED}}/off/" /etc/proftpd/tls.conf
else sed -i "s/{{PROFTPD_TLS_REQUIRED}}/${PROFTPD_TLS_REQUIRED}/" /etc/proftpd/tls.conf
fi
unset \
PROFTPD_SERVER_NAME \
PROFTPD_LISTEN_PORT \
PROFTPD_PASSIVE_PORTS \
PROFTPD_MASQUERADE_ADDRESS \
PROFTPD_DYN_MASQ_REFRESH \
PROFTPD_MAX_INSTANCES \
PROFTPD_LDAP_SERVER \
PROFTPD_LDAP_BIND_DN \
PROFTPD_LDAP_BIND_DN_PASSWORD \
PROFTPD_LDAP_USERS \
PROFTPD_LDAP_USERS_FILTER \
PROFTPD_LDAP_GENERATE_HOMEDIR \
PROFTPD_TLS_ENABLE \
PROFTPD_TLS_RSA_CERTIFICATE_FILE \
PROFTPD_TLS_RSA_CERTIFICATE_KEY_FILE \
PROFTPD_CA_CERTIFICATE_FILE \
PROFTPD_TLS_REQUIRED
# Run ProFTPD
exec "$@"