package cleanup

This commit is contained in:
AJ ONeal 2019-07-23 01:54:22 -06:00
parent 0aa6f28f85
commit a6a7f6b95e
6 changed files with 180 additions and 38 deletions

80
.gitignore vendored
View File

@ -1,2 +1,78 @@
node_modules
package-lock.json
# ---> Node
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
# FuseBox cache
.fusebox/

View File

@ -1,7 +1,6 @@
# [acme-dns-01-namecheap](https://git.rootprojects.org/root/acme-dns-01-namecheap) | a [Root](https://rootrpojects.org) project
NameCheap DNS + Let's Encrypt
NameCheap DNS + Let's Encrypt
This handles ACME dns-01 challenges, compatible with ACME.js and Greenlock.js.
Passes [acme-dns-01-test](https://git.rootprojects.org/root/acme-dns-01-test.js).
@ -18,11 +17,11 @@ First you create an instance with your credentials:
```js
var dns01 = require('acme-dns-01-namecheap').create({
apiUser:'username',
apiKey : 'xxxx',
clientIp:'public ip',
username: 'api user',
baseUrl: 'sandbox or production', // default production
apiUser: 'username',
apiKey: 'xxxx',
clientIp: 'public ip',
username: 'api user',
baseUrl: 'sandbox or production' // default production
});
```
@ -56,18 +55,18 @@ See the [ACME.js](https://git.rootprojects.org/root/acme-v2.js) for more details
```js
dns01
.set({
identifier: { value: 'foo.example.com' },
wildcard: false,
dnsHost: '_acme-challenge.foo.example.com',
dnsAuthorization: 'xxx_secret_xxx'
})
.then(function () {
console.log("TXT record set");
})
.catch(function () {
console.log("Failed to set TXT record");
});
.set({
identifier: { value: 'foo.example.com' },
wildcard: false,
dnsHost: '_acme-challenge.foo.example.com',
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](https://git.rootprojects.org/root/acme-dns-01-test.js)
@ -77,6 +76,5 @@ for more implementation details.
```bash
# node ./test.js domain-zone api-user api-key client-ip username [username is optional if similar to api-user]
node ./test.js example.com demo 45.77.4.126 d41474b94e7d4536baabb074a09c96bd
node ./test.js example.com demo d41474b94e7d4536baabb074a09c96bd 45.77.4.126
```

6
example.env Normal file
View File

@ -0,0 +1,6 @@
ZONE=example.co.uk
API_USER=exampleuser
API_KEY=xxxxxxxxxxxxxxx
USERNAME=exampleuser
CLIENT_IP=121.22.123.22

58
package-lock.json generated Normal file
View File

@ -0,0 +1,58 @@
{
"name": "acme-dns-01-namecheap",
"version": "3.0.0",
"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==",
"dev": true,
"requires": {
"@root/request": "^1.3.11"
},
"dependencies": {
"@root/request": {
"version": "1.3.11",
"resolved": "https://registry.npmjs.org/@root/request/-/request-1.3.11.tgz",
"integrity": "sha512-3a4Eeghcjsfe6zh7EJ+ni1l8OK9Fz2wL1OjP4UCa0YdvtH39kdXB9RGWuzyNv7dZi0+Ffkc83KfH0WbPMiuJFw==",
"dev": true
}
}
},
"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"
}
},
"sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
},
"xml2js": {
"version": "0.4.19",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
"integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==",
"requires": {
"sax": ">=0.6.0",
"xmlbuilder": "~9.0.1"
}
},
"xmlbuilder": {
"version": "9.0.7",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz",
"integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0="
}
}
}

View File

@ -30,6 +30,7 @@
"xml2js": "^0.4.19"
},
"devDependencies": {
"acme-challenge-test": "^3.3.2",
"acme-dns-01-test": "^3.2.1"
}
}

33
test.js
View File

@ -3,28 +3,31 @@
// https://git.rootprojects.org/root/acme-dns-01-test.js
var tester = require('acme-challenge-test');
require('dotenv').config();
// Usage: node ./test.js example.com xxxxxxxxx
var zone = process.argv[2];
var zone = process.argv[2] || process.env.ZONE;
var challenger = require('./index.js').create({
apiUser:process.argv[3],
apiKey : process.argv[4],
clientIp:process.argv[5],
username: process.argv[6]||process.argv[3]
apiUser: process.argv[3] || process.env.API_USER,
apiKey: process.argv[4] || process.env.API_KEY || process.env.TOKEN,
clientIp: process.argv[5] || process.env.CLIENT_IP,
username:
process.argv[6] ||
process.env.USERNAME ||
process.argv[3] ||
process.env.API_USER
});
// 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.info('FAIL', zone);
console.error(e.message);
console.error(e.stack);
});
.then(function() {
console.info('PASS', zone);
})
.catch(function(e) {
console.info('FAIL', zone);
console.error(e.message);
console.error(e.stack);
});