https не работает с моим установленным ssl (apache 2.4.25 и letsencrypt) - PullRequest
0 голосов
/ 01 декабря 2018

Я пытаюсь установить ssl на свой веб-сайт впервые и не могу запустить его.Я установил certbot на свой хост и установил letsencrypt сертификаты для веб-сайтов 5: site3.ru 6: dav.site3.ru 7: www.site3.ru

И теперь site3.ru совершенно не работает как по http, так и по https,dav.site3.ru работает, но только с http.

apachectl -v
Server version: Apache/2.4.25 (Debian)
# uname -a
Linux debian 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux
# cat /etc/debian_version
9.5



root@debian:/home/schel4ok# apt-get install python-certbot-apache -t stretch-backports
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  python-certbot-apache
1 upgraded, 0 newly installed, 0 to remove and 97 not upgraded.
Need to get 3,810 B of archives.
After this operation, 3,072 B of additional disk space will be used.
Get:1 http://deb.debian.org/debian stretch-backports/main amd64 python-certbot-apache all 0.28.0-1~bpo9+1 [3,810 B]
Fetched 3,810 B in 0s (22.0 kB/s)
Reading changelogs... Done
(Reading database ... 67111 files and directories currently installed.)
Preparing to unpack .../python-certbot-apache_0.28.0-1~bpo9+1_all.deb ...
Unpacking python-certbot-apache (0.28.0-1~bpo9+1) over (0.25.0-2~bpo9+1) ...
Setting up python-certbot-apache (0.28.0-1~bpo9+1) ...
root@debian:/home/schel4ok# certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache

Which names would you like to activate HTTPS for?
-------------------------------------------------------------------------------
1: site1.lan
2: www.site1.lan
3: site2.ru
4: www.site2.ru
5: site3.ru
6: dav.site3.ru
7: www.site3.ru
-------------------------------------------------------------------------------
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 5 6 7

-------------------------------------------------------------------------------
You have an existing certificate that contains a portion of the domains you
requested (ref: /etc/letsencrypt/renewal/dav.site3.ru.conf)

It contains these names: dav.site3.ru

You requested these names for the new certificate: site3.ru,
dav.site3.ru, www.site3.ru.

Do you want to expand and replace this existing certificate with the new
certificate?
-------------------------------------------------------------------------------
(E)xpand/(C)ancel: e
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for site3.ru
tls-sni-01 challenge for dav.site3.ru
http-01 challenge for www.site3.ru
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. dav.site3.ru (tls-sni-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Timeout during connect (likely firewall problem)

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: dav.site3.ru
   Type:   connection
   Detail: Timeout during connect (likely firewall problem)

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address. Additionally, please check that
   your computer has a publicly routable IP address and that no
   firewalls are preventing the server from communicating with the
   client. If you're using the webroot plugin, you should also verify
   that you are serving files from the webroot path you provided.
root@debian:/home/schel4ok# certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache

Which names would you like to activate HTTPS for?
-------------------------------------------------------------------------------
1: site1.lan
2: www.site1.lan
3: site2.ru
4: www.site2.ru
5: site3.ru
6: dav.site3.ru
7: www.site3.ru
-------------------------------------------------------------------------------
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 7
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for www.site3.ru
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/site3-le-ssl.conf
Deploying Certificate to VirtualHost /etc/apache2/sites-available/site3-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/site3-le-ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/site3.conf to ssl vhost in /etc/apache2/sites-available/site3-le-ssl.conf

-------------------------------------------------------------------------------
Congratulations! You have successfully enabled https://www.site3.ru

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=www.site3.ru
-------------------------------------------------------------------------------

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/www.site3.ru/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/www.site3.ru/privkey.pem
   Your cert will expire on 2019-03-01. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

root@debian:/home/schel4ok# certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log

-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/dav.site3.ru.conf
-------------------------------------------------------------------------------
Cert not due for renewal, but simulating renewal for dry run
Plugins selected: Authenticator apache, Installer apache
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for dav.site3.ru
Waiting for verification...
Cleaning up challenges

-------------------------------------------------------------------------------
new certificate deployed with reload of apache server; fullchain is
/etc/letsencrypt/live/dav.site3.ru/fullchain.pem
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/www.site3.ru.conf
-------------------------------------------------------------------------------
Cert not due for renewal, but simulating renewal for dry run
Plugins selected: Authenticator apache, Installer apache
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for www.site3.ru
Waiting for verification...
Cleaning up challenges

-------------------------------------------------------------------------------
new certificate deployed with reload of apache server; fullchain is
/etc/letsencrypt/live/www.site3.ru/fullchain.pem
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
** DRY RUN: simulating 'certbot renew' close to cert expiry
**          (The test certificates below have not been saved.)

Congratulations, all renewals succeeded. The following certs have been renewed:
  /etc/letsencrypt/live/dav.site3.ru/fullchain.pem (success)
  /etc/letsencrypt/live/www.site3.ru/fullchain.pem (success)
** DRY RUN: simulating 'certbot renew' close to cert expiry
**          (The test certificates above have not been saved.)
-------------------------------------------------------------------------------

IMPORTANT NOTES:
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
root@debian:/home/schel4ok#

. В этот момент я проверил, что https не работает, и заметил, что мои conf-файлы, созданные certbot, не содержат строку 'SSLEngine на '.Затем я добавляю эту строку, но https все еще не работает.Вот как выглядит мой конф.

/etc/apache2/sites-enabled/site3.conf
<VirtualHost *:80>
    ServerName site3.ru
    ServerAlias www.site3.ru
    ServerAdmin admin@site3.ru
    DocumentRoot /var/www/site3
    DirectoryIndex index.html index.htm index.php

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

  RewriteEngine on
  RewriteCond %{SERVER_NAME} =www.site3.ru [OR]
  RewriteCond %{SERVER_NAME} =site3.ru
  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

/etc/apache2/sites-enabled/site3-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName site3.ru
    ServerAlias www.site3.ru
    ServerAdmin admin@site3.ru
    DocumentRoot /var/www/site3
    DirectoryIndex index.html index.htm index.php

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

  SSLEngine on
  SSLCertificateFile /etc/letsencrypt/live/www.site3.ru/fullchain.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/www.site3.ru/privkey.pem
  Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>



/etc/apache2/sites-enabled/dav.conf
<VirtualHost *:80>
        ServerName dav.site3.ru
        ServerAlias dav.site3.ru
        DocumentRoot /var/www/dav/html
        DirectoryIndex index.html index.htm index.php

        <Directory "/var/www/dav/html">
                Options None
                Options +FollowSymlinks
                AllowOverride All
                # Confiugration for apache-2.4:
                Require all granted
        </Directory>
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

/etc/apache2/sites-enabled/dav-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName dav.site3.ru
        ServerAlias dav.site3.ru
        DocumentRoot /var/www/dav/html
        DirectoryIndex index.html index.htm index.php

        <Directory "/var/www/dav/html">
                Options None
                Options +FollowSymlinks
                AllowOverride All
                Require all granted
        </Directory>

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

SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/dav.site3.ru/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/dav.site3.ru/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
...