summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/http
diff options
context:
space:
mode:
Diffstat (limited to 'sca-cpp/trunk/modules/http')
-rw-r--r--sca-cpp/trunk/modules/http/Makefile.am6
-rwxr-xr-xsca-cpp/trunk/modules/http/httpd-conf43
-rwxr-xr-xsca-cpp/trunk/modules/http/httpd-ssl-conf68
-rwxr-xr-xsca-cpp/trunk/modules/http/proxy-conf40
-rwxr-xr-xsca-cpp/trunk/modules/http/proxy-member-conf33
-rwxr-xr-xsca-cpp/trunk/modules/http/proxy-ssl-conf70
-rwxr-xr-xsca-cpp/trunk/modules/http/proxy-ssl-member-conf33
-rwxr-xr-xsca-cpp/trunk/modules/http/proxy-test37
-rwxr-xr-xsca-cpp/trunk/modules/http/ssl-ca-conf1
-rwxr-xr-xsca-cpp/trunk/modules/http/ssl-cert-conf6
-rwxr-xr-xsca-cpp/trunk/modules/http/ssl-ls25
-rwxr-xr-xsca-cpp/trunk/modules/http/vhost-conf47
-rwxr-xr-xsca-cpp/trunk/modules/http/vhost-ssl-conf49
13 files changed, 401 insertions, 57 deletions
diff --git a/sca-cpp/trunk/modules/http/Makefile.am b/sca-cpp/trunk/modules/http/Makefile.am
index f25ef170c9..17fd8ac3c7 100644
--- a/sca-cpp/trunk/modules/http/Makefile.am
+++ b/sca-cpp/trunk/modules/http/Makefile.am
@@ -20,7 +20,7 @@ INCLUDES = -I${HTTPD_INCLUDE}
incl_HEADERS = *.hpp
incldir = $(prefix)/include/modules/http
-dist_mod_SCRIPTS = httpd-conf httpd-start httpd-stop httpd-restart ssl-ca-conf ssl-cert-conf httpd-ssl-conf
+dist_mod_SCRIPTS = httpd-conf httpd-start httpd-stop httpd-restart ssl-ca-conf ssl-cert-conf httpd-ssl-conf proxy-conf proxy-ssl-conf proxy-member-conf proxy-ssl-member-conf vhost-conf vhost-ssl-conf
moddir=$(prefix)/modules/http
curl_test_SOURCES = curl-test.cpp
@@ -43,7 +43,7 @@ httpd-modules.prefix: $(top_builddir)/config.status
curl.prefix: $(top_builddir)/config.status
echo ${CURL_PREFIX} >curl.prefix
-dist_noinst_SCRIPTS = httpd-test http-test
+dist_noinst_SCRIPTS = httpd-test http-test proxy-test
noinst_PROGRAMS = curl-test curl-get
-TESTS = httpd-test http-test
+TESTS = httpd-test http-test proxy-test
diff --git a/sca-cpp/trunk/modules/http/httpd-conf b/sca-cpp/trunk/modules/http/httpd-conf
index 70c0b295af..149bc56c4d 100755
--- a/sca-cpp/trunk/modules/http/httpd-conf
+++ b/sca-cpp/trunk/modules/http/httpd-conf
@@ -19,6 +19,7 @@
# Generate a minimal HTTPD configuration
here=`readlink -f $0`; here=`dirname $here`
+mkdir -p $1
root=`readlink -f $1`
host=$2
port=`echo $3 | awk -F "/" '{ print $1 }'`
@@ -26,19 +27,20 @@ pport=`echo $3 | awk -F "/" '{ print $2 }'`
if [ "$pport" = "" ]; then
pport=$port
fi
+mkdir -p $4
htdocs=`readlink -f $4`
user=`id -un`
group=`id -gn`
modules_prefix=`cat $here/httpd-modules.prefix`
-vhost=$5
mkdir -p $root
mkdir -p $root/logs
mkdir -p $root/conf
cat >$root/conf/httpd.conf <<EOF
+# Generated by: httpd-conf $*
# Apache HTTPD server configuration
-# Set server name
+# Main server name
ServerName http://$host:$pport
PidFile $root/logs/httpd.pid
@@ -114,37 +116,40 @@ Allow from all
# Allow access to service components
<Location />
Options FollowSymLinks
+Order deny,allow
Allow from all
</Location>
-# Setup HTTP virtual hosts
+# Setup HTTP virtual host
Listen $port
<VirtualHost *:$port>
ServerName http://$host:$pport
-UseCanonicalName Off
+
+Include conf/svhost.conf
</VirtualHost>
EOF
-# Generate mass dynamic virtual hosting configuration
-if [ "$vhost" = "vhost" ]; then
-
-cat >>$root/conf/httpd.conf <<EOF
-# Setup mass dynamic virtual hosting
-NameVirtualHost *:$port
-
-<VirtualHost *:$port>
-ServerName http://vhost.$host:$pport
-ServerAlias *.$host
+# Generate vhost configuration
+cat >$root/conf/vhost.conf <<EOF
+# Generated by: httpd-conf $*
+# Virtual host configuration
UseCanonicalName Off
-VirtualDocumentRoot $htdocs/domains/%1/
-</VirtualHost>
-# Isolate virtual host based requests
-MaxRequestsPerChild 1
+EOF
+
+cat >$root/conf/svhost.conf <<EOF
+# Generated by: httpd-conf $*
+# Static virtual host configuration
+Include conf/vhost.conf
EOF
-fi
+cat >$root/conf/dvhost.conf <<EOF
+# Generated by: httpd-conf $*
+# Mass dynamic virtual host configuration
+Include conf/vhost.conf
+
+EOF
diff --git a/sca-cpp/trunk/modules/http/httpd-ssl-conf b/sca-cpp/trunk/modules/http/httpd-ssl-conf
index 118ed708be..f2f8b01614 100755
--- a/sca-cpp/trunk/modules/http/httpd-ssl-conf
+++ b/sca-cpp/trunk/modules/http/httpd-ssl-conf
@@ -20,21 +20,24 @@
# Generate a minimal HTTPD SSL configuration
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
-host=$2
-sslport=`echo $3 | awk -F "/" '{ print $1 }'`
-sslpport=`echo $3 | awk -F "/" '{ print $2 }'`
+conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
+host=`echo $conf | awk '{ print $6 }'`
+port=`echo $conf | awk '{ print $7 }' | awk -F "/" '{ print $1 }'`
+sslport=`echo $2 | awk -F "/" '{ print $1 }'`
+sslpport=`echo $2 | awk -F "/" '{ print $2 }'`
if [ "$sslpport" = "" ]; then
sslpport=$sslport
fi
-htdocs=`readlink -f $4`
+htdocs=`echo $conf | awk '{ print $8 }'`
+htdocs=`readlink -f $htdocs`
httpd_prefix=`cat $here/httpd.prefix`
-vhost=$5
# Extract organization name from our CA certificate
org=`openssl x509 -noout -subject -nameopt multiline -in $root/conf/ca.crt | grep organizationName | awk -F "= " '{ print $2 }'`
# Generate HTTPD configuration
cat >>$root/conf/httpd.conf <<EOF
+# Generated by: httpd-ssl-conf $*
# Redirect all HTTP traffic to HTTPS
<Location />
RewriteEngine on
@@ -52,27 +55,20 @@ SSLMutex "file:$root/logs/ssl_mutex"
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
-# Setup HTTPS virtual hosts
+# Setup HTTPS virtual host
Listen $sslport
-SSLCACertificateFile "$root/conf/ca.crt"
-SSLCertificateFile "$root/conf/server.crt"
-SSLCertificateKeyFile "$root/conf/server.key"
-
<VirtualHost *:$sslport>
ServerName https://$host:$sslpport
-UseCanonicalName Off
-# Enable SSL
-Include conf/ssl-vhost.conf
+Include conf/ssl-svhost.conf
# Allow the server admin to view the server status
<Location /server-status>
SetHandler server-status
HostnameLookups on
Deny from All
-Allow from localhost
-Allow from $host
+Allow from all
Require user admin
</Location>
@@ -81,13 +77,14 @@ Require user admin
# Report extended server status
ExtendedStatus On
-# Route all wiring through HTTPS
-SCAWiringServerName https://$host:$sslpport
-
EOF
-# Generate VirtualHost SSL configuration
+# Generate HTTPS vhost configuration
cat >$root/conf/ssl-vhost.conf <<EOF
+# Generated by: httpd-ssl-conf $*
+# Virtual host configuration
+UseCanonicalName Off
+
# Enable SSL
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
@@ -119,31 +116,32 @@ Require valid-user
EOF
-# Generate mass dynamic virtual hosting configuration
-if [ "$vhost" = "vhost" ]; then
+cat >$root/conf/ssl-svhost.conf <<EOF
+# Generated by: httpd-ssl-conf $*
+# Static virtual host configuration
+Include conf/ssl-vhost.conf
-cat >>$root/conf/httpd.conf <<EOF
-# Setup mass dynamic virtual hosting
-NameVirtualHost *:$sslport
-SSLStrictSNIVHostCheck Off
+# Configure SSL certificates
+SSLCACertificateFile "$root/conf/ca.crt"
+SSLCertificateChainFile "$root/conf/ca.crt"
+SSLCertificateFile "$root/conf/server.crt"
+SSLCertificateKeyFile "$root/conf/server.key"
-<VirtualHost *:$sslport>
-ServerName https://vhost.$host:$sslpport
-ServerAlias *.$host
-UseCanonicalName Off
-VirtualDocumentRoot $htdocs/domains/%1/
+EOF
-# Enable SSL
+cat >$root/conf/ssl-dvhost.conf <<EOF
+# Mass dynamic virtual host configuration
+# Generated by: httpd-ssl-conf $*
+Include conf/ssl-vhost.conf
+
+# Configure SSL certificates
SSLCACertificateFile "$root/conf/ca.crt"
+SSLCertificateChainFile "$root/conf/ca.crt"
SSLCertificateFile "$root/conf/vhost.crt"
SSLCertificateKeyFile "$root/conf/vhost.key"
-Include conf/ssl-vhost.conf
-</VirtualHost>
EOF
-fi
-
# Create test users for HTTP basic authentication
$httpd_prefix/bin/htpasswd -bc $root/conf/httpd.passwd test test 2>/dev/null
$httpd_prefix/bin/htpasswd -b $root/conf/httpd.passwd admin admin 2>/dev/null
diff --git a/sca-cpp/trunk/modules/http/proxy-conf b/sca-cpp/trunk/modules/http/proxy-conf
new file mode 100755
index 0000000000..4970950623
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/proxy-conf
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Generate a minimal HTTPD proxy balancer configuration
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+
+cat >>$root/conf/vhost.conf <<EOF
+# Generated by: proxy-conf $*
+# Configure HTTP proxy and balancer
+ProxyRequests Off
+ProxyPreserveHost On
+ProxyStatus On
+
+ProxyPass / balancer://cluster/
+
+<Proxy balancer://cluster>
+Order deny,allow
+Allow from all
+ProxySet lbmethod=byrequests
+</Proxy>
+
+EOF
+
diff --git a/sca-cpp/trunk/modules/http/proxy-member-conf b/sca-cpp/trunk/modules/http/proxy-member-conf
new file mode 100755
index 0000000000..73c448c065
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/proxy-member-conf
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Add a proxy balancer member
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+host=$2
+port=`echo $3 | awk -F "/" '{ print $1 }'`
+
+cat >>$root/conf/vhost.conf <<EOF
+# Generated by: proxy-member-conf $*
+# Add proxy balancer member
+BalancerMember balancer://cluster http://$host:$port
+ProxyPassReverse / http://$host:$port/
+
+EOF
+
diff --git a/sca-cpp/trunk/modules/http/proxy-ssl-conf b/sca-cpp/trunk/modules/http/proxy-ssl-conf
new file mode 100755
index 0000000000..bc1b63fc7d
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/proxy-ssl-conf
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Generate a minimal HTTPD proxy balancer configuration
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+
+cat >>$root/conf/ssl-vhost.conf <<EOF
+# Generated by: proxy-ssl-conf $*
+# Enable SSL proxy
+SSLProxyEngine on
+SSLProxyCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
+
+# Configure proxy and balancer
+ProxyRequests Off
+ProxyPreserveHost On
+ProxyStatus On
+
+ProxyPass /balancer-manager !
+ProxyPass / balancer://sslcluster/
+
+<Proxy balancer://sslcluster>
+Order deny,allow
+Allow from all
+ProxySet lbmethod=byrequests
+</Proxy>
+
+# Enable balancer manager
+<Location /balancer-manager>
+SetHandler balancer-manager
+HostnameLookups on
+Deny from all
+Allow from all
+Require user admin
+</Location>
+
+EOF
+
+cat >>$root/conf/ssl-svhost.conf <<EOF
+# Generated by: proxy-ssl-conf $*
+# Setup SSL proxy certificates
+SSLProxyCACertificateFile "$root/conf/ca.crt"
+SSLProxyMachineCertificateFile "$root/conf/server.pem"
+
+EOF
+
+cat >>$root/conf/ssl-dvhost.conf <<EOF
+# Generated by: proxy-ssl-conf $*
+# Setup SSL proxy certificates
+SSLProxyCACertificateFile "$root/conf/ca.crt"
+SSLProxyMachineCertificateFile "$root/conf/server.pem"
+
+EOF
+
diff --git a/sca-cpp/trunk/modules/http/proxy-ssl-member-conf b/sca-cpp/trunk/modules/http/proxy-ssl-member-conf
new file mode 100755
index 0000000000..9f20933e35
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/proxy-ssl-member-conf
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Add a proxy balancer member
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+host=$2
+sslport=`echo $3 | awk -F "/" '{ print $1 }'`
+
+cat >>$root/conf/ssl-vhost.conf <<EOF
+# Generated by: proxy-ssl-member-conf $*
+# Add proxy balancer member
+BalancerMember balancer://sslcluster https://$host:$sslport
+ProxyPassReverse / https://$host:$sslport/
+
+EOF
+
diff --git a/sca-cpp/trunk/modules/http/proxy-test b/sca-cpp/trunk/modules/http/proxy-test
new file mode 100755
index 0000000000..b6c9a6a0d9
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/proxy-test
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Setup
+./httpd-conf tmp localhost 8091/8090 htdocs
+./httpd-start tmp
+./httpd-conf tmp/proxy localhost 8090 tmp/proxy/htdocs
+./proxy-conf tmp/proxy
+./proxy-member-conf tmp/proxy localhost 8091
+./httpd-start tmp/proxy
+sleep 2
+
+# Test
+./curl-test
+rc=$?
+
+# Cleanup
+./httpd-stop tmp/proxy
+./httpd-stop tmp
+sleep 2
+return $rc
diff --git a/sca-cpp/trunk/modules/http/ssl-ca-conf b/sca-cpp/trunk/modules/http/ssl-ca-conf
index c5a3f8e894..b3c6dbbfa0 100755
--- a/sca-cpp/trunk/modules/http/ssl-ca-conf
+++ b/sca-cpp/trunk/modules/http/ssl-ca-conf
@@ -19,6 +19,7 @@
# Generate a test certification authority certificate
here=`readlink -f $0`; here=`dirname $here`
+mkdir -p $1
root=`readlink -f $1`
host=$2
diff --git a/sca-cpp/trunk/modules/http/ssl-cert-conf b/sca-cpp/trunk/modules/http/ssl-cert-conf
index a7a1103d1a..959b5059e1 100755
--- a/sca-cpp/trunk/modules/http/ssl-cert-conf
+++ b/sca-cpp/trunk/modules/http/ssl-cert-conf
@@ -19,6 +19,7 @@
# Generate a test certificate
here=`readlink -f $0`; here=`dirname $here`
+mkdir -p $1
root=`readlink -f $1`
host=$2
if [ "$3" != "" ]; then
@@ -61,3 +62,8 @@ openssl ca -batch -config $root/conf/openssl-ca.conf -out $root/conf/$certname.c
# Export it to PKCS12 format, that's the format Web browsers want to import
openssl pkcs12 -export -passout pass: -out $root/conf/$certname.p12 -inkey $root/conf/$certname.key -in $root/conf/$certname.crt -certfile $root/conf/ca.crt
+# Convert the certificate to PEM format and concatenate the key to it, for use
+# by mod_proxy
+openssl x509 -in $root/conf/$certname.crt -out $root/conf/$certname.pem
+cat $root/conf/$certname.key >> $root/conf/$certname.pem
+
diff --git a/sca-cpp/trunk/modules/http/ssl-ls b/sca-cpp/trunk/modules/http/ssl-ls
new file mode 100755
index 0000000000..71d40719ca
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/ssl-ls
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Generate a test certification authority certificate
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+
+ls $root/conf/*.crt $root/conf/*.key $root/conf/*.pem $root/conf/*.p12 2>/dev/null
+
diff --git a/sca-cpp/trunk/modules/http/vhost-conf b/sca-cpp/trunk/modules/http/vhost-conf
new file mode 100755
index 0000000000..e49a1cd415
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/vhost-conf
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Generate mass dynamic virtual hosting configuration
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
+host=`echo $conf | awk '{ print $6 }'`
+port=`echo $conf | awk '{ print $7 }' | awk -F "/" '{ print $1 }'`
+pport=`echo $conf | awk '{ print $7 }' | awk -F "/" '{ print $2 }'`
+if [ "$pport" = "" ]; then
+ pport=$port
+fi
+htdocs=`echo $conf | awk '{ print $8 }'`
+htdocs=`readlink -f $htdocs`
+
+cat >>$root/conf/httpd.conf <<EOF
+# Generated by: vhost-conf $*
+# Setup mass dynamic virtual hosting
+NameVirtualHost *:$port
+
+<VirtualHost *:$port>
+ServerName http://vhost.$host:$pport
+ServerAlias *.$host
+VirtualDocumentRoot $htdocs/domains/%1/
+
+Include conf/dvhost.conf
+</VirtualHost>
+
+EOF
+
diff --git a/sca-cpp/trunk/modules/http/vhost-ssl-conf b/sca-cpp/trunk/modules/http/vhost-ssl-conf
new file mode 100755
index 0000000000..8a660278a3
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/vhost-ssl-conf
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Generate mass dynamic virtual hosting configuration
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
+host=`echo $conf | awk '{ print $6 }'`
+sslconf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-ssl-conf"`
+sslport=`echo $sslconf | awk '{ print $6 }' | awk -F "/" '{ print $1 }'`
+sslpport=`echo $sslconf | awk '{ print $6 }' | awk -F "/" '{ print $2 }'`
+if [ "$sslpport" = "" ]; then
+ sslpport=$sslport
+fi
+htdocs=`echo $conf | awk '{ print $8 }'`
+htdocs=`readlink -f $htdocs`
+
+cat >>$root/conf/httpd.conf <<EOF
+# Generated by: vhost-ssl-conf $*
+# Setup mass dynamic virtual hosting
+NameVirtualHost *:$sslport
+SSLStrictSNIVHostCheck Off
+
+<VirtualHost *:$sslport>
+ServerName https://vhost.$host:$sslpport
+ServerAlias *.$host
+VirtualDocumentRoot $htdocs/domains/%1/
+
+Include conf/ssl-dvhost.conf
+</VirtualHost>
+
+EOF
+