/usr/share/trust_router/redhat/init is in moonshot-trust-router 1.4.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | #!/bin/bash
#
# ntpd This shell script takes care of starting and stopping
# trust_router.
#
# chkconfig: - 58 74
# description: trust_router is the GSS-EAP trust routing daemon. \
# GSS-EAP is an IETF standard for providing authentication across \
# an insecure WAN. \
### BEGIN INIT INFO
# Provides: trust_router
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Should-Start: $syslog $named ntpdate
# Should-Stop: $syslog $named
# Short-Description: start and stop trust_router
# Description: trust_router is the GSS-EAP trust routing daemon.
# GSS-EAP is an IETF standard for providing authentication
# across an insecure WAN.
### END INIT INFO
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Load the instance configuration
[ -f /etc/sysconfig/trust_router ] || exit 6
. /etc/sysconfig/trust_router
# Create the pidfile directory
mkdir -p /var/run/trust_router
chown trustrouter:trustrouter /var/run/trust_router
# Does the trust router and wrapper exist
[ -x /usr/bin/trust_router ] || exit 5
[ -x /usr/bin/trust_router-wrapper ] || exit 5
# Does the tidc client exist
[ -x /usr/bin/tidc ] || exit 5
[ -x /usr/bin/tidc-wrapper ] || exit 5
prog="trust_router-wrapper"
array_contains() {
local i
for i in "${@:2}" ;
do
[ "${i}" == "${1}" ] && return 0
done
return 1
}
execute-tidc() {
echo -n "Attempting to authenticate to instance ${current_instance}:${current_port}"
daemon --user="${current_user}" /usr/bin/tidc-wrapper "${current_test_acceptor}" "${current_test_rprealm}" "${current_test_community}" "${current_test_realm}" "${current_port}"
tidc_ret=$?
echo
return ${tidc_ret}
}
get-config() {
current_instance=${1}
if [ "${TR_CONFIG_USER[${current_instance}]+abc}" ] ;
then
current_user=${TR_CONFIG_USER[${current_instance}]}
else
current_user=${TR_DEFAULT_USER}
fi
if [ "${TR_CONFIG_PIDDIR[${current_instance}]+abc}" ] ;
then
current_piddir=${TR_CONFIG_PIDDIR[${current_instance}]}
else
current_piddir=${TR_DEFAULT_PIDDIR}
fi
if [ "${TR_CONFIG_CFGDIR[${current_instance}]+abc}" ] ;
then
current_cfgdir=${TR_CONFIG_CFGDIR[${current_instance}]}
else
current_cfgdir=${TR_DEFAULT_CFGDIR}
fi
if [ "${TR_CONFIG_LOGDIR[${current_instance}]+abc}" ] ;
then
current_logdir=${TR_CONFIG_LOGDIR[${current_instance}]}
else
current_logdir=${TR_DEFAULT_LOGDIR}
fi
if [ "${TR_CONFIG_PORT[${current_instance}]+abc}" ] ;
then
current_port=${TR_CONFIG_PORT[${current_instance}]}
else
current_port=${TR_DEFAULT_PORT}
fi
if [ "${TR_CONFIG_AUTOSTART[${current_instance}]+abc}" ] ;
then
current_autostart=${TR_CONFIG_AUTOSTART[${current_instance}]}
else
current_autostart=${TR_DEFAULT_AUTOSTART}
fi
if [ "${TR_CONFIG_ACCEPTOR[${current_instance}]+abc}" ] ;
then
current_test_acceptor=${TR_CONFIG_TEST_ACCEPTOR[${current_instance}]}
else
current_test_acceptor=${TR_DEFAULT_TEST_ACCEPTOR}
fi
if [ "${TR_CONFIG_RPREALM[${current_instance}]+abc}" ] ;
then
current_test_rprealm=${TR_CONFIG_TEST_RPREALM[${current_instance}]}
else
current_test_rprealm=${TR_DEFAULT_TEST_RPREALM}
fi
if [ "${TR_CONFIG_TEST_COMMUNITY[${current_instance}]+abc}" ] ;
then
current_test_community=${TR_CONFIG_TEST_COMMUNITY[${current_instance}]}
else
current_test_community=${TR_DEFAULT_TEST_COMMUNITY}
fi
if [ "${TR_CONFIG_TEST_REALM[${current_instance}]+abc}" ] ;
then
current_test_realm=${TR_CONFIG_TEST_REALM[${current_instance}]}
else
current_test_realm=${TR_DEFAULT_TEST_REALM}
fi
}
get-pidfile() {
echo "${current_piddir}/${current_instance}.pid"
}
start() {
[ "${EUID}" != "0" ] && exit 4
[ "${NETWORKING}" = "no" ] && exit 1
start_ret=0
for i in "${TR_INSTANCES[@]}"
do
get-config "${i}"
if ${current_autostart} ;
then
start-instance
let "start_ret+=$?"
else
echo "Skipping instance ${current_instance}"
fi
done
return "${start_ret}"
}
start-single() {
if array_contains "${1}" "${TR_INSTANCES[@]}" ;
then
get-config "${1}"
start-instance
return $?
else
echo "Instance ${1} not found..."
return 1
fi
}
start-instance() {
pidfile=$(get-pidfile)
logfile="${current_logdir}/${current_instance}.log"
cfgdir="${current_cfgdir}/${current_instance}/"
OPTIONS="${pidfile} ${cfgdir} ${logfile}"
if [ -f "${pidfile}" ] ;
then
local OLD_PID=$(cat "${pidfile}")
if [ -d "/proc/${OLD_PID}" ] ;
then
echo "Instance ${current_instance} is already running..."
else
echo "Removing stale PID file..."
rm "${pidfile}"
start-instance
return $?
fi
else
echo -n "Starting instance ${current_instance}..."
daemon --user="${current_user}" --pidfile="${pidfile}" "${prog}" "${OPTIONS}"
echo
fi
# Give it a few seconds for things to settle
sleep 2
execute-tidc
return $?
}
stop() {
[ "${EUID}" != "0" ] && exit 4
[ "${NETWORKING}" = "no" ] && exit 1
for i in "${TR_INSTANCES[@]}"
do
get-config "${i}"
pidfile=$(get-pidfile)
if [ -f "${pidfile}" ] ;
then
stop-instance
else
echo "Instance ${i} does not appear to be running..."
fi
done
}
stop-single() {
if array_contains "${1}" "${TR_INSTANCES[@]}" ;
then
get-config "${1}"
stop-instance
else
echo "Instance ${1} not found..."
return 1
fi
return 0
}
stop-instance() {
if [ -f "$(get-pidfile)" ] ;
then
echo -n "Stopping instance ${current_instance}..."
killproc -p "$(get-pidfile)" "${prog}"
echo
else
echo "Instance ${current_instance} does not appear to be running..."
fi
}
status() {
[ "${EUID}" != "0" ] && exit 4
[ "${NETWORKING}" = "no" ] && exit 1
start_ret=0
for i in "${TR_INSTANCES[@]}"
do
get-config "${i}"
execute-tidc
let "exec_ret+=$?"
done
return "${exec_ret}"
}
# See how we were called.
case "${1}" in
start)
start
;;
start-single)
start-single "${2}"
;;
stop)
stop
;;
stop-single)
stop-single "${2}"
;;
status)
status "${prog}"
;;
restart|force-reload)
stop
start
;;
reload)
exit 3
;;
*)
echo "Usage: ${0} {start|start-single|stop|stop-single|status|restart|force-reload}"
exit 2
esac
|