freebsd-ports/security/shibboleth2-sp/files/shibboleth-sp.in
Palle Girgensohn 732610c736 Update Shibboleth-sp and its tool chain to 2.5.1.
Note that from 2.5, shibd is run as the user shibd.  The port tries to fix the
key file ownership but if you have changed the file name of the key from the
default sp-key.pem, make sure you chown your key file(s) to user shibd.

Also, take maintainership of the entire tool chain (approved by all previous
maintainers).

Incorporates the ideas suggested by Craig Leres [177668], making sure that the
ssl key is not added to the package.

PR:	177668, 178694
2013-06-04 17:29:21 +00:00

53 lines
1.4 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: shibboleth_sp
# REQUIRE: DAEMON
#
. /etc/rc.subr
name="shibboleth_sp"
rcvar=shibboleth_sp_enable
: ${shibboleth_sp_enable:='NO'}
: ${shibboleth_sp_flags:=''}
command=${shibboleth_sp_program:-%%PREFIX%%/sbin/shibd}
pidfile="${shibboleth_sp_pidfile:-/var/run/shibboleth/${name}.pid}"
start_precmd="shibboleth_sp_configtest"
restart_precmd="shibboleth_sp_configtest"
configtest_cmd="shibboleth_sp_configtest"
keygen_cmd="shibboleth_sp_keygen"
shibboleth_sp_user=%%SHIBD_USER%%
shibboleth_sp_group=%%SHIBD_GROUP%%
load_rc_config $name
command_args="-f -p ${pidfile} -u ${shibboleth_sp_user} -g ${shibboleth_sp_group}"
confdir=${SHIBSP_CFGDIR:-%%PREFIX%%/etc}/shibboleth
cert=sp-cert.pem
key=sp-key.pem
shibboleth_sp_configtest() {
if [ ! -s ${confdir}/${key} -o ! -s ${confdir}/${cert} ]; then
run_rc_command keygen
else
# update from 2.4.x, chown %%SHIBD_USER%% the key and cert
for f in ${confdir}/${key} ${confdir}/${cert}; do
set X `stat ${f}`
test $6 != ${shibboleth_sp_user} && chown ${shibboleth_sp_user}:${shibboleth_sp_group} ${f}
done
fi
${command} ${shibboleth_sp_flags} -u ${shibboleth_sp_user} -g ${shibboleth_sp_group} -t
}
shibboleth_sp_keygen() {
%%SH%% ${confdir}/keygen.sh -o ${confdir} -u ${shibboleth_sp_user} -g ${shibboleth_sp_group}
}
extra_commands="configtest keygen"
run_rc_command "$1"