From 89944891864314b417465e76ebf49d0a94ca048e Mon Sep 17 00:00:00 2001 From: Tim Yardley Date: Sun, 3 Dec 2006 09:22:28 +0000 Subject: [PATCH] bring in optional key generation SVN-Revision: 5688 --- net/stunnel/files/stunnel.init | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/net/stunnel/files/stunnel.init b/net/stunnel/files/stunnel.init index c26e87dae0..e4de45b613 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 -- 2.30.2