1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006-2008 OpenWrt.org
6 PID_F
=$RUN_D/stunnel.pid
9 if [ -s "/etc/stunnel/stunnel.pem" ]; then
10 chmod og-rwx
/etc
/stunnel
/stunnel.pem
11 [ ! -f $PID_F ] && stunnel
13 [ -e /etc
/stunnel
/config
] && \
16 X509_CN
=${X509_CN:-"router"}
17 X509_O
=${X509_O:-"openwrt.org"}
18 X509_OU
=${X509_OU:-"open-source firmware"}
20 [ -x /sbin
/keygen
] && {
21 (keygen
"$X509_CN" "$X509_O" "$X509_OU" > /etc
/stunnel
/stunnel.pem
;
22 chmod og-rwx
/etc
/stunnel
/stunnel.pem
;
29 [ -f $PID_F ] && kill -9 $
(cat $PID_F) && rm -f $PID_F