summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2014-06-23 17:49:10 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2014-06-23 17:49:10 +0000
commit3a120e0422d6a71a93a49a8b6492fd6e57f3fd28 (patch)
tree59267f33167b6c324c2d729c1bfd2de02ff5658f /bin
parentf3e5e4bebdbac803d749762a4852b757230382f3 (diff)
Search for ssl files
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@674 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ldap2apache30
1 files changed, 22 insertions, 8 deletions
diff --git a/bin/ldap2apache b/bin/ldap2apache
index 7170ed6..87b1b94 100755
--- a/bin/ldap2apache
+++ b/bin/ldap2apache
@@ -181,17 +181,31 @@ clients.each{ |c|
"/usr/share/php/smarty/libs" ].map { |d| File.exists?(d) ? d : nil }.compact.join ':'
if ssl
- crtfile = "/etc/ssl/certs/apache-#{server_name}.pem"
- chainfile = "/etc/ssl/certs/apache-#{server_name}-chain.pem"
- keyfile = "/etc/ssl/private/apache-#{server_name}.key"
- STDERR.puts "Warning: #{crtfile} does not exist" unless FileTest.exists?(crtfile)
- STDERR.puts "Warning: #{keyfile} does not exist" unless FileTest.exists?(keyfile)
+ crtfiles = [
+ "/etc/ssl/certs/apache-#{server_name}.pem",
+ "/etc/ssl/certs/apache-#{server_name}.crt",
+ "/etc/ssl/certs/#{server_name}.pem",
+ "/etc/ssl/certs/#{server_name}.crt",
+ ].select{ |i| FileTest.exists?(i) }
+ chainfiles = [
+ "/etc/ssl/certs/apache-#{server_name}-chain.pem",
+ "/etc/ssl/certs/apache-#{server_name}-chain.crt",
+ "/etc/ssl/certs/#{server_name}-chain.pem",
+ "/etc/ssl/certs/#{server_name}-chain.crt",
+ "/etc/ssl/certs/#{server_name}.chain",
+ ].select{ |i| FileTest.exists?(i) }
+ keyfiles = [
+ "/etc/ssl/private/apache-#{server_name}.key",
+ "/etc/ssl/private/#{server_name}.key",
+ ].select{ |i| FileTest.exists?(i) }
+ STDERR.puts "Warning: No crtfiles exist" unless crtfiles.length()
+ STDERR.puts "Warning: No keyfiles exist" unless keyfiles.length()
config << make_vhostline(bind, bindhttpsport)
config << " SSLEngine on"
- config << " SSLCertificateFile #{crtfile}"
- config << " SSLCertificateKeyFile #{keyfile}"
- config << " SSLCertificateChainFile #{chainfile}" if FileTest.exists?(chainfile)
+ config << " SSLCertificateFile #{crtfiles.first}" if crtfiles.length() > 0
+ config << " SSLCertificateKeyFile #{keyfiles.first}" if keyfiles.length() > 0
+ config << " SSLCertificateChainFile #{chainfiles.first}" if chainfiles.length() > 0
config << ' <Files ~ "\.php$">'
config << ' SSLOptions +StdEnvVars'
config << ' </Files>'