acme-dns-01-powerdns
v1.0.7
Published
PowerDNS DNS for Let's Encrypt / ACME dns-01 challenges with ACME.js and Greenlock.js
Downloads
30
Maintainers
Readme
acme-dns-01-powerdns
a acme-dns/greenlock plugin for powerdns
Install
npm i acme-dns-01-powerdns --save
Usage
You have to supply a file named .env, in your projects root folder, with your information, like shown here
.env
PDNS_API_KEY = "your powerdns api key";
PDNS_API_ENDPOINT = "https://example.com/api/v1/servers/localhost";
MAINTAINER_EMAIL = "[email protected]";
SUBSCRIBER_EMAIL = "[email protected]";
Also install greenlock and dotenv if you haven't already
npm i greenlock dotenv --save
Now you can request a certificate using greenlock with your own powerdns server
Set staging to false to get a real non testing certificate if you're sure that your config works
index.js
"use strict";
require("dotenv").config(); //loads the .env file and provides the variables to the process
var pkg = require("./package.json");
var Greenlock = require("greenlock");
var greenlock = Greenlock.create({
packageRoot: __dirname,
configDir: "./greenlock.d/",
packageAgent: pkg.name + "/" + pkg.version,
maintainerEmail: process.env.MAINTAINER_EMAIL,
staging: true,
notify: function (event, details) {
if ("error" === event) {
// `details` is an error object in this case
console.error(details);
}
}
});
greenlock.manager.defaults({
// The "Let's Encrypt Subscriber" (often the same as the maintainer)
// NOT the end customer (except where that is also the maintainer)
subscriberEmail: process.env.SUBSCRIBER_EMAIL,
agreeToTerms: true,
challenges: {
"dns-01": {
module: "acme-dns-01-powerdns",
token: process.env.PDNS_API_KEY,
baseUrl: process.env.PDNS_API_ENDPOINT
}
}
});
var altnames = ["example.com", "*.example.com"];
greenlock
.add({
subject: altnames[0],
altnames: altnames
})
.then(function () {
// saved config to db (or file system)
});
Need help?
Feel free to contact me via [email protected] in english or german
powerdns-api for nodejs
PDNS WEB API Documentation
https://doc.powerdns.com/authoritative/http-api/index.html