【问题标题】:Why is Apache serving a new certificate and an expired one?为什么 Apache 提供新证书和过期证书?
【发布时间】:2017-09-16 00:31:04
【问题描述】:

由于这是一个敏感的客户项目,我所说的域名的所有使用都被替换为“example.com”。

我正在管理一个最近过期的 Let's Encrypt 证书的公共网站。所以我按照 DigitalOcean 教程here 并使用certbot-auto renew 更新证书(是的,我后来运行了sudo service apache2 reload)。它起作用了,但问题是该站点现在同时提供新证书和过期证书,并且似乎发生了随机选择。有时该站点受到浏览器的信任,因为它收到了新的证书,有时浏览器会拒绝过期的证书。即使通过SSL Labs analyzer 运行该站点,有时也会给出 A 级,有时会失败。

当我的配置显式仅包含新证书时,可能会导致继续使用这两个证书的原因是什么?我很困惑。

现在运行 certbot-auto renew 会得到这个结果:

Saving debug log to /var/log/letsencrypt/letsencrypt.log

-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/example.com.conf
-------------------------------------------------------------------------------
Cert not yet due for renewal

The following certs are not due for renewal yet:
  /etc/letsencrypt/live/example.com/fullchain.pem (skipped)
No renewals were attempted

Apache 启用站点的目录如下所示:

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

每个的配置如下:

000-default.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    <Directory /var/www/html/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

000-default-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    <Directory /var/www/html/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
ServerName example.com
</VirtualHost>
</IfModule>

【问题讨论】:

    标签: apache ssl https ubuntu-14.04 lets-encrypt


    【解决方案1】:

    我可以通过调用sudo service apache2 stop 来停止apache,然后运行ps aux | grep apache 来解决这个问题。我发现有多个 apache 实例正在运行。所以我杀了他们并重新启动了 apache,现在一切正常。

    【讨论】:

    • 您每 3 个月执行一次,还是有更好的解决方案?
    猜你喜欢
    • 2015-09-25
    • 1970-01-01
    • 2020-05-01
    • 2019-11-13
    • 1970-01-01
    • 1970-01-01
    • 2020-05-20
    • 2017-12-15
    • 2015-05-15
    相关资源
    最近更新 更多