updates for http-01
This commit is contained in:
parent
560f0eddef
commit
d89e3959fd
38
README.md
38
README.md
|
@ -1,8 +1,8 @@
|
||||||
# [acme-dns-01-{{servicename}}.js](https://git.rootprojects.org/root/acme-dns-01-{{servicename}}.js) | a [Root](https://rootprojects.org/) project
|
# [acme-http-01-{{servicename}}.js](https://git.rootprojects.org/root/acme-http-01-{{servicename}}.js) | a [Root](https://rootprojects.org/) project
|
||||||
|
|
||||||
{{ Service Title }} DNS + Let's Encrypt for Node.js - ACME dns-01 challenges w/ ACME.js and Greenlock.js
|
{{ Service Title }} Storage + Let's Encrypt for Node.js - ACME http-01 challenges w/ ACME.js and Greenlock.js
|
||||||
|
|
||||||
Handles ACME dns-01 challenges. Compatible with ACME.js and Greenlock.js. Passes acme-dns-01-test.
|
Handles ACME http-01 challenges. Compatible with ACME.js and Greenlock.js. Passes acme-http-01-test.
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ Handles ACME dns-01 challenges. Compatible with ACME.js and Greenlock.js. Passes
|
||||||
# Install
|
# Install
|
||||||
|
|
||||||
```js
|
```js
|
||||||
npm install --save acme-dns-01-{{servicename}}
|
npm install --save acme-http-01-{{servicename}}
|
||||||
```
|
```
|
||||||
|
|
||||||
{{ Service Title }} Token:
|
{{ Service Title }} Token:
|
||||||
|
@ -31,7 +31,7 @@ npm install --save acme-dns-01-{{servicename}}
|
||||||
First you create an instance with your credentials:
|
First you create an instance with your credentials:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var dns01 = require('acme-dns-01-{{servicename}}').create({
|
var http01 = require('acme-http-01-{{servicename}}').create({
|
||||||
baseUrl: '{{ api url }}', // default
|
baseUrl: '{{ api url }}', // default
|
||||||
token: 'xxxx'
|
token: 'xxxx'
|
||||||
});
|
});
|
||||||
|
@ -45,9 +45,9 @@ Then you can use it with any compatible ACME library, such as Greenlock.js or AC
|
||||||
var Greenlock = require('greenlock-express');
|
var Greenlock = require('greenlock-express');
|
||||||
var greenlock = Greenlock.create({
|
var greenlock = Greenlock.create({
|
||||||
challenges: {
|
challenges: {
|
||||||
'dns-01': dns01
|
'http-01': http01
|
||||||
// ...
|
|
||||||
}
|
}
|
||||||
|
// ...
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -63,32 +63,30 @@ See the [ACME.js](https://git.rootprojects.org/root/acme-v2.js) for more details
|
||||||
|
|
||||||
## Build your own
|
## Build your own
|
||||||
|
|
||||||
There are only 5 methods:
|
There are only 4 methods:
|
||||||
|
|
||||||
- `init(config)`
|
- `init(config)`
|
||||||
- `zones(opts)`
|
|
||||||
- `set(opts)`
|
- `set(opts)`
|
||||||
- `get(opts)`
|
- `get(opts)`
|
||||||
- `remove(opts)`
|
- `remove(opts)`
|
||||||
|
|
||||||
```js
|
```js
|
||||||
dns01
|
http01
|
||||||
.set({
|
.set({
|
||||||
identifier: { value: 'foo.example.co.uk' },
|
altname: 'foo.example.co.uk',
|
||||||
wildcard: false,
|
token: 'xxxx'
|
||||||
dnsZone: 'example.co.uk',
|
keyAuthorization: 'xxxx.yyyy'
|
||||||
dnsPrefix: '_acme-challenge.foo',
|
|
||||||
dnsAuthorization: 'xxx_secret_xxx'
|
|
||||||
})
|
})
|
||||||
.then(function() {
|
.then(function() {
|
||||||
console.log('TXT record set');
|
console.log('Saved ACME key authorization file');
|
||||||
})
|
})
|
||||||
.catch(function() {
|
.catch(function(err) {
|
||||||
console.log('Failed to set TXT record');
|
console.error('Failed to save ACME key authorization file');
|
||||||
|
console.error(err);
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
See acme-dns-01-test for more implementation details.
|
See acme-http-01-test for more implementation details.
|
||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
|
|
||||||
|
@ -105,7 +103,7 @@ See AUTHORS for contact info.
|
||||||
|
|
||||||
# Legal
|
# Legal
|
||||||
|
|
||||||
[acme-dns-01-{{servicename}}.js](https://git.coolaj86.com/coolaj86/acme-dns-01-{{servicename}}.js) | MPL-2.0 | [Terms of Use](https://therootcompany.com/legal/#terms) | [Privacy Policy](https://therootcompany.com/legal/#privacy)
|
[acme-http-01-{{servicename}}.js](https://git.coolaj86.com/coolaj86/acme-http-01-{{servicename}}.js) | MPL-2.0 | [Terms of Use](https://therootcompany.com/legal/#terms) | [Privacy Policy](https://therootcompany.com/legal/#privacy)
|
||||||
|
|
||||||
Copyright 2019 AJ ONeal
|
Copyright 2019 AJ ONeal
|
||||||
Copyright 2019 The Root Group LLC
|
Copyright 2019 The Root Group LLC
|
||||||
|
|
26
lib/index.js
26
lib/index.js
|
@ -9,27 +9,23 @@ module.exports.create = function(config) {
|
||||||
request = opts.request;
|
request = opts.request;
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
zones: function(data) {
|
|
||||||
//console.info('List Zones', data);
|
|
||||||
throw Error('listing zones not implemented');
|
|
||||||
},
|
|
||||||
set: function(data) {
|
set: function(data) {
|
||||||
var ch = data.challenge;
|
var ch = data.challenge;
|
||||||
if (!ch.dnsZone) {
|
// console.info('Add Key Auth URL', data);
|
||||||
// zones() is not implemented for http-01 challenges,
|
throw Error('setting key authorization not implemented');
|
||||||
// but it is almost always implemented for dns-01 challenges
|
|
||||||
throw new Error('No matching zone for ' + ch.dnsHost);
|
|
||||||
}
|
|
||||||
// console.info('Add TXT', data);
|
|
||||||
throw Error('setting TXT not implemented');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function(data) {
|
remove: function(data) {
|
||||||
// console.info('Remove TXT', data);
|
var ch = data.challenge;
|
||||||
throw Error('removing TXT not implemented');
|
// console.info('Remove Key Auth URL', data);
|
||||||
|
throw Error('removing key authorization not implemented');
|
||||||
},
|
},
|
||||||
|
|
||||||
get: function(data) {
|
get: function(data) {
|
||||||
// console.info('List TXT', data);
|
var ch = data.challenge;
|
||||||
throw Error('listing TXTs not implemented');
|
// console.info('List Key Auth URL', data);
|
||||||
|
throw Error('retrieving key authorization not implemented');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
10
package.json
10
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "acme-dns-01-{{servicename}}",
|
"name": "acme-http-01-{{servicename}}",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "{{ Service Title }} + Let's Encrypt for Node.js - ACME dns-01 challenges w/ ACME.js and Greenlock.js",
|
"description": "{{ Service Title }} + Let's Encrypt for Node.js - ACME http-01 challenges w/ ACME.js and Greenlock.js",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"files": [
|
"files": [
|
||||||
"lib",
|
"lib",
|
||||||
|
@ -12,12 +12,12 @@
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.coolaj86.com/coolaj86/acme-dns-01-{{servicename}}.js.git"
|
"url": "https://git.coolaj86.com/coolaj86/acme-http-01-{{servicename}}.js.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"{{servicename}}",
|
"{{servicename}}",
|
||||||
"dns",
|
"storage",
|
||||||
"dns-01",
|
"http-01",
|
||||||
"letsencrypt",
|
"letsencrypt",
|
||||||
"acme",
|
"acme",
|
||||||
"greenlock"
|
"greenlock"
|
||||||
|
|
12
test.js
12
test.js
|
@ -5,18 +5,20 @@
|
||||||
var tester = require('acme-challenge-test');
|
var tester = require('acme-challenge-test');
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
|
|
||||||
// Usage: node ./test.js example.com xxxxxxxxx
|
// Usage: node ./test.js example.com username xxxxxxxxx
|
||||||
var zone = process.argv[2] || process.env.ZONE;
|
var record = process.argv[2] || process.env.RECORD;
|
||||||
var challenger = require('./index.js').create({
|
var challenger = require('./index.js').create({
|
||||||
token: process.argv[3] || process.env.TOKEN
|
webroot:
|
||||||
|
'/tmp/acme-tests/{domain}/.well-known/acme-challenges/' ||
|
||||||
|
process.env.WEBROOT
|
||||||
});
|
});
|
||||||
|
|
||||||
// The dry-run tests can pass on, literally, 'example.com'
|
// The dry-run tests can pass on, literally, 'example.com'
|
||||||
// but the integration tests require that you have control over the domain
|
// but the integration tests require that you have control over the domain
|
||||||
tester
|
tester
|
||||||
.testZone('dns-01', zone, challenger)
|
.testRecord('http-01', record, challenger)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
console.info('PASS', zone);
|
console.info('PASS', record);
|
||||||
})
|
})
|
||||||
.catch(function(e) {
|
.catch(function(e) {
|
||||||
console.error(e.message);
|
console.error(e.message);
|
||||||
|
|
Loading…
Reference in New Issue