ports/mail/py-tlsrpt-reporter/files/tlsrpt-collectd.in
Matthew Seaman 08bdfa4c86
mail/py-tlsrpt-reporter: new port
tlsrpt-reporter is a TLSRPT reporting service for SMTP TLS Reporting
as defined in RFC 8460. It receives TLSRPT datagrams from a MTA,
collects them, creates a report in conformance with the TLSRPT
Reporting Schema and finally delivers the report either via SMTP,
indirectly by submitting it to a local MTA which ultimately will be
responsible for delivering the report, or directly via HTTP POST.

PR:     285012
Reported by:	Yusuf Yaman
2025-06-04 18:48:20 +01:00

77 lines
2.0 KiB
Bash

#!/bin/sh
# PROVIDE: tlsrpt_collectd
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable tlsrpt_collectd:
#
# tlsrpt_collectd_enable="YES"
#
# Other rc.conf variables:
#
# tlsrpt_collectd_conffile="%%CFGFILE%%"
# -- path to config file
# tlsrpt_collectd_user="%%USER%%"
# -- user to run tlsrpt_collectd as
# tlsrpt_collectd_group="%%GROUP%%"
# -- group to run tlsrpt_collectd as
# tlsrpt_collectd_dbdir="%%DBDIR%%"
# -- location of directory containing
# working database. Must match
# setting in %%CFGFILE%%
# tlsrpt_collectd_logdir="%%LOGDIR%%"
# -- location of tlsrpt_collectd logfile
# tlsrpt_collectd_flags=""
# -- additional flags for tlsrpt_collectd
. /etc/rc.subr
name="tlsrpt_collectd"
rcvar=tlsrpt_collectd_enable
load_rc_config $name
: ${tlsrpt_collectd_enable:="NO"}
: ${tlsrpt_collectd_conffile="%%CFGFILE%%"}
: ${tlsrpt_collectd_user="%%USER%%"}
: ${tlsrpt_collectd_group="%%GROUP%%"}
: ${tlsrpt_collectd_dbdir="%%DBDIR%%"}
: ${tlsrpt_collectd_logdir="%%LOGDIR%%"}
: ${tlsrpt_collectd_flags=""}
start_precmd=${name}_startprecmd
start_cmd=${name}_start
command=%%PYTHON_CMD%%
pidfile=%%RUNDIR%%/tlsrpt-collectd.pid
tlsrpt_collectd_startprecmd()
{
local piddir=$(dirname ${pidfile})
for d in ${piddir} ${tlsrpt_collectd_dbdir} ${tlsrpt_collectd_logdir}; do
mkdir -m 0755 -p ${d}
chown -R ${tlsrpt_collectd_user}:${tlsrpt_collectd_group} ${d}
done
}
tlsrpt_collectd_start()
{
case "${tlsrpt_collectd_flags}" in
*--config_file\ *)
echo "Warning: \$tlsrpt_collectd_flags includes --config_file" \
"option. Please use \$tlsrpt_collectd_conffile instead."
;;
*)
options="--config_file ${tlsrpt_collectd_conffile} ${tlsrpt_collectd_flags}"
;;
esac
/usr/sbin/daemon -c -f -u ${tlsrpt_collectd_user} \
tlsrpt-collectd ${options}
}
run_rc_command "$1"