47280b7874
git-svn-id: svn://svn.openwrt.org/openwrt/packages@11683 3c298f89-4303-0410-b956-a3cf2f4a3e73
31 lines
596 B
Bash
31 lines
596 B
Bash
#!/bin/sh /etc/rc.common
|
|
# Copyright (C) 2006-2008 OpenWrt.org
|
|
|
|
START=90
|
|
|
|
case "$1" in
|
|
start|boot)
|
|
if [ -s "/etc/stunnel/stunnel.pem" ]; then
|
|
chmod og-rwx /etc/stunnel/stunnel.pem
|
|
stunnel
|
|
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"}
|
|
|
|
[ -x /sbin/keygen ] && {
|
|
(keygen "$X509_CN" "$X509_O" "$X509_OU" > /etc/stunnel/stunnel.pem;
|
|
chmod og-rwx /etc/stunnel/stunnel.pem;
|
|
stunnel) &
|
|
}
|
|
fi
|
|
;;
|
|
stop)
|
|
killall stunnel
|
|
killall -9 stunnel
|
|
;;
|
|
esac
|