All Projects → nodecraft → acme-dns-01-cloudflare

nodecraft / acme-dns-01-cloudflare

Licence: MIT License
Cloudflare DNS for Let's Encrypt / ACME dns-01 challenges with Greenlock.js and ACME.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to acme-dns-01-cloudflare

lua-resty-acme
Automatic Let's Encrypt certificate serving and Lua implementation of ACMEv2 procotol
Stars: ✭ 95 (+630.77%)
Mutual labels:  letsencrypt, acme, acme-v2
acme
Go client library implementation for ACME v2 (RFC8555)
Stars: ✭ 77 (+492.31%)
Mutual labels:  letsencrypt, acme, lets-encrypt
LetsEncrypt
C# layer for generation of wildcard Let's Encrypt SSL certificates
Stars: ✭ 67 (+415.38%)
Mutual labels:  letsencrypt, acme-dns, acme-v2
acme-companion
Automated ACME SSL certificate generation for nginx-proxy
Stars: ✭ 6,434 (+49392.31%)
Mutual labels:  letsencrypt, acme, acme-v2
ght-acme.sh
Shell script to sign certificate by the letsencrypt CA
Stars: ✭ 31 (+138.46%)
Mutual labels:  letsencrypt, acme, acme-v2
Win Acme
A simple ACME client for Windows (for use with Let's Encrypt et al.)
Stars: ✭ 4,305 (+33015.38%)
Mutual labels:  letsencrypt, acme, acme-v2
ACMECert
PHP client library for Let's Encrypt (ACME v2 - RFC 8555)
Stars: ✭ 83 (+538.46%)
Mutual labels:  letsencrypt, acme, acme-v2
Docker Letsencrypt Nginx Proxy Companion
Automated ACME SSL certificate generation for nginx-proxy
Stars: ✭ 6,350 (+48746.15%)
Mutual labels:  letsencrypt, acme, acme-v2
kong-plugin-acme
Let's Encrypt and ACMEv2 integration with Kong - this plugin has been moved into https://github.com/Kong/kong, please open issues and PRs in that repo
Stars: ✭ 36 (+176.92%)
Mutual labels:  letsencrypt, acme, acme-v2
django-ca
Django app providing a Certificate Authority
Stars: ✭ 106 (+715.38%)
Mutual labels:  acme, acme-v2
txacme
Twisted client for the ACME (Automatic Certificate Management Environment) protocol
Stars: ✭ 42 (+223.08%)
Mutual labels:  letsencrypt, acme-v2
anvil
Tools for distributing ssl certificates
Stars: ✭ 29 (+123.08%)
Mutual labels:  acme, lets-encrypt
AzureWebAppSSLManager
Acquires and manages free SSL certificates for Azure Web App and Azure Functions applications.
Stars: ✭ 70 (+438.46%)
Mutual labels:  letsencrypt, acme
qiniu-auto-cert
七牛 CDN 证书自动化工具
Stars: ✭ 20 (+53.85%)
Mutual labels:  letsencrypt, acme
docker-ssl-reverse-proxy
Easy-to-use auto-SSL reverse proxy as a Docker container based on Caddy and Let’s Encrypt
Stars: ✭ 22 (+69.23%)
Mutual labels:  letsencrypt, lets-encrypt
Terraform Provider Acme Old
ACME (Let's Encrypt) Support for Terraform
Stars: ✭ 211 (+1523.08%)
Mutual labels:  letsencrypt, acme
openconnect-installer
Automatically set up an Openconnect/Anyconnect VPN server(ocserv) with Let's Encrypt with just one command in CentOS 8.
Stars: ✭ 64 (+392.31%)
Mutual labels:  letsencrypt, lets-encrypt
wat
WAT - Windows ACME Tool
Stars: ✭ 28 (+115.38%)
Mutual labels:  letsencrypt, acme
Intranet-Lets-Encrypt-Certification
Guide to setting up a Let's Encrypt SSL certificate for a non-public facing server.
Stars: ✭ 27 (+107.69%)
Mutual labels:  letsencrypt, lets-encrypt
docker-nginx-certbot
Automatically create and renew website certificates for free using the Let's Encrypt certificate authority.
Stars: ✭ 367 (+2723.08%)
Mutual labels:  letsencrypt, acme

acme-dns-01-cloudflare

npm version Actions Status

Cloudflare DNS + Let's Encrypt. This module handles ACME dns-01 challenges, compatible with Greenlock.js and ACME.js. It passes acme-dns-01-test.

Install

npm install acme-dns-01-cloudflare --save

Cloudflare API Token

Whilst you can use a global API key and email to generate certs, we heavily encourage that you use a Cloudflare API token for increased security.

From your Cloudflare Profile page, create an API Token with the following permissions:

  • Zone -> Zone: Read
  • Zone -> DNS: Edit

Unfortunately at this time, there is no way to acquire the com.cloudflare.api.account.zone.list permission needed to list zones without giving the key Zone: Read access to all zones. Further discussion of this can be found here and hopefully there'll be a better solution in the future.

The resulting API token should look something like this:

Cloudflare API Token generation

Usage

First, create an instance of the library with your Cloudflare API credentials or an API token. See the instructions above for more information.

const acmeDnsCloudflare = require('acme-dns-01-cloudflare');

const cloudflareDns01 = new acmeDnsCloudflare({
	token: 'xxxxxx',
	verifyPropagation: true,
	verbose: true // log propagation delays and other debug information
});

Other options include waitFor and retries which control the number of propagation retries, and delay between retries. You probably won't need to tweak these unless you're seeing regular DNS related failures.

Then you can use it with any compatible ACME library, such as Greenlock.js or ACME.js.

Greenlock.js v4

See the Greenlock.js documentation for more information.

const Greenlock = require('greenlock');
const pkg = require('./package.json');

const greenlock = Greenlock.create({
	packageAgent: pkg.name + '/' + pkg.version,
	configDir: "./store",
	maintainerEmail: "[email protected]"
});

greenlock.manager.defaults({
	agreeToTerms: true,
	subscriberEmail: "[email protected]",
	store: {
		module: "greenlock-store-fs",
		basePath: "./store/certs"
	},
	challenges: {
		"dns-01": cloudflareDns01
	}
});

greenlock.add({
	subject: "example.com",
	altnames: ["example.com", "www.example.com"]
}).then(function(){
	console.log("SUCCESS");
}).catch(console.error);

Greenlock.js v2

The example below uses the greenlock-store-fs module to write these certs to disk for demonstration.

const Greenlock = require('greenlock'),
	greenlockStore = require('greenlock-store-fs');

const store = greenlockStore.create({
	configDir: './store/certs',
	debug: true
});

const greenlock = Greenlock.create({
	server: 'https://acme-staging-v02.api.letsencrypt.org/directory',
	store: store,
	challenges: {
		'dns-01': cloudflareDns01
	},
	challengeType: 'dns-01',
	debug: true
});

greenlock.register({
	domains: ['example.com'],
	email: '[email protected]',
	agreeTos: true,
	rsaKeySize: 2048,
	debug: true
}).then(() => {
	console.log('SUCCESS');
}).catch((err) => {
	console.error(err);
});

ACME.js

// TODO

Tests

# CLOUDFLARE_TOKEN or both CLOUDFLARE_EMAIL and CLOUDFLARE_APIKEY env vars must be set, as well as DOMAIN
node ./test.js
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].