2 ## /etc/init.d/crywrap -- init script for CryWrap
3 ## (Generic, used for Debian)
5 ## arch-tag: 95d90d0c-199e-4f43-9bf3-33706a009a19
9 CRYWRAP
=/usr
/sbin
/crywrap
10 CONFFILE
=/etc
/default
/crywrap
11 PIDDIR
=/var
/run
/crywrap
13 test -x ${CRYWRAP} ||
exit 0
15 ## Ignore starts here..
16 # crywrap_map_add dest listen
19 SRC_PORT
="$(echo $1 | sed -e 's,^.*/,,g')"
20 SRC_IP
="$(echo $1 | sed -e 's,/.*,,g')"
21 DST_PORT
="$(echo $2 | sed -e 's,^.*/,,g')"
22 DST_IP
="$(echo $2 | sed -e 's,/.*,,g')"
24 CRYWRAP_MAP
="${CRYWRAP_MAP}-d ${SRC_IP}/${SRC_PORT} -l ${DST_IP}/${DST_PORT}|"
27 ## Unignore starts here :)
29 [ -e ${CONFFILE} ] && .
${CONFFILE}
33 install -d -m 1777 ${PIDDIR}
38 while [ "$#" -gt 0 ]; do
40 if [ ! -z "${CRYWRAP_CERTFILE}" ]; then
41 PC
="cert=${CRYWRAP_CERTFILE}"
43 if [ ! -z "${CRYWRAP_KEYFILE}" ]; then
44 PK
="key=${CRYWRAP_KEYFILE}"
46 P
="${PC}${PC:+,}${PK}"
48 CMDLINE
="$1 -P ${PIDDIR}/crywrap-${cnt}.pid ${P} \
49 ${CRYWRAP_USER:+-u ${CRYWRAP_USER}} \
51 cnt
=$
(expr ${cnt} + 1)
52 eval ${CRYWRAP} ${CMDLINE}
57 if [ "$cnt" -eq 0 ]; then
66 for PIDFILE
in ${PIDDIR}/*; do
67 if [ -e ${PIDFILE} ]; then
69 if [ ! -z "${PID}" ]; then
70 if kill -15 ${PID} >/dev
/null
2>&1; then
82 echo -n "Starting TLS wrapper: crywrap"
85 echo -n "Stopping TLS wrapper: crywrap"
93 echo "Usage: /etc/init.d/crywrap {start|stop|restart|force-reload}"