1 # http://www.stunnel.org/faq/certs.html
 
   3 # execute this as root!
 
   5 # Redhat : stunnel-4 does not work! you need to install stunnel-5
 
   6 # Debian : stunnel-5.06 does not work! you need to install stunnel-5.18
 
  11 openssl req -new -x509 -days 9999 -nodes -out stunnel.pem -keyout stunnel.pem
 
  12 # see http://www.infodrom.org/Debian/tips/stunnel.html
 
  13 dd if=/dev/urandom count=2 | openssl dhparam -rand - 1024 >> stunnel.pem
 
  14 openssl x509 -text -in stunnel.pem
 
  17 cat <<EOD>stunnel.conf
 
  19 output = /home/fex/spool/stunnel.log
 
  20 cert = /home/fex/etc/stunnel.pem
 
  24 execargs = perl -T /home/fex/bin/fexsrv stunnel
 
  27 case $(lsb_release -a 2>/dev/null) in
 
  28   *CentOS*) echo 'fips = no' >>stunnel.conf;;
 
  33 stunnel=$(which stunnel4)
 
  34 if [ -z "$stunnel" ]; then
 
  35   echo "no stunnel found" >&2
 
  38   cat <<EOD>/etc/xinetd.d/fexs
 
  40 # description: fex web server with SSL
 
  41 # note: only possible on port 443!
 
  53         server_args     = /home/fex/etc/stunnel.conf
 
  59   /etc/init.d/xinetd restart
 
  60   echo 'To enforce https, add to fex.ph:'
 
  61   echo '$force_https = 1;'
 
  65 # Hint: on some systems stunnel works not well with xinetd
 
  66 #       you can also run stunnel without xinetd, in server daemon mode