blob: 112b2cc4216d7cddd1672bab310eb31f5fe3ccbb (
plain)
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
|
#!/bin/sh
# $FreeBSD$
#
# PROVIDE: qmailsmtpd
# REQUIRE: LOGIN cleanvar
# KEYWORD: shutdown
#
# To use the checkpassword interface to qmail-smtpd, set
# qmailsmtpd_checkpassword to the full path to the checkpassword program (e.g.
# security/checkpassword or security checkpassword-pam).
#
# Note: tcpserver can be found in the sysutils/ucspi-tcp package.
#
# qmailsmtpd_checkpassword could be set to e.g. /usr/local/bin/checkpassword-pam
. /etc/rc.subr
name=qmailsmtpd
rcvar=qmailsmtpd_enable
load_rc_config $name
: ${qmailsmtpd_tcpserver:=%%LOCALBASE%%/bin/tcpserver}
: ${qmailsmtpd_tcprules:=%%LOCALBASE%%/bin/tcprules}
: ${qmailsmtpd_pidfile:=/var/run/qmailsmtpd.pid}
: ${qmailsmtpd_enable:=NO}
: ${qmailsmtpd_cdb:=/etc/tcp.smtp}
: ${qmailsmtpd_flags="-R -H -u 82 -g 81"}
: ${qmailsmtpd_host:=0}
: ${qmailsmtpd_port:=smtp}
: ${qmailsmtpd_smtpd:=%%PREFIX%%/bin/qmail-smtpd}
: ${qmailsmtpd_fqdn:=`hostname`}
: ${qmailsmtpd_checksubprogram:=/usr/bin/true}
start_cmd=qmailsmtpd_start
start_precmd=qmailsmtpd_precmd
pidfile=${qmailsmtpd_pidfile}
procname=${qmailsmtpd_tcpserver}
qmailsmtpd_start()
{
if [ -n "$qmailsmtpd_checkpassword" ]; then
qmailsmtpd_usercheck="$qmailsmtpd_fqdn $qmailsmtpd_checkpassword $qmailsmtpd_checksubprogram"
fi
echo "Starting qmailsmtpd."
$qmailsmtpd_tcpserver -x $qmailsmtpd_cdb.cdb $qmailsmtpd_flags $qmailsmtpd_host $qmailsmtpd_port \
$qmailsmtpd_smtpd $qmailsmtpd_usercheck &
echo $! > $pidfile
}
qmailsmtpd_precmd()
{
if ! [ -e "${qmailsmtpd_tcpserver}" ]; then
echo "sysutils/ucspi-tcp is required" >&2
return 1
fi
if ! [ -e "${qmailsmtpd_cdb}" ]; then
echo "TCP rules file '${qmailsmtpd_cdb}' is missing." >&2
return 1
fi
$qmailsmtpd_tcprules $qmailsmtpd_cdb.cdb $qmailsmtpd_cdb.tmp < $qmailsmtpd_cdb \
|| return 1
}
run_rc_command "$1"
|