Skip to content

Commit b5f24ab

Browse files
committed
Fix typo and allow to set SSL cert file only, without a key file
1 parent ba9254a commit b5f24ab

File tree

5 files changed

+44
-25
lines changed

5 files changed

+44
-25
lines changed

5.6/root/usr/share/container-scripts/php/common.sh

+14-8
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function process_extending_config_files() {
9999
done <<<"$(get_matched_files "$custom_dir" "$default_dir" '*.conf' | sort -u)"
100100
}
101101

102-
# Copy config files from application to the location where httd expects them
102+
# Copy config files from application to the location where httpd expects them
103103
# Param sets the directory where to look for files
104104
# This function was taken from httpd container
105105
process_config_files() {
@@ -119,16 +119,22 @@ process_ssl_certs() {
119119
local dir=${1:-.}
120120
if [ -d ${dir}/httpd-ssl/private ] && [ -d ${dir}/httpd-ssl/certs ]; then
121121
echo "---> Looking for SSL certs for httpd..."
122-
cp -r ${dir}/httpd-ssl ${APP_ROOT}
123-
local ssl_cert="$(ls -A ${APP_ROOT}/httpd-ssl/certs/*.pem | head -n 1)"
124-
local ssl_private="$(ls -A ${APP_ROOT}/httpd-ssl/private/*.pem | head -n 1)"
125-
if [ -f "${ssl_cert}" ] && [ -f "${ssl_private}" ]; then
126-
echo "---> Setting SSL certs for httpd..."
122+
cp -r ${dir}/httpd-ssl ${HTTPD_APP_ROOT}
123+
local ssl_cert="$(ls -A ${HTTPD_APP_ROOT}/httpd-ssl/certs/*.pem | head -n 1)"
124+
local ssl_private="$(ls -A ${HTTPD_APP_ROOT}/httpd-ssl/private/*.pem | head -n 1)"
125+
if [ -f "${ssl_cert}" ] ; then
126+
# do sed for SSLCertificateFile and SSLCertificateKeyFile
127+
echo "---> Setting SSL cert file for httpd..."
127128
sed -i -e "s|^SSLCertificateFile .*$|SSLCertificateFile ${ssl_cert}|" ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
128-
sed -i -e "s|^SSLCertificateKeyFile .*$|SSLCertificateKeyFile ${ssl_private}|" ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
129+
if [ -f "${ssl_private}" ]; then
130+
echo "---> Setting SSL key file for httpd..."
131+
sed -i -e "s|^SSLCertificateKeyFile .*$|SSLCertificateKeyFile ${ssl_private}|" ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
132+
else
133+
echo "---> Removing SSL key file settings for httpd..."
134+
sed -i '/^SSLCertificateKeyFile .*/d' ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
135+
fi
129136
fi
130137
rm -rf ${dir}/httpd-ssl
131138
fi
132139
}
133140

134-

7.0/root/usr/share/container-scripts/php/common.sh

+14-8
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function process_extending_config_files() {
9999
done <<<"$(get_matched_files "$custom_dir" "$default_dir" '*.conf' | sort -u)"
100100
}
101101

102-
# Copy config files from application to the location where httd expects them
102+
# Copy config files from application to the location where httpd expects them
103103
# Param sets the directory where to look for files
104104
# This function was taken from httpd container
105105
process_config_files() {
@@ -119,16 +119,22 @@ process_ssl_certs() {
119119
local dir=${1:-.}
120120
if [ -d ${dir}/httpd-ssl/private ] && [ -d ${dir}/httpd-ssl/certs ]; then
121121
echo "---> Looking for SSL certs for httpd..."
122-
cp -r ${dir}/httpd-ssl ${APP_ROOT}
123-
local ssl_cert="$(ls -A ${APP_ROOT}/httpd-ssl/certs/*.pem | head -n 1)"
124-
local ssl_private="$(ls -A ${APP_ROOT}/httpd-ssl/private/*.pem | head -n 1)"
125-
if [ -f "${ssl_cert}" ] && [ -f "${ssl_private}" ]; then
126-
echo "---> Setting SSL certs for httpd..."
122+
cp -r ${dir}/httpd-ssl ${HTTPD_APP_ROOT}
123+
local ssl_cert="$(ls -A ${HTTPD_APP_ROOT}/httpd-ssl/certs/*.pem | head -n 1)"
124+
local ssl_private="$(ls -A ${HTTPD_APP_ROOT}/httpd-ssl/private/*.pem | head -n 1)"
125+
if [ -f "${ssl_cert}" ] ; then
126+
# do sed for SSLCertificateFile and SSLCertificateKeyFile
127+
echo "---> Setting SSL cert file for httpd..."
127128
sed -i -e "s|^SSLCertificateFile .*$|SSLCertificateFile ${ssl_cert}|" ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
128-
sed -i -e "s|^SSLCertificateKeyFile .*$|SSLCertificateKeyFile ${ssl_private}|" ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
129+
if [ -f "${ssl_private}" ]; then
130+
echo "---> Setting SSL key file for httpd..."
131+
sed -i -e "s|^SSLCertificateKeyFile .*$|SSLCertificateKeyFile ${ssl_private}|" ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
132+
else
133+
echo "---> Removing SSL key file settings for httpd..."
134+
sed -i '/^SSLCertificateKeyFile .*/d' ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
135+
fi
129136
fi
130137
rm -rf ${dir}/httpd-ssl
131138
fi
132139
}
133140

134-

7.1/root/usr/share/container-scripts/php/common.sh

+14-8
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function process_extending_config_files() {
9999
done <<<"$(get_matched_files "$custom_dir" "$default_dir" '*.conf' | sort -u)"
100100
}
101101

102-
# Copy config files from application to the location where httd expects them
102+
# Copy config files from application to the location where httpd expects them
103103
# Param sets the directory where to look for files
104104
# This function was taken from httpd container
105105
process_config_files() {
@@ -119,16 +119,22 @@ process_ssl_certs() {
119119
local dir=${1:-.}
120120
if [ -d ${dir}/httpd-ssl/private ] && [ -d ${dir}/httpd-ssl/certs ]; then
121121
echo "---> Looking for SSL certs for httpd..."
122-
cp -r ${dir}/httpd-ssl ${APP_ROOT}
123-
local ssl_cert="$(ls -A ${APP_ROOT}/httpd-ssl/certs/*.pem | head -n 1)"
124-
local ssl_private="$(ls -A ${APP_ROOT}/httpd-ssl/private/*.pem | head -n 1)"
125-
if [ -f "${ssl_cert}" ] && [ -f "${ssl_private}" ]; then
126-
echo "---> Setting SSL certs for httpd..."
122+
cp -r ${dir}/httpd-ssl ${HTTPD_APP_ROOT}
123+
local ssl_cert="$(ls -A ${HTTPD_APP_ROOT}/httpd-ssl/certs/*.pem | head -n 1)"
124+
local ssl_private="$(ls -A ${HTTPD_APP_ROOT}/httpd-ssl/private/*.pem | head -n 1)"
125+
if [ -f "${ssl_cert}" ] ; then
126+
# do sed for SSLCertificateFile and SSLCertificateKeyFile
127+
echo "---> Setting SSL cert file for httpd..."
127128
sed -i -e "s|^SSLCertificateFile .*$|SSLCertificateFile ${ssl_cert}|" ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
128-
sed -i -e "s|^SSLCertificateKeyFile .*$|SSLCertificateKeyFile ${ssl_private}|" ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
129+
if [ -f "${ssl_private}" ]; then
130+
echo "---> Setting SSL key file for httpd..."
131+
sed -i -e "s|^SSLCertificateKeyFile .*$|SSLCertificateKeyFile ${ssl_private}|" ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
132+
else
133+
echo "---> Removing SSL key file settings for httpd..."
134+
sed -i '/^SSLCertificateKeyFile .*/d' ${HTTPD_MAIN_CONF_D_PATH}/ssl.conf
135+
fi
129136
fi
130137
rm -rf ${dir}/httpd-ssl
131138
fi
132139
}
133140

134-

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Versions
2121
PHP versions currently supported are:
2222
* [php-5.6](5.6)
2323
* [php-7.0](7.0)
24+
* [php-7.1](7.1)
2425

2526
RHEL versions currently supported are:
2627
* RHEL7

common

0 commit comments

Comments
 (0)