Apache2 vhosts domain and subdomain certificate problems

Ok, so your certificate now includes both domain names

DNS Name: acegames.de
DNS Name: www.acegames.de

so that's working as expected. - good :slight_smile:

1 Like

$ certbot-auto --apache -d acegames.de -d www.acegames.de -d status.acegames.de

lqqqqqqqqqqqqqqqqqqqqqqqq
x Saving debug log to /var/log/letsencrypt/letsencrypt.log
x Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
x Obtaining a new certificate
x Performing the following challenges:
x tls-sni-01 challenge for acegames.de
x tls-sni-01 challenge for www.acegames.de
x tls-sni-01 challenge for status.acegames.de
x Waiting for verification...
x Cleaning up challenges
mqqqqqqqqqqqqqqqqqqqqqq

Failed authorization procedure. status.acegames.de (tls-sni-01): urn:acme:error:unauthorized :: The client lacks
sufficient authorization :: Incorrect validation certificate for TLS-SNI-01 challenge. Requested
cbc848356e6910dcf8449dbba6c5acb6.1dbcf1f1cbbd922878d7e8ba5cac1182.acme.invalid from 137.74.140.78:443.
Received certificate containing 'dummy,
059f15b2f20053caf0b3f4bbe4f69485.d8267e5a91003c860c27163b540acf29.acme.invalid'

IMPORTANT NOTES:

  • The following errors were reported by the server:

Domain: status.acegames.de
Type: unauthorized
Detail: Incorrect validation certificate for TLS-SNI-01 challenge.
Requested
cbc848356e6910dcf8449dbba6c5acb6.1dbcf1f1cbbd922878d7e8ba5cac1182.acme.invalid
from 137.74.140.78:443. Received certificate containing 'dummy,
059f15b2f20053caf0b3f4bbe4f69485.d8267e5a91003c860c27163b540acf29.acme.invalid'

To fix these errors, please make sure that your domain name was
entered correctly and the DNS A record(s) for that domain
contain(s) the right IP address.

jep...looks bad for the magic.

/var/log/letsencrypt/letsencrypt.log:

http://download.acegames.de/lets-log.txt

It looks as if you have an invalid config in apache for status.acegames.de - it’s using http there, not https ( you can check this by going to http://status.acegames.de:443 and you will get a http response - not a https response )

You should check your apache config for the subdomains.

/etc/apache2/sites-available/000-default.conf

# The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. ServerName http://acegames.de

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ServerAlias www.acegames.de

Available loglevels: trace8, ..., trace1, debug, info, notice, warn,

error, crit, alert, emerg.

It is also possible to configure the loglevel for particular

modules, e.g.

#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

For most configuration files from conf-available/, which are

enabled or disabled at a global level, it is possible to

include a line for only one particular virtual host. For example the

following line enables the CGI configuration for this host only

after it has been globally disabled with "a2disconf".

#Include conf-available/serve-cgi-bin.conf
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.acegames.de [OR]
RewriteCond %{SERVER_NAME} =acegames.de
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]

/etc/apache2/sites-available/003-status.acegames.de.conf

# The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. ServerName http://status.acegames.de

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/status

Available loglevels: trace8, ..., trace1, debug, info, notice, warn,

error, crit, alert, emerg.

It is also possible to configure the loglevel for particular

modules, e.g.

#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

For most configuration files from conf-available/, which are

enabled or disabled at a global level, it is possible to

include a line for only one particular virtual host. For example the

following line enables the CGI configuration for this host only

after it has been globally disabled with "a2disconf".

#Include conf-available/serve-cgi-bin.conf

hm... seems like i've forgotten about the http-to-https-rewriter i built in a few months ago

hm... but the error hasnt gone away.
the ony thing that happens is that now http is automaticly rewritten to https but there is no certificate, because the error when creating it for something other than/and acegames.de/www.acegames.de remains.

ERR_SSL_PROTOCOL_ERROR
when i try to load one of my sites in chrome.

I was just thinking of the 000-default-le-ssl.conf wich is created when creating a cert... please correct me if im wrong but isnt this the ssl configuration only for acegames.de and www.acegames.de (000-default.conf)? So should it create files like this for 003-status.acegames.de.conf too? i dont really know where the error when creating a cert for any other than acegames.de/www.acegames.de comes from but it seems a bit suspicious to me that it is called that way and what is written in it. What about copying and testing if a 003-status.acegames.de-le-ssl.conf will have a positive effect on creating a cert for it.

That depends what "it" is :wink:

The default file "000-default.conf" is usually what it says - the default. i.e. what would be used for all domains, if it's not over-ridden by another file.

The naming of 003-status.acegames.de.conf sounds as if you have a control panel / configuration manager of some sort ( people don't usually add numbers to their configs, hence I'm guessing that you didn't name / create that file yourself). if so then that control panel / configuration manager could create the SSL config - if you tell it to. If not then you need to create the config ( or turn off the forwarding (http to https) for those subdomians.

sorry i meant I not it :joy:
these are my selfwritten vhost files… the number at the front of the name is only for me to help me searching and to make the autofill in putty easier

status.acegames.de is the same as this letsencrypt.status.io site in a more simple way

this 000-default-le-ssl.conf was automaticly generated by certbot-auto.
and i wondered if it could help when i create one for (for example) status.acegames.de and try the certificate-creation again. because of the fact that tis file manages parts of the ssl.

Ok, makes sense :slight_smile:

You either need to remove the redirect to https for all domains ( temporarily for now - this is probably the easiest option ) or add a self signed cert and configure https for the subdomain.

Removed the Rewrite-Engine in every vhost and commented out in one.

But this is interesting too:

/etc/apache2/sites-available/default-ssl.conf

[IfModule mod_ssl.c]
[VirtualHost default:443]
ServerAdmin webmaster@localhost

  DocumentRoot /var/www/html
  #LogLevel info ssl:warn
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
  #Include conf-available/serve-cgi-bin.conf
  #   SSL Engine Switch:
  #   Enable/Disable SSL for this virtual host.
  SSLEngine on
  SSLCertificateFile	/etc/letsencrypt/live/acegames.de/cert.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/acegames/privkey.pem
  #SSLCertificateChainFile /etc/letsencrypt/live/acegames.de/chain.pem
  #   Certificate Authority (CA):
  #SSLCACertificatePath /etc/ssl/certs/
  #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
  #   Certificate Revocation Lists (CRL):
  #SSLCARevocationPath /etc/apache2/ssl.crl/
  #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl
  #   Client Authentication (Type):
  #SSLVerifyClient require
  #SSLVerifyDepth  10
  #   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 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)$"] 
  		SSLOptions +StdEnvVars
  [/FilesMatch] 
  [Directory /usr/lib/cgi-bin] 
  		SSLOptions +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-6]" \
  		nokeepalive ssl-unclean-shutdown \
  		downgrade-1.0 force-response-1.0
  # MSIE 7 and newer should be able to use keepalive
  BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

[/VirtualHost]
[/IfModule]

sorry but the brackets are standing for these < >

the certificates named in this file dont exist...

I dont know what to do on this file.

i cant disable ssl for port 443 and i cant put in a certificate that exists but doesnt include any of my subdomains (about 9 subdomains…). but the configuration is definetly wrong and i think this is the reason why i get the SSL_POROTOCOL_ERROR in chrome.

The protocol error issue is because Apache HTTPd isn’t serving a proper certificate, as those files don’t exist. If you can’t just comment out all the lines for the VirtualHost block in default-ssl.conf, you could make a self-signed certificate and use the cert and pk for the SSLCertificateFile and SSLCertificateKeyFile lines to get rid of the protocol error issue.

i have commented out the certificates in this file. nothing changes. (i have restarted apache…).

A summary of the problem we want to fix here:

Via letsencrypt i cannot create a certificate for my other virtual hosts than the default-vhost and its alias. This is because letsencrypt tries to visit the vhosts via port 443 and the default-vhost and its alias switch to https without any problems. The other vhosts dont switch to https and then the error comes up. I tryed to put in and tryed to remove the http-to-https-Rewrite-Engine in all vhosts. but nothing changed. even without the Rewrite-Engine every vhost except for one (clouds.acegames.de), which i created some hours ago, automaticly switch to https and i cant disable it. the main problem is that i cant figure out why this Rewrite-Engine is active even if it has been deleted and the Webserver has been restarted several times. More confusing is that the one vhost i just created isnt affected by it.

ive just restarted the Vserver again.
I think i should no longer believe in any logic :grimacing:

All my vhosts: (0=no https rewrite+no error; 1=with https rewrite)

[ 0 ] phpmyadmin.acegames.de
[ 0 ] acegames.de
[ 0 ] www.acegames.de
[ 0 ] clouds.acegames.de
[ 0 ] ts.acegames.de
[ 0 ] en.ts.acegames.de
[ 0 ] en.status.acegames.de
[ 0 ] en.acegames.de
[ 0 ] download.acegames.de
[ 0 ] mailboxes.acegames.de
[ 0 ] wiki.acegames.de
[ 0 ] admin.acegames.de

[ 1 ] cloud.acegames.de
[ 1 ] status.acegames.de
[ 1 ] files.acegames.de

this makes no sense. not even a bit. i’ll restart it again and test them again… :neutral_face:

restarted but nothing more has changed

Do you have rewrites in .htaccess files in those other sub-domains ?

i looked up the .htacces file in the owncloud directory (cloud.acegames.de and clouds.acegames.de and files.acegames.de),
no theres nothing. And even if there was anything, it wouldnt have been activated because i am able to access the site via clouds.acegames.de with normal http.

the other site (status.acegames.de) ist just a regular index.html file. Nothing more up to now.

Sorry, I took your list in the page above to mean that those 3 subdomains were directing to https. I didn’t check them. Having just checked, they aren’t redirecting to https on those, it’s just that you have the server listing http on port 443

Now you aren’t redirecting to https, can you obtain certificates OK for all those domains ?

i will test that in a couple soconds but i wonder why the http listens to port 443 only in these 3 cases. shouldnt that be fixed so that domain+subdomains are all equal in ssl configuration?

if:

certbot-auto --apache -d acegames.de -d www.acegames.de -d cloud.acegames.de

then:

if:

certbot-auto --apache -d acegames.de -d www.acegames.de -d download.acegames.de

then:

same error with download.acegames.de

OK, then the only thing I can think is pretty much as before - either stop listening on port 443, or provide https on port 443.

If you are unsure on exactly where you are listening on port 443 - I’d suggest starting with a grep of port 443 on all your apache config files … alternatively upload them all to pastebin.com so we can review them.

So i’ve visited pastebin.com
if you wish other configs too, just ask me for them.

/etc/apache2/mods-enabled/ssl.conf = http://pastebin.com/iTLD1cSm

/etc/apache2/sites-enabled/ = http://pastebin.com/78GVGrw4

/etc/apache2/apache2.conf = http://pastebin.com/uNrV27XW

/etc/apache2/envvars = http://pastebin.com/fzJSiDyW

/etc/apache2/ports.conf = http://pastebin.com/zRaeyiUY

/etc/letsencrypt/cli.ini = noting in it…

/etc/letsencrypt/options-ssl-apache.conf = http://pastebin.com/YXtpiUg5