2008-07-06 11:09:56 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
# Copyright (C) 2006-2008 OpenWrt.org
|
|
|
|
|
|
|
|
START=90
|
2009-12-08 19:42:55 +00:00
|
|
|
RUN_D=/var
|
|
|
|
PID_F=$RUN_D/stunnel.pid
|
2006-11-21 00:33:42 +00:00
|
|
|
|
2009-08-09 10:44:52 +00:00
|
|
|
start() {
|
2006-12-03 09:22:28 +00:00
|
|
|
if [ -s "/etc/stunnel/stunnel.pem" ]; then
|
|
|
|
chmod og-rwx /etc/stunnel/stunnel.pem
|
2009-12-08 19:42:55 +00:00
|
|
|
[ ! -f $PID_F ] && stunnel
|
2006-12-03 09:22:28 +00:00
|
|
|
else
|
|
|
|
[ -e /etc/stunnel/config ] && \
|
|
|
|
. /etc/stunnel/config
|
|
|
|
|
|
|
|
X509_CN=${X509_CN:-"router"}
|
|
|
|
X509_O=${X509_O:-"openwrt.org"}
|
|
|
|
X509_OU=${X509_OU:-"open-source firmware"}
|
2009-12-08 19:42:55 +00:00
|
|
|
|
2006-12-03 09:22:28 +00:00
|
|
|
[ -x /sbin/keygen ] && {
|
|
|
|
(keygen "$X509_CN" "$X509_O" "$X509_OU" > /etc/stunnel/stunnel.pem;
|
|
|
|
chmod og-rwx /etc/stunnel/stunnel.pem;
|
|
|
|
stunnel) &
|
|
|
|
}
|
|
|
|
fi
|
2009-08-09 10:44:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2010-01-02 12:14:16 +00:00
|
|
|
[ -f $PID_F ] && {
|
|
|
|
kill $(cat $PID_F)
|
|
|
|
kill -9 $(cat $PID_F)
|
|
|
|
rm -f $PID_F
|
|
|
|
}
|
2009-08-09 10:44:52 +00:00
|
|
|
}
|