blob: 835f3ac39afc8a820a7bf7f8d3f75314f6835d7c (
plain) (
blame)
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
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: postsrsd
# REQUIRE: DAEMON
# BEFORE: mail
# KEYWORD: shutdown
# Define these postsrsd_* variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
# /etc/rc.conf.d/postsrsd
#
# postsrsd_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable dkim-milter
# postsrsd_uid (str): Set username to run postsrsd.
# postsrsd_secret (str): Secret file file. See postsrsd(8)
# postsrsd_domain (str): Local domain name: rewrite to originate from this domain
# postsrsd_exclude_domains (str): Domains to exclude (comma-separated list)
# postsrsd_forward_port (int): Port to listen for forward map
# postsrsd_reverse_port (int): Port to listen for reverse map
# postsrsd_idle_timeout (int): Timeout for idle client connection
# postsrsd_flags (str): Flags passed to start command.
. /etc/rc.subr
name="postsrsd"
rcvar=postsrsd_enable
start_precmd="postsrsd_prepcmd"
stop_postcmd="postsrsd_postcmd"
command="%%PREFIX%%/sbin/postsrsd"
_piddir="/var/run/postsrsd"
pidfile="${_piddir}/${name}.pid"
load_rc_config $name
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
: ${postsrsd_enable="NO"}
: ${postsrsd_domain=`/bin/hostname`}
: ${postsrsd_uid="mailnull"}
: ${postsrsd_secret="%%PREFIX%%/etc/postsrsd.secret"}
: ${postsrsd_forward_port="10001"}
: ${postsrsd_reverse_port="10002"}
: ${postsrsd_idle_timeout="1800"}
: ${postsrsd_exclude_domains=""}
# Options other than above can be set with $postsrsd_flags.
# see postsrsd documentation for detail.
if [ "x${postsrsd_uid}" != "x" ];then
_uid_prefix="-u"
fi
if [ "x${postsrsd_domain}" != "x" ];then
postsrsd_domain="-d ${postsrsd_domain}"
fi
if [ "x${postsrsd_secret}" != "x" ];then
postsrsd_secret="-s ${postsrsd_secret}"
fi
if [ "x${postsrsd_forward_port}" != "x" ];then
postsrsd_forward_port="-f ${postsrsd_forward_port}"
fi
if [ "x${postsrsd_reverse_port}" != "x" ];then
postsrsd_reverse_port="-r ${postsrsd_reverse_port}"
fi
if [ "x${postsrsd_idle_timeout}" != "x" ];then
postsrsd_idle_timeout="-t ${postsrsd_idle_timeout}"
fi
if [ "x${postsrsd_exclude_domains}" != "x" ];then
postsrsd_exclude_domains="-X${postsrsd_exclude_domains}"
fi
command_args=" -D ${_uid_prefix} ${postsrsd_uid} -p ${pidfile} ${postsrsd_domain} ${postsrsd_secret} ${postsrsd_forward_port} ${postsrsd_reverse_port} ${postsrsd_idle_timeout} ${postsrsd_exclude_domains} ${postsrsd_flags}"
postsrsd_prepcmd ()
{
if [ ! -d ${_piddir} ] ; then
mkdir -p ${_piddir}
fi
if [ -n "${postsrsd_uid}" ] ; then
chown ${postsrsd_uid} ${_piddir}
fi
}
postsrsd_postcmd()
{
# just if the directory is empty
rmdir ${_piddir} > /dev/null 2>&1
}
# to let rc.subr kill them all
unset pidfile
run_rc_command "$1"
|