簡體   English   中英

如何使用letsencrypt greenlock設置通配符域ssl?

[英]How to setup wildcard domain ssl with letsencrypt greenlock?

我對設置ssl服務器非常陌生,我只是在探索一個名為greelock的軟件包

https://www.npmjs.com/package/greenlock

相信我,我正在為此設置SSL使用真實域。

安裝所有軟件包后,我運行此代碼。

'use strict';

require('greenlock-express').create({

  // Let's Encrypt v2 is ACME draft 11
  version: 'draft-11'

  // Note: If at first you don't succeed, switch to staging to debug
  // https://acme-staging-v02.api.letsencrypt.org/directory
        // https://acme-v02.api.letsencrypt.org/directory
, server: 'https://acme-staging-v02.api.letsencrypt.org/directory'

  // Where the certs will be saved, MUST have write access
, configDir: '~/.config/acme/'

  // You MUST change this to a valid email address
, email: 'somename@gmail.com'

  // You MUST change these to valid domains
  // NOTE: all domains will validated and listed on the certificate
, approveDomains: [ 'awesomedomain.com','*.awesomedomain.com' ]

  // You MUST NOT build clients that accept the ToS without asking the user
, agreeTos: true

, app: require('express')().use('/', function (req, res) {
    res.setHeader('Content-Type', 'text/html; charset=utf-8')
    res.end('Hello, World!\n\n💚  🔒 .js');
  })

  // Join the community to get notified of important updates
, communityMember: true

  // Contribute telemetry data to the project
, telemetry: true

//, debug: true

}).listen(80, 443);

上面的代碼對於awesomedomain.com的基本域正常運行,但是當我嘗試訪問一些隨機子域時,我遇到了此錯誤

 [Error] approveDomains rejected tls sni 'david.awesomedomain.com'
    [Error] (see https://git.coolaj86.com/coolaj86/greenlock.js/issues/11)

使用Greenlock v2.7 +

在Greenlock v2.7之前,您必須手動執行許多操作才能使通配符注冊生效。

我寫了一個新的文件存儲插件,這樣它就不會被不允許*文件系統絆倒。

我還使在需要時使用dns-01和在允許時使用http-01變得更加聰明。

請參閱https://git.coolaj86.com/coolaj86/greenlock-express.js/src/branch/master/examples/wildcard.js中的示例

DNS-01插件

您仍然需要dns-01插件。 如果您嘗試自述文件的插件部分中列出的問題之一,則請給我提問題,但它不起作用:

https://git.coolaj86.com/coolaj86/greenlock-express.js

它們中的一些已經相當老了,盡管我試圖通過極大的痛苦來保持向后兼容性,但是可能有些不對勁。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM