--- /dev/null
+## Define the variables needed to run TIDS
+##
+## /usr/bin/tids <ip-address> <gss-name> <hostname> <database-name>
+##
+
+TIDS_SERVER_IP="127.0.0.1" # IP address that the TIDS is reachable on
+TIDS_SERVER_NAME="localhost" # The host name that the TIDS is known as
+TIDS_USER="trustrouter" # The user that the TIDS is running as
+TIDS_GROUP="trustrouter" # The group that the TIDS is running as
+
+TIDS_GSS_NAME="trustrouter@apc.moonshot.ja.net" # The GSS service name for the TIDS APC
+KEYFILE="/var/lib/trust_router/keys" # The key file that the TIDS will store keys in
+
+## Static variables that you can also adjust
+
+TIDS_PIDDIR="/var/run/tids"
+TIDS_LOGDIR="/var/log/tids"
--- /dev/null
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides: tids
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 4 6
+# Required-Start: radiusd
+# Should-Start: $network
+# Short-Description: Starts Moonshot TIDS
+# Description: Starts the Moonshot Temporary ID Service
+### END INIT INFO
+# chkconfig: - 89 11
+#
+# description: Starts the Moonshot Temporary ID Service
+#
+# Source function library.
+. /etc/init.d/functions
+
+[ -z "$HOME" ] && export HOME=/
+
+usage() {
+ echo "Usage: $0 {start|stop|status}"
+}
+
+# Load the configuration
+[ -f /etc/sysconfig/tids ] || exit 6
+. /etc/sysconfig/tids
+
+# Create the PID and LOG directories
+[ -d ${TIDS_PIDDIR} ] || mkdir -p ${TIDS_PIDDIR} && chown ${TIDS_USER}:${TIDS_GROUP} ${TIDS_PIDDIR}
+[ -d ${TIDS_LOGDIR} ] || mkdir -p ${TIDS_LOGDIR} && chown ${TIDS_USER}:${TIDS_GROUP} ${TIDS_LOGDIR}
+
+# Some variables
+prog=/usr/bin/tids-wrapper
+PIDFILE="${TIDS_PIDDIR}/tids.pid"
+LOGFILE="${TIDS_LOGDIR}/tids.log"
+
+# Does the trust router and wrapper exist
+[ -x /usr/bin/tids ] || exit 5
+[ -x /usr/bin/tids-wrapper ] || exit 5
+
+[ -f ${LOGFILE} ] || touch ${LOGFILE} && chown ${TIDS_USER}:${TIDS_GROUP} ${LOGFILE}
+
+OPTIONS="${PIDFILE} ${LOGFILE} ${TIDS_SERVER_IP} ${TIDS_GSS_NAME} ${TIDS_SERVER_NAME} ${KEYFILE}"
+
+case "$1" in
+ start)
+ if [ -f ${PIDFILE} ] ;
+ then
+ OLD_PID=$(cat "${PIDFILE}")
+
+ if [ -d "/proc/${OLD_PID}" ] ;
+ then
+ echo "Error: TIDS already running" ; exit 1
+ else
+ rm ${PIDFILE}
+ fi
+ fi
+
+ timestamp=$(date)
+ echo "${timestamp} Starting TIDS..." >> ${LOGFILE}
+ echo -n "Starting TIDS..."
+ daemon --user="${TIDS_USER}" --pidfile="{PIDFILE}" "${prog}" "${OPTIONS}"
+ echo
+
+ exit $?
+ ;;
+ stop)
+ timestamp=$(date)
+ echo "${timestamp} Stopping TIDS..." >> ${LOGFILE}
+ echo -n "Stopping TIDS..."
+ if [ -f "${PIDFILE}" ] ;
+ then
+ killproc -p "${PIDFILE}" "${prog}"
+ echo
+ else
+ echo "TIDS does not appear to be running"
+ fi
+ exit $?
+ ;;
+ status)
+ if [ -f ${PIDFILE} ] ;
+ then
+ PID=$(cat "${PIDFILE}")
+
+ if [ -d "/proc/${PID}" ] ;
+ then
+ echo "TIDS is running (pid ${PID})"
+ else
+ if [ -e ${PIDFILE} ] ; then
+ echo "TIDS appears to be dead but its PID file exists"
+ else
+ echo "TIDS appears to be stopped"
+ fi
+ fi
+ else
+ echo "TIDS appears to be stopped"
+ fi
+ exit 0
+ ;;
+ reload | force-reload | condrestart | try-restart)
+ usage
+ exit 3
+ ;;
+ *)
+ usage
+ exit 2
+ ;;
+esac
install -D -m 640 redhat/default-main.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/conf.d/default/main.cfg
install -D -m 640 redhat/tr-test-main.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/conf.d/tr-test/main.cfg
install -D -m 640 redhat/sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/trust_router
+install -D -m 640 redhat/sysconfig.tids $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/tids
+install -D -m 755 tids.initd $RPM_BUILD_ROOT/%{_initrddir}/tids
# Link shared config
ln -s ../../trusts.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/conf.d/default/trusts.cfg
# Install wrapper scripts
install -D -m 755 redhat/tidc-wrapper $RPM_BUILD_ROOT/%{_bindir}/tidc-wrapper
+install -D -m 755 redhat/tids-wrapper $RPM_BUILD_ROOT/%{_bindir}/tids-wrapper
install -D -m 755 redhat/trust_router-wrapper $RPM_BUILD_ROOT/%{_bindir}/trust_router-wrapper
# As we're building an RPM, we don't need the init scripts etc. in /usr/share
%{_datadir}/trust_router/schema.sql
#/lib/systemd/system/tids.service
+%{_initrddir}/tids
%{_initrddir}/trust_router
+%config(noreplace) %{_sysconfdir}/sysconfig/tids
%config(noreplace) %{_sysconfdir}/sysconfig/trust_router
%dir %attr(755,root,trustrouter) %{_sysconfdir}/trust_router
%defattr(-,root,root,-)
%{_includedir}/*
%{_libdir}/*.so
-
-
-