logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Nightmare getting SSL to work on Apache 2.4.6-6.23.1 on Suse
Author
ted.byers



Joined: 03 Jan 2013
Posts: 19

PostPosted: Tue 29 Jul '14 18:30    Post subject: Nightmare getting SSL to work on Apache 2.4.6-6.23.1 on Suse Reply with quote

OS is OpenSuse 13.1
Yast shows the installed version of Apache2 as 2.4.6-6.23.1

I created my own CA, and used that to create a server certificate. The CA crtificate (in PEM format), and the server key and certificate have been placed in the appropriate directories in /etc/apache2 (the key in ssl.key and the certificates in ssl.crt).

When I check the status, after restarting apache, I see an error claiming that socache_shmcb_module is not installed and that it is ignored. This is, of course wrong, as I included that module in /etc/sysconfig/apache2, and the appropriate LoadModule statement in the Loadmodule.conf file (with the proper full path - /usr/lib64/apache2). This error is the only error I see on the server.

When I connect from my workstation, Firefox says:
Quote:
An error occurred during a connection to gremlin.site. SSL received a record that exceeded the maximum permissible length. (Error code: ssl_error_rx_record_too_long)
On the other hand, Chrome tells me:
Quote:
SSL connection error

Unable to make a secure connection to the server. This may be a problem with the server, or it may be requiring a client authentication certificate that you don't have.
Error code: ERR_SSL_PROTOCOL_ERROR


When I google these errors, I find myself spinning my wheels, getting tonnes of ancient pages, or pages that deal with almost anything other than Apache 2.4.6 on OpenSuse 13.1

Please note, that on this workstation, both Firefox and Chrome have no trouble connecting to other servers using SSL, so I suspect the problem in on the server configuration. I can post the contents of the various configuration files, but there are lots of them and most are irrelevant I think. I do not want to overwhelm this post by posting a lot of useless material. Tell me what files you need to see, and I will post them.

Any information that helps solve this would be greatly appreciated.

Thanks

Ted
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Wed 30 Jul '14 14:46    Post subject: Reply with quote

Do you use the right port? Do you have separate vhosts? One port 80 the other port 443?

What does sudo apache2ctl -S show?
Back to top
ted.byers



Joined: 03 Jan 2013
Posts: 19

PostPosted: Wed 30 Jul '14 17:07    Post subject: Reply with quote

Thanks James.
James Blond wrote:
Do you use the right port? Do you have separate vhosts? One port 80 the other port 443?

Yes, of course.

What does sudo apache2ctl -S show?

Quote:

ted@gremlin:~/SSLwork> sudo /usr/sbin/apache2ctl -S
root's password:
VirtualHost configuration:
*:80 is a NameVirtualHost
default server gremlin.site (/etc/apache2/vhosts.d/vhost.conf:15)
port 80 namevhost gremlin.site (/etc/apache2/vhosts.d/vhost.conf:15)
port 80 namevhost gremlin.site (/etc/apache2/vhosts.d/vhost.conf:15)
port 80 namevhost gremlin.site (/etc/apache2/vhosts.d/vhost.conf:15)
port 80 namevhost gremlin.site (/etc/apache2/vhosts.d/vhost.conf:15)
ServerRoot: "/srv/www"
Main DocumentRoot: "/srv/www/htdocs"
Main ErrorLog: "/var/log/apache2/error_log"
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/run/" mechanism=default
Mutex mpm-accept: using_defaults
PidFile: "/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="wwwrun" id=30
Group: name="www" id=8
ted@gremlin:~/SSLwork>

This is disturbing.

Why is there no mention of anything in /etc/apache2/vhosts.d/vhost-ssl.conf?

Here are the contents of that file:
Quote:
# Template for a VirtualHost with SSL
# Note: to use the template, rename it to /etc/apache2/vhost.d/yourvhost.conf.
# Files must have the .conf suffix to be loaded.
#
# See /usr/share/doc/packages/apache2/README.QUICKSTART for further hints
# about virtual hosts.

# NameVirtualHost statements should be added to /etc/apache2/listen.conf.

#
# This is the Apache server configuration file providing SSL support.
# It contains the configuration directives to instruct the server how to
# serve pages over an https connection. For detailing information about these
# directives see http://httpd.apache.org/docs/2.2/mod/mod_ssl.html
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#

<IfDefine SSL>
<IfDefine !NOSSL>

##
## SSL Virtual Host Context
##

<VirtualHost _default_:443 127.0.0.2:443 127.0.0.1:443 192.168.2.8:443 >
ServerAdmin r.ted.byers@gmail.com
ServerName gremlin.site
DocumentRoot /srv/www/vhosts/gremlin.site

# General setup for the virtual host
#DocumentRoot "/srv/www/htdocs"
#ServerName www.example.com:443
#ServerAdmin webmaster@example.com
# ErrorLog /var/log/apache2/error_log
# TransferLog /var/log/apache2/access_log
ErrorLog /var/log/apache2/gremlin.site-error_log
CustomLog /var/log/apache2/gremlin.site-access_log combined

# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on

# SSL protocols
# Supporting TLS only is adequate nowadays
SSLProtocol all -SSLv2

# SSL Cipher Suite:
# List the ciphers that the client is permitted to negotiate.
# See the mod_ssl documentation for a complete list.
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5

SSLVerifyClient optional
SSLVerifyDepth 10
SSLOptions +ExportCertData +StdEnvVars

# Speed-optimized SSL Cipher configuration:
# If speed is your main concern (on busy HTTPS servers e.g.),
# you might want to force clients to specific, performance
# optimized ciphers. In this case, prepend those ciphers
# to the SSLCipherSuite list, and enable SSLHonorCipherOrder.
# Caveat: by giving precedence to RC4-SHA and AES128-SHA
# (as in the example below), most connections will no longer
# have perfect forward secrecy - if the server's key is
# compromised, captures of past or future traffic must be
# considered compromised, too.
#SSLCipherSuite RC4-SHA:AES128-SHA:HIGH:MEDIUM:!aNULL:!MD5
#SSLHonorCipherOrder on

# Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate. If
# the certificate is encrypted, then you will be prompted for a
# pass phrase. Note that a kill -HUP will prompt again. Keep
# in mind that if you have both an RSA and a DSA certificate you
# can configure both in parallel (to also allow the use of DSA
# ciphers, etc.) --- default had 'server' where I have 'gremlin.site'
SSLCertificateFile /etc/apache2/ssl.crt/gremlin.site.crt
#SSLCertificateFile /etc/apache2/ssl.crt/server-dsa.crt

# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you've both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile /etc/apache2/ssl.key/gremlin.site.key
#SSLCertificateKeyFile /etc/apache2/ssl.key/server-dsa.key

# Server Certificate Chain:
# Point SSLCertificateChainFile at a file containing the
# concatenation of PEM encoded CA certificates which form the
# certificate chain for the server certificate. Alternatively
# the referenced file can be the same as SSLCertificateFile
# when the CA certificates are directly appended to the server
# certificate for convinience.
#SSLCertificateChainFile /etc/apache2/ssl.crt/ca.crt

# Certificate Authority (CA):
# Set the CA certificate verification path where to find CA
# certificates for client authentication or alternatively one
# huge file containing all of them (file must be PEM encoded)
# Note: Inside SSLCACertificatePath you need hash symlinks
# to point to the certificate files. Use the provided
# Makefile to update the hash symlinks after changes.
SSLCACertificatePath /etc/apache2/ssl.crt
#SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
SSLCACertificateFile /etc/apache2/ssl.crt/rootCA.pem

# Certificate Revocation Lists (CRL):
# Set the CA revocation path where to find CA CRLs for client
# authentication or alternatively one huge file containing all
# of them (file must be PEM encoded)
# Note: Inside SSLCARevocationPath you need hash symlinks
# to point to the certificate files. Use the provided
# Makefile to update the hash symlinks after changes.
#SSLCARevocationPath /etc/apache2/ssl.crl
#SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl

# Client Authentication (Type):
# Client certificate verification type and depth. Types are
# none, optional, require and optional_no_ca. Depth is a
# number which specifies how deeply to verify the certificate
# issuer chain before deciding the certificate is not valid.
#SSLVerifyClient require
#SSLVerifyDepth 10

# Access Control:
# With SSLRequire you can do per-directory access control based
# on arbitrary complex boolean expressions containing server
# variable checks and other lookup directives. The syntax is a
# mixture between C and Perl. See the mod_ssl documentation
# for more details.
#<Location />
#SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
# and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
# and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
# and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
# and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \
# or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
#</Location>

# SSL Engine Options:
# Set various options for the SSL engine.
# o FakeBasicAuth:
# Translate the client X.509 into a Basic Authorisation. This means that
# the standard Auth/DBMAuth methods can be used for access control. The
# user name is the `one line' version of the client's X.509 certificate.
# Note that no password is obtained from the user. Every entry in the user
# file needs this password: `xxj31ZMTZzkVA'.
# o ExportCertData:
# This exports two additional environment variables: SSL_CLIENT_CERT and
# SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
# server (always existing) and the client (only existing when client
# authentication is used). This can be used to import the certificates
# into CGI scripts.
# o StdEnvVars:
# This exports the standard SSL/TLS related `SSL_*' environment variables.
# Per default this exportation is switched off for performance reasons,
# because the extraction step is an expensive operation and is usually
# useless for serving static content. So one usually enables the
# exportation for CGI and SSI requests only.
# o StrictRequire:
# This denies access when "SSLRequireSSL" or "SSLRequire" applied even
# under a "Satisfy any" situation, i.e. when it applies access is denied
# and no other module can change it.
# o OptRenegotiate:
# This enables optimized SSL connection renegotiation handling when SSL
# directives are used in per-directory context.
#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
<FilesMatch "\.(cgi|shtml|phtml|php|pl)$">
SSLOptions +StdEnvVars
</FilesMatch>
ScriptAlias /cgi-bin/ "/srv/www/vhosts/gremlin.site/cgi-bin/"
<Directory "/srv/www/vhosts/gremlin.site/cgi-bin">
# <Directory "/srv/www/cgi-bin">
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
SSLOptions +ExportCertData +StdEnvVars
</Directory>

# SSL Protocol Adjustments:
# The safe and default but still SSL/TLS standard compliant shutdown
# approach is that mod_ssl sends the close notify alert but doesn't wait for
# the close notify alert from client. When you need a different shutdown
# approach you can use one of the following variables:
# o ssl-unclean-shutdown:
# This forces an unclean shutdown when the connection is closed, i.e. no
# SSL close notify alert is send or allowed to received. This violates
# the SSL/TLS standard but is needed for some brain-dead browsers. Use
# this when you receive I/O errors because of the standard approach where
# mod_ssl sends the close notify alert.
# o ssl-accurate-shutdown:
# This forces an accurate shutdown when the connection is closed, i.e. a
# SSL close notify alert is send and mod_ssl waits for the close notify
# alert of the client. This is 100% SSL/TLS standard compliant, but in
# practice often causes hanging connections with brain-dead browsers. Use
# this only for browsers where you know that their SSL implementation
# works correctly.
# Notice: Most problems of broken clients are also related to the HTTP
# keep-alive facility, so you usually additionally want to disable
# keep-alive for those clients, too. Use variable "nokeepalive" for this.
# Similarly, one has to force some clients to use HTTP/1.0 to workaround
# their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
# "force-response-1.0" for this.
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0

# Per-Server Logging:
# The home of a custom SSL log file. Use this when you want a
# compact non-error SSL logfile on a virtual host basis.
CustomLog /var/log/apache2/ssl_request_log ssl_combined

</VirtualHost>

</IfDefine>
</IfDefine>


Thanks again.

Ted
Back to top
ted.byers



Joined: 03 Jan 2013
Posts: 19

PostPosted: Wed 30 Jul '14 20:03    Post subject: Reply with quote

I learned that apache wasn't attempting to start SSL, because it was somehow omitted from the apache server flags. I corrected that, and now apache won't start. It complains about not being able to bind to port 443, but lsof tells me nothing is listening on 443

And, it also complains about not being able to access the logs.

Any ideas?
Back to top
ted.byers



Joined: 03 Jan 2013
Posts: 19

PostPosted: Wed 30 Jul '14 20:19    Post subject: Reply with quote

Problem solved.

I had multiple Listen statements in listen.conf; one for each IP address on which requests could be received. I had done this following examples I obtained using Google. Obviously that advice was wrong, or at least outdated.

Going to a single listen statement for http and a single listen statement for https (enabled ONLY when apache is configured to use SSL), solved the problem.

Thanks

Ted
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1248
Location: Amsterdam, NL, EU

PostPosted: Wed 30 Jul '14 20:57    Post subject: Reply with quote

Code:
<VirtualHost _default_:443 127.0.0.2:443 127.0.0.1:443 192.168.2.8:443 >

Strange combination. _default_ already covers all IP-adresses...
Back to top
ted.byers



Joined: 03 Jan 2013
Posts: 19

PostPosted: Wed 30 Jul '14 23:14    Post subject: Reply with quote

Jan-E wrote:
Code:
<VirtualHost _default_:443 127.0.0.2:443 127.0.0.1:443 192.168.2.8:443 >

Strange combination. _default_ already covers all IP-adresses...

Indeed. It reflects experimenting based on advice gleaned from the web, by a man who is a programmer, not an administrator. It won't be the first time the advce I gleaned from the web has proven to be wrong. But in this case, it doesn't seem to harm anything.
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1248
Location: Amsterdam, NL, EU

PostPosted: Thu 31 Jul '14 5:30    Post subject: Reply with quote

I surely hope your listen statements weren't based on the same unreliable advice. Multiple listen statements are certainly possible, but something like this is absolutely wrong:
Code:
Listen 443
Listen 127.0.0.2:443
Listen 127.0.0.1:443
Listen 192.168.2.8:443
The generic first line conflicts with the following three.
Back to top
ted.byers



Joined: 03 Jan 2013
Posts: 19

PostPosted: Thu 31 Jul '14 5:37    Post subject: Reply with quote

Jan-E wrote:
I surely hope your listen statements weren't based on the same unreliable advice. Multiple listen statements are certainly possible, but something like this is absolutely wrong:
Code:
Listen 443
Listen 127.0.0.2:443
Listen 127.0.0.1:443
Listen 192.168.2.8:443
The generic first line conflicts with the following three.

Actually it was, but the Listen 443 was commented out, as was the corresponding statement for port 80, and there was about 8 statements like the last three that you show (including both port 80 and port 443). But, curously, the 4 for port 80 were not a problem (at least I got no error referring to them), but those involving port 443 on different IPs, resulted in apache not being able to bind to port 443. I can't explain it, but that is what happened.

Thanks

Ted
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1248
Location: Amsterdam, NL, EU

PostPosted: Thu 31 Jul '14 18:00    Post subject: Reply with quote

I always add :443 to my SSL Servernames and Severaliases as well. That should not mke any difference, but one can never be sure.
http://httpd.apache.org/docs/current/mod/core.html#servername
Back to top


Reply to topic   Topic: Nightmare getting SSL to work on Apache 2.4.6-6.23.1 on Suse View previous topic :: View next topic
Post new topic   Forum Index -> Apache