diff options
Diffstat (limited to 'bin/ldap2apache')
-rwxr-xr-x | bin/ldap2apache | 30 |
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>' |