-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun-proftpd.sh
executable file
·72 lines (54 loc) · 2.06 KB
/
run-proftpd.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
#!/bin/bash
# Environment variable defaults
update_proftpd_setting() {
conffile="$1"
setting="$2"
value="$3"
sed -i -e 's#^[ \t]*'"$setting"'[ \t].*$#'"$setting $value"'#' "$conffile"
}
[ -n "$PROFTPD_FTP_PORT" ] && \
update_proftpd_setting /etc/proftpd/proftpd.conf \
Port "$PROFTPD_FTP_PORT"
# Remove the hyphen
[ -n "$PROFTPD_PASSIVE_PORTS" ] && \
update_proftpd_setting /etc/proftpd/proftpd.conf \
PassivePorts "${PROFTPD_PASSIVE_PORTS//-/ }"
[ -n "$PROFTPD_DEBUG_LEVEL" ] && \
update_proftpd_setting /etc/proftpd/proftpd.conf \
DebugLevel "$PROFTPD_DEBUG_LEVEL"
[ -n "$PROFTPD_SERVER_NAME" ] && \
update_proftpd_setting /etc/proftpd/proftpd.conf \
ServerName "$PROFTPD_SERVER_NAME"
[ -n "$PROFTPD_REQUIRE_VALID_SHELL" ] && \
update_proftpd_setting /etc/proftpd/proftpd.conf \
RequireValidShell "$PROFTPD_REQUIRE_VALID_SHELL"
[ -n "$PROFTPD_TIMEOUT_NO_TRANSFER" ] && \
update_proftpd_setting /etc/proftpd/proftpd.conf \
TimeoutNoTransfer "$PROFTPD_TIMEOUT_NO_TRANSFER"
[ -n "$PROFTPD_TIMEOUT_STALLED" ] && \
update_proftpd_setting /etc/proftpd/proftpd.conf \
TimeoutStalled "$PROFTPD_TIMEOUT_STALLED"
[ -n "$PROFTPD_TIMEOUT_IDLE" ] && \
update_proftpd_setting /etc/proftpd/proftpd.conf \
TimeoutIdle "$PROFTPD_TIMEOUT_IDLE"
[ -n "$PROFTPD_DEFAULT_ROOT" ] && \
update_proftpd_setting /etc/proftpd/proftpd.conf \
DefaultRoot "$PROFTPD_DEFAULT_ROOT"
[ -n "$PROFTPD_MAX_INSTANCES" ] && \
update_proftpd_setting /etc/proftpd/proftpd.conf \
MaxInstances "$PROFTPD_MAX_INSTANCES"
[ -n "$PROFTPD_UMASK" ] && \
update_proftpd_setting /etc/proftpd/proftpd.conf \
Umask "$PROFTPD_UMASK"
[ -n "$PROFTPD_AUTH_ORDER" ] && \
update_proftpd_setting /etc/proftpd/proftpd.conf \
AuthOrder "$PROFTPD_AUTH_ORDER"
# Turn this on if it's not on
if [ "$PROFTPD_TLS" != "on" ]; then
sed -i -e '/LoadModule mod_tls/s/^/# /' /etc/proftpd/modules.conf
fi
[ -n "$PROFTPD_TLS_REQUIRED" ] &&
update_proftpd_setting /etc/proftpd/tls.conf \
TLSRequired "$PROFTPD_TLS_REQUIRED"
# exec to replace bash
exec proftpd -nc /etc/proftpd/proftpd.conf