[csw-devel] SF.net SVN: gar:[11784] csw/mgar/pkg/apache2/trunk/files/ssl_cas_template

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Sun Dec 5 04:23:14 CET 2010


Revision: 11784
          http://gar.svn.sourceforge.net/gar/?rev=11784&view=rev
Author:   bdwalton
Date:     2010-12-05 03:23:14 +0000 (Sun, 05 Dec 2010)

Log Message:
-----------
apache2: add a script that will handle migrating server.{crt,key} using the build CAS

Added Paths:
-----------
    csw/mgar/pkg/apache2/trunk/files/ssl_cas_template

Added: csw/mgar/pkg/apache2/trunk/files/ssl_cas_template
===================================================================
--- csw/mgar/pkg/apache2/trunk/files/ssl_cas_template	                        (rev 0)
+++ csw/mgar/pkg/apache2/trunk/files/ssl_cas_template	2010-12-05 03:23:14 UTC (rev 11784)
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+PIR=${PKG_INSTALL_ROOT:-/}
+AP2_DIR=/opt/csw/apache2
+AP2_CONF=$PIR/etc/opt/csw/apache2
+OLD_CONF=$PIR/$AP2_DIR/etc
+
+NEW_CERT_FILE=$AP2_CONF/server.crt
+NEW_KEY_FILE=$AP2_CONF/server.key
+OLD_CERT_FILE=$OLD_CONF/server.crt
+OLD_KEY_FILE=$OLD_CONF/server.key
+
+if [ "$1" = install ]; then
+   if [ -f "$NEW_CERT_FILE" ]; then
+      echo "SSL key files in place already.  Doing nothing." >&2
+   elif [ -f "$OLD_CERT_FILE" ]; then
+      # migrate old files.
+      echo "Importing old SSL files from /opt/csw/apache2/etc." >&2
+      cp -p $OLD_CERT_FILE $NEW_CERT_FILE
+      cp -p $OLD_KEY_FILE $NEW_KEY_FILE
+   else
+      echo Generating dummy ssl key and certificate... >&2
+      # this is likely overkill for a dummy cert, but why not
+      cat <<EOF | /usr/sbin/chroot ${PIR} /opt/csw/bin/openssl req -new -newkey rsa:1024 -days 365 -nodes -x509 -keyout /etc/opt/csw/apache2/server.key  -out /etc/opt/csw/apache2/server.crt >/dev/null 2>&1
+TS
+Westfarthing
+Hobbiton
+
+
+`hostname`
+bilbo at example.net
+
+
+EOF
+     chown root:bin $NEW_CERT_FILE $NEW_KEY_FILE
+   fi
+
+   cat <<EOF
+This is a placeholder file used only to ease migration of server.crt
+and server.key to the new etc/ location for $PKGINST.  Please leave the
+file in place, but ignore it otherwise.
+EOF
+fi


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list