Skip to content
This repository was archived by the owner on Jun 1, 2020. It is now read-only.

Commit 93fe871

Browse files
committed
allow the use of a separate ca chain file
1 parent dc7b2d5 commit 93fe871

File tree

12 files changed

+49
-8
lines changed

12 files changed

+49
-8
lines changed

comanage-registry-base/comanage_utils.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ function comanage_utils::consume_injected_environment() {
103103
COMANAGE_REGISTRY_VIRTUAL_HOST_FQDN
104104
HTTPS_CERT_FILE
105105
HTTPS_PRIVKEY_FILE
106+
HTTPS_CHAIN_FILE
106107
SERVER_NAME
107108
)
108109

@@ -333,6 +334,7 @@ EOF
333334
# Globals:
334335
# HTTPS_CERT_FILE
335336
# HTTPS_PRIVKEY_FILE
337+
# HTTPS_CHAIN_FILE
336338
# Arguments:
337339
# None
338340
# Returns:
@@ -347,10 +349,14 @@ function comanage_utils::prepare_https_cert_key() {
347349
if [[ -e '/etc/debian_version' ]]; then
348350
cert_path='/etc/apache2/cert.pem'
349351
privkey_path='/etc/apache2/privkey.pem'
352+
chain_path='/etc/apache2/ca-chain.pem'
353+
ssl_conf_file='/etc/apache2/sites-available/000-comanage.conf'
350354
web_user='www-data'
351355
elif [[ -e '/etc/centos-release' ]]; then
352356
cert_path='/etc/httpd/cert.pem'
353357
privkey_path='/etc/httpd/privkey.pem'
358+
chain_path='/etc/httpd/ca-chain.pem'
359+
ssl_conf_file='/etc/httpd/conf.d/000-comanage.conf'
354360
web_user='apache'
355361
fi
356362

@@ -374,6 +380,21 @@ function comanage_utils::prepare_https_cert_key() {
374380
echo "Copied HTTPS private key file ${HTTPS_PRIVKEY_FILE} to ${privkey_path}" > "$OUTPUT"
375381
echo "Set ownership of ${privkey_path} to ${web_user}" > "$OUTPUT"
376382
fi
383+
384+
# If a chain file is defined, use configured location of the Apache HTTP
385+
# Server certificate chain and uncomment the SSLCertificateChainFile
386+
# option from the apache config file
387+
if [[ -n "${HTTPS_CHAIN_FILE}" ]]; then
388+
rm -f "${chain_path}"
389+
cp "${HTTPS_CHAIN_FILE}" "${chain_path}"
390+
chown "${web_user}" "${chain_path}"
391+
chmod 0644 "${chain_path}"
392+
sed -i -e 's/^#SSLCertificateChainFile/SSLCertificateChainFile' ${ssl_config_file}
393+
sed -i -e "s/%%CHAIN_PATH%%/${chain_path}" ${ssl_config_file}
394+
echo "Copied HTTPS CA Chain file ${HTTPS_CHAIN_FILE} to ${chain_path}" > "$OUTPUT"
395+
echo "Set ownership of ${chain_path} to ${web_user}" > "$OUTPUT"
396+
echo "Configured apache to use SSLCertificateChainFile=${chain_path}" > "$OUTPUT"
397+
fi
377398
}
378399

379400
##########################################

comanage-registry-basic-auth/000-comanage.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Include apache-include-virtual-host-port443-base
2525

2626
SSLCertificateFile /etc/apache2/cert.pem
2727
SSLCertificateKeyFile /etc/apache2/privkey.pem
28+
#SSLCertificateChainFile %%CHAIN_PATH%%
2829

2930
ErrorLog ${APACHE_LOG_DIR}/error.log
3031
CustomLog ${APACHE_LOG_DIR}/access.log combined

comanage-registry-basic-auth/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ stderr of the container.
120120

121121
## HTTPS Configuration
122122

123-
See the section on environment variables and the `HTTPS_CERT_FILE` and
124-
`HTTPS_PRIVKEY_FILE` variables.
123+
See the section on environment variables and the `HTTPS_CERT_FILE`,
124+
`HTTPS_PRIVKEY_FILE`, and `HTTPS_CHAIN_FILE` variables.
125125

126126
Additionally you may bind mount or COPY in an X.509 certificate file (containing the CA signing certificate(s), if any)
127127
and associated private key file. For example

comanage-registry-internet2-tier/000-comanage.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Include apache-include-virtual-host-port443-base
3030

3131
SSLCertificateFile /etc/httpd/cert.pem
3232
SSLCertificateKeyFile /etc/httpd/privkey.pem
33+
#SSLCertificateChainFile %%CHAIN_PATH%%
3334

3435
PassEnv ENV
3536
PassEnv USERTOKEN

comanage-registry-internet2-tier/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ The logging configuration meets version 1 of the
147147

148148
## HTTPS Configuration
149149

150-
See the section on environment variables and the `HTTPS_CERT_FILE` and
151-
`HTTPS_PRIVKEY_FILE` variables.
150+
See the section on environment variables and the `HTTPS_CERT_FILE`,
151+
`HTTPS_PRIVKEY_FILE`, and `HTTPS_CHAIN_FILE` variables.
152152

153153
Additionally you may bind mount or COPY in an X.509 certificate file (containing the CA signing certificate(s), if any)
154154
and associated private key file. For example

comanage-registry-mailman/apache-shib/httpd.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ TransferLog /proc/self/fd/1
118118
SSLEngine on
119119
SSLCertificateFile "/usr/local/apache2/conf/server.crt"
120120
SSLCertificateKeyFile "/usr/local/apache2/conf/server.key"
121+
#SSLCertificateChainFile "/usr/local/apache2/conf/ca-chain.crt"
121122

122123
BrowserMatch "MSIE [2-5]" \
123124
nokeepalive ssl-unclean-shutdown \

comanage-registry-mailman/apache-shib/start.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ if [ -n "${HTTPS_CERT_FILE}" ] && [ -n "${HTTPS_KEY_FILE}" ]; then
5555
chmod 600 /usr/local/apache2/conf/server.key
5656
fi
5757

58+
# Copy HTTPS chain file into place.
59+
if [ -n "${HTTPS_CHAIN_FILE}" ]; then
60+
cp "${HTTPS_CHAIN_FILE}" /usr/local/apache2/conf/ca-chain.crt
61+
chmod 644 /usr/local/apache2/conf/ca-chain.crt
62+
sed -i -e 's/^#SSLCertificateChainFile/SSLCertificateChainFile' /usr/local/apache2/conf/httpd.conf
63+
fi
64+
5865
# Wait for the mailman core container to be ready.
5966
until nc -z -w 1 "${MAILMAN_CORE_HOST}" "${MAILMAN_CORE_PORT}"
6067
do

comanage-registry-mod-auth-openidc/000-comanage.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Include apache-include-virtual-host-port443-base
2525

2626
SSLCertificateFile /etc/apache2/cert.pem
2727
SSLCertificateKeyFile /etc/apache2/privkey.pem
28+
#SSLCertificateChainFile %%CHAIN_PATH%%
2829

2930
ErrorLog ${APACHE_LOG_DIR}/error.log
3031
CustomLog ${APACHE_LOG_DIR}/access.log combined

comanage-registry-mod-auth-openidc/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ stderr of the container.
139139

140140
## HTTPS Configuration
141141

142-
See the section on environment variables and the `HTTPS_CERT_FILE` and
143-
`HTTPS_PRIVKEY_FILE` variables.
142+
See the section on environment variables and the `HTTPS_CERT_FILE`,
143+
`HTTPS_PRIVKEY_FILE`, and `HTTPS_CHAIN_FILE` variables.
144144

145145
Additionally you may bind mount or COPY in an X.509 certificate file (containing the CA signing certificate(s), if any)
146146
and associated private key file. For example

comanage-registry-shibboleth-sp/000-comanage.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Include apache-include-virtual-host-port443-base
2525

2626
SSLCertificateFile /etc/apache2/cert.pem
2727
SSLCertificateKeyFile /etc/apache2/privkey.pem
28+
#SSLCertificateChainFile %%CHAIN_PATH%%
2829

2930
ErrorLog ${APACHE_LOG_DIR}/error.log
3031
CustomLog ${APACHE_LOG_DIR}/access.log combined

0 commit comments

Comments
 (0)