简体   繁体   English

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

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

I am pretty much new to setting up ssl server i am just exploring a package called greelock 我对设置ssl服务器非常陌生,我只是在探索一个名为greelock的软件包

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

trust me i am using real domain for this setting up ssl. 相信我,我正在为此设置SSL使用真实域。

after installed all packages i run this code. 安装所有软件包后,我运行此代码。

'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);

Above code is working properly for base domain which is awesomedomain.com but when i try to visit some random subdomain i am facing this error 上面的代码对于awesomedomain.com的基本域正常运行,但是当我尝试访问一些随机子域时,我遇到了此错误

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

Use Greenlock v2.7+ 使用Greenlock v2.7 +

Before Greenlock v2.7 there were a number of things you had to do manually to get wildcard registration to work. 在Greenlock v2.7之前,您必须手动执行许多操作才能使通配符注册生效。

I wrote a new file storage plugin so that it won't get tripped up with filesystems that don't allow * . 我写了一个新的文件存储插件,这样它就不会被不允许*文件系统绊倒。

I also made it be a little smarter about using dns-01 as required and http-01 when allowable. 我还使在需要时使用dns-01和在允许时使用http-01变得更加聪明。

See the example at https://git.coolaj86.com/coolaj86/greenlock-express.js/src/branch/master/examples/wildcard.js 请参阅https://git.coolaj86.com/coolaj86/greenlock-express.js/src/branch/master/examples/wildcard.js中的示例

DNS-01 Plugin DNS-01插件

You'll still need a dns-01 plugin. 您仍然需要dns-01插件。 Hit me up on issues if you try one of the ones listed in plugin section of the README and it's not working: 如果您尝试自述文件的插件部分中列出的问题之一,则请给我提问题,但它不起作用:

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

Some of them are pretty old and although I've tried to maintain backwards compatibility through much pain, it's possible that something is amiss. 它们中的一些已经相当老了,尽管我试图通过极大的痛苦来保持向后兼容性,但是可能有些不对劲。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM