How to add new subdomain on my certificat

Hello,
I’m sorry beforehand for my language level, I am French.

Yesterday I managed to install “let’s encrypt” on my VPS as you can see it on my site:
www.makibear.fr
But today I would have like adding my sub-domain, eduowl.makibear.fr in the certificate because as you can see him, he is not in HTTPS.
Would you be how I have to make?
I have at present 3 files in my /etc/apache2/sites-available :

  • default-ssl.conf
  • 000-default.conf
  • 000-default-le-ssl.conf

When I tried to renew the certificate by adding my subdomain, I had an error:

Failed authorization procedure. eduowl.makibear.fr (tls-sni-01): urn:acme:error:malformed :: The request message was malformed :: Server only speaks HTTP, not TLS

IMPORTANT NOTES:

  • The following errors were reported by the server:

    Domain: eduowl.makibear.fr
    Type: malformed
    Detail: Server only speaks HTTP, not TLS

    To fix these errors, please make sure that you did not provide any
    invalid information to the client, and try running Certbot again.

Thank you in advance.
MakiBearDY!

Files:

  • default-ssl.conf


    ServerAdmin webmaster@localhost

      DocumentRoot /var/www
    
      # 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
    
      #   SSL Engine Switch:
      #   Enable/Disable SSL for this virtual host.
      SSLEngine on
    
      #   A self-signed (snakeoil) certificate can be created by installing
      #   the ssl-cert package. See
      #   /usr/share/doc/apache2/README.Debian.gz for more info.
      #   If both key and certificate are stored in the same file, only the
      #   SSLCertificateFile directive is needed.
      SSLCertificateFile	/etc/ssl/certs/ssl-cert-snakeoil.pem
      SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.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/server-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/ssl/certs/
      #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
    
      #   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
    
      #   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: `*****************'.
      #   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
    

vim: syntax=apache ts=4 sw=4 sts=4 sr noet

  • 000-default.conf
    <VirtualHost *:80>

    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 www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www

    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} =makibear.fr [OR]
    RewriteCond %{SERVER_NAME} =www.makibear.fr
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

<VirtualHost 66.70.188.171>
ServerName eduowl.makibear.fr
DocumentRoot “/var/www/Eduowl”

vim: syntax=apache ts=4 sw=4 sts=4 sr noet

  • 000-default-le-ssl.conf

    <VirtualHost *:443>

    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 www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www

    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

SSLCertificateFile /etc/letsencrypt/live/www.makibear.fr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.makibear.fr/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
ServerName www.makibear.fr
ServerAlias makibear.fr

I think there is some other problem because the existing server is speaking HTTP, not HTTPS, on port 443 (which is what is preventing the challenge from completing).

@MakiBearDY, what made you say that https://www.makibear.fr/ was working properly? Did it work correctly before and then stop working?

Can you perhaps run grep -r 443 /etc/apache2 to see if there are any other configuration files that are potentially listening on port 443?

@schoen Yes, the site works fine just before I try to add the subdomain, I do not understand why makibear.fr no longer works. Now I have this error: ERR_SSL_PROTOCOL_ERROR. Still, I renewed “Let’s Encrypt” without the subdomain.

And, when I try your command, I have this one:

root@vps137760:~# grep -r 443 /etc/apache2
/etc/apache2/sites-available/default-ssl.conf:  <VirtualHost _default_:443>
/etc/apache2/sites-available/000-default-le-ssl.conf:<VirtualHost *:443>
/etc/apache2/ports.conf:        Listen 443
/etc/apache2/ports.conf:        Listen 443

@SwartzCr @bmw, could one of you please take a look at this? I’m a little unsure why this server is speaking HTTP on port 443 under these circumstances.

Can you show all in:
/etc/apache2/sites-enabled/

@rg305 I have screen the repertory /etc/apache2/sites-enabled/

Does
/etc/apache2/sites-enabled/000-default-le-ssl.conf
contain “SSLEngine On” ?

@rg305, that is normally supposed to be handled by the

Include /etc/letsencrypt/options-ssl-apache.conf

directive. In turn, that file should contain SSLEngine on as well as other TLS-related directives. (But this would be good to check in this case.)

I ask because, I see “SSLEngine on” in the “default-ssl.conf” file but not in the “000-default-le-ssl.conf” file.

site-available contains:

  • default-ssl.conf (NOT linked ?)
  • 000-default.conf (linked)
  • 000-default-le-ssl.conf (linked)

sites-enabled contains:

  • phpmyadmin.conf ???
  • 000-default.conf (port 80 only)
  • 000-default-le-ssl.conf (missing “SSLEngine On”)

@rg305 No it does not contain it, you can watch, I attach you to the file.

<VirtualHost *:443>
# 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 www.example.com

	ServerAdmin webmaster@localhost
	DocumentRoot /var/www

	# 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


SSLCertificateFile /etc/letsencrypt/live/www.makibear.fr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.makibear.fr/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
ServerName www.makibear.fr
ServerAlias makibear.fr
</VirtualHost>
</IfModule>

Try:
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/www.makibear.fr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.makibear.fr/privkey.pem

then restart Apache2:
sudo service apache2 restart

Can you see if SSLEngine on appears in /etc/letsencrypt/options-ssl-apache.conf? It should!

@schoen Yes, SSLEngine on appears in options-ssl-apache.conf.
@rg305 I have add SSLEngine on in /etc/apache2/sites-enabled/000-default-le-ssl.conf. But its does not seem to work. I don’t know.

What does
sites-enabled/phpmyadmin.conf
link to?
Does it affect SSL?

Also show all of:
/etc/letsencrypt/options-ssl-apache.conf

This file ends with “</ifModule>” but you don’t show where that “<ifModule ???>” starts…
Whole “IF” Seems unnecessary.

@rg305 phpmyadmin.conf in sites-enabled is:
# phpMyAdmin default Apache configuration

Alias /phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin>
    Options SymLinksIfOwnerMatch
    DirectoryIndex index.php

    <IfModule mod_php5.c>
        <IfModule mod_mime.c>
            AddType application/x-httpd-php .php
        </IfModule>
        <FilesMatch ".+\.php$">
            SetHandler application/x-httpd-php
        </FilesMatch>

        php_value include_path .
        php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
        php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
        php_admin_value mbstring.func_overload 0
    </IfModule>
    <IfModule mod_php.c>
        <IfModule mod_mime.c>
            AddType application/x-httpd-php .php
        </IfModule>
        <FilesMatch ".+\.php$">
            SetHandler application/x-httpd-php
        </FilesMatch>

        php_value include_path .
        php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
        php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
        php_admin_value mbstring.func_overload 0
    </IfModule>

</Directory>

# Authorize for setup
<Directory /usr/share/phpmyadmin/setup>
    <IfModule mod_authz_core.c>
        <IfModule mod_authn_file.c>
            AuthType Basic
            AuthName "phpMyAdmin Setup"
            AuthUserFile /etc/phpmyadmin/htpasswd.setup
        </IfModule>
        Require valid-user
    </IfModule>
</Directory>

# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/templates>
    Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/libraries>
    Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
    Require all denied
</Directory> 

And /etc/letsencrypt/options-ssl-apache.conf is:

# This file contains important security parameters. If you modify this file
# manually, Certbot will be unable to automatically provide future security
# updates. Instead, Certbot will print and log an error message with a path to
# the up-to-date file that you will need to refer to when manually updating
# this file.

SSLEngine on

# Intermediate configuration, tweak to your needs
SSLProtocol             all -SSLv2 -SSLv3
SSLCipherSuite          ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA
SSLHonorCipherOrder     on
SSLCompression          off

SSLOptions +StrictRequire

# Add vhost name to log entries:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined
LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common

#CustomLog /var/log/apache2/access.log vhost_combined
#LogLevel warn
#ErrorLog /var/log/apache2/error.log

# Always ensure Cookies have "Secure" set (JAH 2012/1)
#Header edit Set-Cookie (?i)^(.*)(;\s*secure)??((\s*;)?(.*)) "$1; Secure$3$4"
<IfModule mod_ssl.c>
<VirtualHost *:443>
	# 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 www.example.com

	ServerAdmin webmaster@localhost
	DocumentRoot /var/www

	# 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

SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/www.makibear.fr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.makibear.fr/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
ServerName www.makibear.fr
ServerAlias makibear.fr
</VirtualHost>
</IfModule>

I can’t find any errors…
please show:
netstat -nap tcp | grep 443

@rg305 I have:

root@vps137760:~# netstat -nap tcp | grep 443
tcp6       0      0 :::443                  :::*                    LISTEN      4212/apache2

Domain at IPv4:
Name: www.makibear.fr
Address: 66.70.188.171

Your running config at IPv6:
tcp6 0 0 :::443 :::* LISTEN 4212/apache2

Does IPv4 66.70.188.171 connect to your internal IPv6 address???

ifconfig -a | grep addr: | grep -v 127.0.0.1
netstat -nap tcp | grep :80