mirror of
https://git.coolaj86.com/coolaj86/acme-dns-01-namedotcom.js.git
synced 2025-04-20 14:21:07 +00:00
add package template
This commit is contained in:
parent
06a8b0b79c
commit
c19b850d6e
112
README.md
112
README.md
@ -1,3 +1,111 @@
|
||||
# acme-dns-01-namedotcom.js
|
||||
# [acme-dns-01-namedotcom.js](https://git.rootprojects.org/root/acme-dns-01-namedotcom.js) | a [Root](https://rootprojects.org/) project
|
||||
|
||||
Name.com DNS + Let's Encrypt for Node.js - ACME dns-01 challenges w/ ACME.js and Greenlock.js
|
||||
Name.com DNS + Let's Encrypt for Node.js - ACME dns-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.
|
||||
|
||||
# Features
|
||||
|
||||
- Compatible
|
||||
- Let’s Encrypt v2.1 / ACME draft 18 (2019)
|
||||
- Name.com API
|
||||
- ACME.js, Greenlock.js, and others
|
||||
- Quality
|
||||
- node v6 compatible VanillaJS
|
||||
- < 150 lines of code
|
||||
- Zero Dependencies
|
||||
|
||||
# Install
|
||||
|
||||
```js
|
||||
npm install --save acme-dns-01-namedotcom
|
||||
```
|
||||
|
||||
Name.com Token:
|
||||
|
||||
- Login to your account at: {{ Service URL }}
|
||||
- {{ Instructions to generate token }}
|
||||
|
||||
# Usage
|
||||
|
||||
First you create an instance with your credentials:
|
||||
|
||||
```js
|
||||
var dns01 = require('acme-dns-01-namedotcom').create({
|
||||
baseUrl: '{{ api url }}', // default
|
||||
token: 'xxxx'
|
||||
});
|
||||
```
|
||||
|
||||
Then you can use it with any compatible ACME library, such as Greenlock.js or ACME.js.
|
||||
|
||||
## Greenlock.js
|
||||
|
||||
```js
|
||||
var Greenlock = require('greenlock-express');
|
||||
var greenlock = Greenlock.create({
|
||||
challenges: {
|
||||
'dns-01': dns01
|
||||
// ...
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
See [Greenlock Express](https://git.rootprojects.org/root/greenlock-express.js) and/or [Greenlock.js](https://git.rootprojects.org/root/greenlock.js) documentation for more details.
|
||||
|
||||
## ACME.js
|
||||
|
||||
```js
|
||||
// TODO
|
||||
```
|
||||
|
||||
See the [ACME.js](https://git.rootprojects.org/root/acme-v2.js) for more details.
|
||||
|
||||
## Build your own
|
||||
|
||||
There are only 5 methods:
|
||||
|
||||
- `init(config)`
|
||||
- `zones(opts)`
|
||||
- `set(opts)`
|
||||
- `get(opts)`
|
||||
- `remove(opts)`
|
||||
|
||||
```js
|
||||
dns01
|
||||
.set({
|
||||
identifier: { value: 'foo.example.co.uk' },
|
||||
wildcard: false,
|
||||
dnsZone: 'example.co.uk',
|
||||
dnsPrefix: '_acme-challenge.foo',
|
||||
dnsAuthorization: 'xxx_secret_xxx'
|
||||
})
|
||||
.then(function() {
|
||||
console.log('TXT record set');
|
||||
})
|
||||
.catch(function() {
|
||||
console.log('Failed to set TXT record');
|
||||
});
|
||||
```
|
||||
|
||||
See acme-dns-01-test for more implementation details.
|
||||
|
||||
# Tests
|
||||
|
||||
```bash
|
||||
# node ./test.js domain-zone api-token
|
||||
node ./test.js example.com xxxxxx
|
||||
```
|
||||
|
||||
# Authors
|
||||
|
||||
- AJ ONeal
|
||||
|
||||
See AUTHORS for contact info.
|
||||
|
||||
# Legal
|
||||
|
||||
[acme-dns-01-namedotcom.js](https://git.coolaj86.com/coolaj86/acme-dns-01-namedotcom.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 The Root Group LLC
|
||||
|
2
example.env
Normal file
2
example.env
Normal file
@ -0,0 +1,2 @@
|
||||
ZONE=example.co.uk
|
||||
TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
3
index.js
Normal file
3
index.js
Normal file
@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./lib/index.js');
|
29
lib/index.js
Normal file
29
lib/index.js
Normal 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');
|
||||
}
|
||||
};
|
||||
};
|
34
package.json
Normal file
34
package.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "acme-dns-01-namedotcom",
|
||||
"version": "0.0.1",
|
||||
"description": "Name.com + 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-namedotcom.js.git"
|
||||
},
|
||||
"keywords": [
|
||||
"Name.com",
|
||||
"namedotcom",
|
||||
"dns",
|
||||
"dns-01",
|
||||
"letsencrypt",
|
||||
"acme",
|
||||
"greenlock"
|
||||
],
|
||||
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)",
|
||||
"license": "MPL-2.0",
|
||||
"devDependencies": {
|
||||
"dotenv": "^8.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"acme-challenge-test": "^3.3.2"
|
||||
}
|
||||
}
|
24
test.js
Executable file
24
test.js
Executable 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);
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user