Initial commit of source code and docs

This commit is contained in:
2019-03-03 22:22:56 +01:00
commit e41f8bba2a
15 changed files with 1888 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
# /etc/conf.d/pyquarantine-milter: config file for /etc/init.d/pyquarantine-milter
# Set the socket used to communicate with the MTA.
# Examples:
# unix:/path/to/socket a named pipe
# inet:8899 listen on ANY interface
# inet:8899@localhost listen on a specific interface
# inet6:8899 listen on ANY interface
# inet6:8899@[2001:db8:1234::1] listen on a specific interface
SOCKET="inet:8899@127.0.0.1"
# Start the daemon as the user. You can optionally append a group name here also.
# USER="daemon"
# USER="daemon:nobody"
# Optional parameters for pyquarantine-milter
# MILTER_OPTS=""

View File

@@ -0,0 +1,50 @@
#!/sbin/openrc-run
user=${USER:-daemon:nobody}
socket="${SOCKET:-}"
milter_opts="${MILTER_OPTS:-}"
pidfile="/run/${RC_SVCNAME}.pid"
command="/usr/bin/pyquarantine-milter"
command_args="-s ${socket} ${milter_opts}"
command_background=true
start_stop_daemon_args="--user ${user}"
extra_commands="configtest"
depend() {
need net
before mta
}
checkconfig() {
if [ -z "${socket}" ]; then
eerror "No socket specified in config!"
fi
OUTPUT=$( ${command} ${command_args} -t 2>&1 )
ret=$?
if [ $ret -ne 0 ]; then
eerror "${SVCNAME} has detected an error in your configuration:"
printf "%s\n" "${OUTPUT}"
fi
return $ret
}
configtest() {
ebegin "Checking ${SVCNAME} configuration"
checkconfig
eend $?
}
start_pre() {
if [ "${RC_CMD}" != "restart" ]; then
checkconfig || return $?
fi
}
stop_pre() {
if [ "${RC_CMD}" != "restart" ]; then
checkconfig || return $?
fi
}