wok-6.x rev 1789

lighttpd-ssl: generate default certificate
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Nov 30 16:32:22 2008 +0000 (2008-11-30)
parents dcc4ea6cb102
children 91c5b6acc053
files lighttpd-ssl/receipt
line diff
     1.1 --- a/lighttpd-ssl/receipt	Sun Nov 30 15:33:31 2008 +0000
     1.2 +++ b/lighttpd-ssl/receipt	Sun Nov 30 16:32:22 2008 +0000
     1.3 @@ -71,6 +71,17 @@
     1.4  	cp -a stuff/etc $fs
     1.5  	chown -R 0.0 $fs/var/www
     1.6  	chown -R 0.0 $fs/etc
     1.7 +	mkdir $fs/etc/ssl/lighttpd
     1.8 +	cat >> $1/etc/lighttpd/lighttpd.conf <<EOT
     1.9 +
    1.10 +# Enable HTTPS support
    1.11 +#
    1.12 +$SERVER["socket"] == ":443" {
    1.13 +  protocol = "https://"
    1.14 +  ssl.engine    = "enable"
    1.15 +  ssl.pemfile   = "/etc/ssl/lighttpd/lighttpd.pem"
    1.16 +}
    1.17 +EOT
    1.18  	
    1.19  	# Logs directory.
    1.20  	mkdir -p $fs/var/log/lighttpd
    1.21 @@ -89,6 +100,20 @@
    1.22  	local root
    1.23  	root=$1
    1.24  	echo "Processing post-install commands..."
    1.25 +	if [ ! -f $1/etc/ssl/lighttpd/lighttpd.pem ]; then
    1.26 +		openssl req -new -x509 \
    1.27 +			-keyout $1/etc/ssl/lighttpd/lighttpd.pem \
    1.28 +			-out $1/etc/ssl/lighttpd/lighttpd.pem \
    1.29 +			 -days 3650 -nodes <<EOT
    1.30 +$(. /etc/locale.conf ; echo ${LANG#*_})
    1.31 +$(cat /etc/TZ)
    1.32 +
    1.33 +$(cat /etc/hostname)
    1.34 +
    1.35 +
    1.36 +
    1.37 +EOT
    1.38 +	fi
    1.39  	# Just in case.
    1.40  	chown www.www $root/var/log/lighttpd
    1.41  	/etc/init.d/lighttpd start