wok-4.x rev 1794

Apache: update ssl config
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Nov 30 21:21:48 2008 +0000 (2008-11-30)
parents 14119a3f80ea
children 0cfd1749f087
files apache/receipt
line diff
     1.1 --- a/apache/receipt	Sun Nov 30 19:51:02 2008 +0000
     1.2 +++ b/apache/receipt	Sun Nov 30 21:21:48 2008 +0000
     1.3 @@ -30,6 +30,7 @@
     1.4  genpkg_rules()
     1.5  {
     1.6  	mkdir -p $fs/usr/share/apache $fs/etc/init.d $fs/etc/apache/conf.d
     1.7 +	mkdir -p $fs/etc/ssl/apache
     1.8  	cp -a $_pkg/usr/share/apache/icons $fs/usr/share/apache
     1.9  	cp -a $_pkg/usr/share/apache/error $fs/usr/share/apache
    1.10  	cp -a $_pkg/usr/share/apache/modules $fs/usr/share/apache
    1.11 @@ -41,7 +42,11 @@
    1.12  	ln -s /usr/bin/apachectl $fs/etc/init.d/apache
    1.13  	sed -i  -e 's|User daemon|User www|' -e 's|Group daemon|Group www|' \
    1.14  		-e 's|ServerAdmin you@example.com|ServerAdmin root@localhost|' \
    1.15 -		$fs/etc/apache/httpd.conf
    1.16 +		-e 's|mod_rewrite.so|mod_rewrite.so\nLoadModule ssl_module share/apache/modules/mod_ssl.so\nLoadModule proxy_module share/apache/modules/mod_proxy.so\nLoadModule proxy_http_module share/apache/modules/mod_proxy_http.so|' \
    1.17 +		-e 's|#Include /etc/apache/extra/httpd-ssl.conf|Include /etc/apache/extra/httpd-ssl.conf|' \
    1.18 +		-e 's|/etc/apache/server.crt|/etc/ssl/apache/apache.pem|' \
    1.19 +		-e 's|/etc/apache/server.key|/etc/ssl/apache/apache.pem|' \
    1.20 +		$fs/etc/apache/httpd.conf $fs/etc/apache/extra/httpd-ssl.conf
    1.21  	echo "Include /etc/apache/conf.d" >> $fs/etc/apache/httpd.conf
    1.22  	# Cook all packages based on apache
    1.23  	for i in $(cd $WOK; ls -d apache-*)
    1.24 @@ -55,7 +60,7 @@
    1.25  pre_install()
    1.26  {
    1.27  	echo "Processing pre-install commands..."
    1.28 -	[ -f /etc/init.d/$PACKAGE ] && /etc/init.d/$PACKAGE stop
    1.29 +	[ -z "$1" ] && [ -f /etc/init.d/$PACKAGE ] && /etc/init.d/$PACKAGE stop
    1.30  }
    1.31  
    1.32  post_install()
    1.33 @@ -65,7 +70,17 @@
    1.34  	chown www.www $1/var/log/$PACKAGE
    1.35  	ping -c 2 $(hostname) > /dev/null 2>&1 || 
    1.36  		sed -i "s/localhost/$(hostname) localhost/" /etc/hosts
    1.37 -	/etc/init.d/$PACKAGE start
    1.38 +	openssl req -new -x509 -keyout $1/etc/ssl/apache/apache.pem \
    1.39 +		-out $1/etc/ssl/apache/apache.pem -days 3650 -nodes <<EOT
    1.40 +$(. /etc/locale.conf ; echo ${LANG#*_})
    1.41 +$(cat /etc/TZ)
    1.42 +
    1.43 +$(cat /etc/hostname)
    1.44 +
    1.45 +
    1.46 +
    1.47 +EOT
    1.48 +	[ -z "$1" ] && /etc/init.d/$PACKAGE start
    1.49  }
    1.50  
    1.51  # Rules to clean extras dirs or files