Created
August 8, 2022 09:31
-
-
Save pankpan/42ddc587caa7bee354f50472ab929588 to your computer and use it in GitHub Desktop.
Apache ssl.conf modify, sslconf.sh {cert} {key} {chain}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z $2 ] ; then | |
echo "`basename $0` {cert} {key} {chain}" | |
else | |
SSL_CONF=/etc/httpd/conf.d/ssl.conf | |
if [ -f $SSL_CONF ] ; then | |
if [ -f $1 ] ; then # cert | |
sed -i "s/^SSLCertificateFile.*/SSLCertificateFile \/etc\/httpd\/conf.d\/$1/" $SSL_CONF | |
fi | |
if [ -f $2 ] ; then # cert | |
sed -i "s/^SSLCertificateKeyFile.*/SSLCertificateKeyFile \/etc\/httpd\/conf.d\/$2/" $SSL_CONF | |
fi | |
if [ -n "$3" ] ; then # chain | |
if [ -f $3 ] ; then | |
sed -i "s/^#*SSLCertificateChainFile.*/SSLCertificateChainFile \/etc\/httpd\/conf.d\/$3/" $SSL_CONF | |
fi | |
fi | |
else | |
echo "$SSL_CONF not found" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment