acme dns-01 library template

This commit is contained in:
AJ ONeal 2019-07-22 23:31:48 -06:00
parent f904a43bd2
commit c2199e8140
8 changed files with 128 additions and 2 deletions

1
AUTHORS Normal file
View File

@ -0,0 +1 @@
AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)

View File

@ -1,3 +1,3 @@
# acme-dns-01-template.js
# acme-dns-01-{{servicename}}.js
{{ Service }} DNS + Let's Encrypt for Node.js - ACME dns-01 challenges w/ ACME.js and Greenlock.js
{{ Service Title }} DNS + Let's Encrypt for Node.js - ACME dns-01 challenges w/ ACME.js and Greenlock.js

2
example.env Normal file
View File

@ -0,0 +1,2 @@
ZONE=example.co.uk
TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

3
index.js Normal file
View File

@ -0,0 +1,3 @@
'use strict';
module.exports = require('./lib/index.js');

29
lib/index.js Normal file
View File

@ -0,0 +1,29 @@
'use strict';
var request;
var defaults = {};
module.exports.create = function(config) {
return {
init: function(opts) {
request = opts.request;
return null;
},
zones: function(data) {
//console.info('List Zones', data);
throw Error('listing zones not implemented');
},
set: function(data) {
// console.info('Add TXT', data);
throw Error('setting TXT not implemented');
},
remove: function(data) {
// console.info('Remove TXT', data);
throw Error('removing TXT not implemented');
},
get: function(data) {
// console.info('List TXT', data);
throw Error('listing TXTs not implemented');
}
};
};

36
package-lock.json generated Normal file
View File

@ -0,0 +1,36 @@
{
"name": "acme-dns-01-{{servicename}}",
"version": "0.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@root/request": {
"version": "1.3.11",
"resolved": "https://registry.npmjs.org/@root/request/-/request-1.3.11.tgz",
"integrity": "sha512-3a4Eeghcjsfe6zh7EJ+ni1l8OK9Fz2wL1OjP4UCa0YdvtH39kdXB9RGWuzyNv7dZi0+Ffkc83KfH0WbPMiuJFw=="
},
"acme-challenge-test": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/acme-challenge-test/-/acme-challenge-test-3.3.2.tgz",
"integrity": "sha512-0AbMcaON20wpI5vzFDAqwcv2VerY4xIlNCqX0w1xEJUIu/EQtQNmkje+rKNuy2TUl2KBMdIaR6YBbJUdaEiC4w==",
"requires": {
"@root/request": "^1.3.11"
}
},
"acme-dns-01-test": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/acme-dns-01-test/-/acme-dns-01-test-3.3.1.tgz",
"integrity": "sha512-di2/n19FDLc/pe4CDxd/FpxuuCZG7CHEQVjWr96vvtxe5XNNgdHi2eJqVP0z9WBf9s61zxslyRPrAWzTN8ZVWw==",
"dev": true,
"requires": {
"acme-challenge-test": "^3.3.1"
}
},
"dotenv": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.0.0.tgz",
"integrity": "sha512-30xVGqjLjiUOArT4+M5q9sYdvuR4riM6yK9wMcas9Vbp6zZa+ocC9dp6QoftuhTPhFAiLK/0C5Ni2nou/Bk8lg==",
"dev": true
}
}
}

31
package.json Normal file
View File

@ -0,0 +1,31 @@
{
"name": "acme-dns-01-{{servicename}}",
"version": "0.0.1",
"description": "{{ Service Title }} + Let's Encrypt for Node.js - ACME dns-01 challenges w/ ACME.js and Greenlock.js",
"main": "index.js",
"files": [
"lib",
"test.js"
],
"scripts": {
"test": "node test.js"
},
"repository": {
"type": "git",
"url": "https://git.coolaj86.com/coolaj86/acme-dns-01-{{servicename}}.js.git"
},
"keywords": [
"{{servicename}}",
"dns",
"dns-01",
"letsencrypt",
"acme",
"greenlock"
],
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)",
"license": "MPL-2.0",
"devDependencies": {
"acme-dns-01-test": "^3.3.1",
"dotenv": "^8.0.0"
}
}

24
test.js Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env node
'use strict';
// See https://git.coolaj86.com/coolaj86/acme-challenge-test.js
var tester = require('acme-challenge-test');
require('dotenv').config();
// Usage: node ./test.js example.com xxxxxxxxx
var zone = process.argv[2] || process.env.ZONE;
var challenger = require('./index.js').create({
token: process.argv[3] || process.env.TOKEN
});
// The dry-run tests can pass on, literally, 'example.com'
// but the integration tests require that you have control over the domain
tester
.testZone('dns-01', zone, challenger)
.then(function() {
console.info('PASS', zone);
})
.catch(function(e) {
console.error(e.message);
console.error(e.stack);
});