我无法find任何文档中如何使用letsencrypt为同一个主机名服务不同的站点,具体取决于请求处理的接口。
我有例如这个简单的configuration:
<VirtualHost 10.0.0.3:80> ServerName internalwebsite.example.com ServerAdmin [email protected] DocumentRoot /var/www/internalwebsite.example.com/reachable_from_wan/ ErrorLog ${APACHE_LOG_DIR}/internalwebsite.example.com_error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/internalwebsite.example.com_access.log combined </VirtualHost>
10.3是可从WAN访问的接口,但是我有另一个只能从Intranet访问的接口(10.4),但我希望它具有相同的域名internalwebsite.example.com ,如下所示:
<VirtualHost 10.0.0.3:80> ServerName internalwebsite.example.com ServerAdmin [email protected] DocumentRoot /var/www/internalwebsite.example.com/reachable_from_wan/ ErrorLog ${APACHE_LOG_DIR}/internalwebsite.example.com_error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/internalwebsite.example.com_access.log combined </VirtualHost> <VirtualHost 10.0.0.4:80> ServerName internalwebsite.example.com ServerAdmin [email protected] DocumentRoot /var/www/internalwebsite.example.com/reachable_from_intranet/ ErrorLog ${APACHE_LOG_DIR}/internalwebsite.example.com_error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/internalwebsite.example.com_access.log combined </VirtualHost>
这工作和Apache服务器不同的内容取决于所达到的接口,但:
在我希望生成HTTPS证书的域的certbos列表中(在debian机器上运行letsencrypt命令时), letsencrypt用。
我的目标是自动更新内部网站的https证书,而不必让内部networking的内容可以从广域网访问,或者不必让内部networking的内容停止运行(API每隔几秒查询一次,这不是一个可以接受的选项) 。
我怎么能达到我想要的(见上面的两个虚拟主机的vhosts文件),让letsencrypt / certbot列出这个域名,以便我可以为它生成一个SSL证书?
请注意, internalwebsite.example.com可从互联网上访问! 这意味着letsencrypt可以validation所有权,但是应该在WAN端进行validation。
编辑:
外部DNS(全局DNS)指向WAN IP(例如44.55.66.77),当查询时,我们的内部DNS返回10.0.0.4。
实际的问题是,在添加这样的vhost域后,letsencrypt将不允许select域来生成HTTPS证书:
web@webserver:/etc/apache2/sites-available# letsencrypt Saving debug log to /var/log/letsencrypt/letsencrypt.log Which names would you like to activate HTTPS for? ------------------------------------------------------------------------------- 1: example.com 2: other.example.com 3: somethingelse.example.com ------------------------------------------------------------------------------- Select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (Enter 'c' to cancel):
internalwebsite.example.com从此列表中丢失,当我将vhostconfiguration恢复为只有内部文档根目录(因此删除了10.0.0.3部分)时,letsencrypt列出了域,但是由于它无法validation域。 (因为当letsencrypt试图validation身份,Apache不知道10.0.0.3上的任何internalwebsite.example.com ),当我尝试进行此错误发生时:
IMPORTANT NOTES: - The following errors were reported by the server: Domain: internalwebsite.example.com Type: unauthorized Detail: Incorrect validation certificate for tls-sni-01 challenge. Requested f547f5b0936dad4b0e1d28c325bc36c8.da1ceb11ae0bd36d221f546faede908a.acme.invalid from 11.22.33.44:443. Received 2 certificate(s), first certificate had names "example.com, other.example.com, somethingelse.example.com" 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.
因为现在apache不会在10.0.0.3上监听internalwebsite.example.com但是我不能在10.0.0.4上暂时closures网站并暂时将其移动到10.0.0.3 ..