From: pavlov Date: Sun, 3 Dec 2006 09:22:28 +0000 (+0000) Subject: bring in optional key generation X-Git-Url: http://git.archive.openwrt.org/?a=commitdiff_plain;h=83922c7260409d82218b6eba1adb1f55e2f92525;p=packages.git bring in optional key generation git-svn-id: svn://svn.openwrt.org/openwrt/packages@5688 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- diff --git a/net/stunnel/files/stunnel.init b/net/stunnel/files/stunnel.init index c26e87dae..e4de45b61 100755 --- a/net/stunnel/files/stunnel.init +++ b/net/stunnel/files/stunnel.init @@ -2,11 +2,23 @@ case "$1" in start|boot) - # reasons for starting - [ -e "/etc/stunnel/stunnel.pem" ] && { - chmod og-rwx /etc/stunnel/stunnel.pem - stunnel - } + 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