Compare commits
83 Commits
Author | SHA1 | Date | |
---|---|---|---|
bf07bf27d4 | |||
5117d1e3c3 | |||
b8ecc0bca0 | |||
34299fa651 | |||
fd89e54295 | |||
7455891097 | |||
944fbc071b | |||
b6b06e6853 | |||
c4b72aebf8 | |||
b72f6dfac3 | |||
aa85d294c5 | |||
b03d8bfb65 | |||
4094834446 | |||
5c7bf24c56 | |||
738c249a3e | |||
b8656aa231 | |||
903b497525 | |||
2c9f19b2e5 | |||
1c63450213 | |||
1beceb21a8 | |||
ec40f43c9e | |||
a4d0654f28 | |||
3ca368755b | |||
86fedee9ed | |||
fc91384a76 | |||
2e8cfd00d2 | |||
6c67556756 | |||
8e892c14bc | |||
adcf49d729 | |||
22d79491ce | |||
1b23d1e435 | |||
1c2063ef82 | |||
d48a6c8315 | |||
1185480b91 | |||
afddfe5217 | |||
159ffe0728 | |||
3c3da30966 | |||
d4b249a59b | |||
|
06256f7a4d | ||
|
be6fc3adfd | ||
|
5ccf5b81e2 | ||
|
d06a2cee2f | ||
|
a7525184ef | ||
|
ae9865749a | ||
|
b2482b3cfd | ||
|
41988da3ed | ||
55d450be69 | |||
ae2ade8680 | |||
d7ec7e254e | |||
4bd7aee8ea | |||
bf711c2bb6 | |||
eb9e6679c4 | |||
96c801cdbd | |||
ee844fd348 | |||
d06c7059bb | |||
d36f2f0c33 | |||
4bcf925b28 | |||
484e75ac34 | |||
ad792f32dd | |||
05b7c7ab45 | |||
d94a097443 | |||
645e46dc01 | |||
5c87851ab8 | |||
0fd3bd262b | |||
732e35d295 | |||
e9135c42af | |||
a850243c59 | |||
8dc75feb8d | |||
ac7160c3a3 | |||
1cdcd332d4 | |||
5e10df8e5a | |||
e67677d57d | |||
d5b5e8d612 | |||
bbee7923e4 | |||
04be5f88eb | |||
3c626908f1 | |||
821b2f95b0 | |||
c0753c185f | |||
dad659e2ed | |||
d1f1ae271a | |||
7bd18cb927 | |||
56b5adac16 | |||
56180af583 |
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,3 +1,9 @@
|
|||||||
node_modules
|
node_modules/
|
||||||
|
assets/
|
||||||
docs/
|
docs/
|
||||||
coverage/
|
public/
|
||||||
|
pages/
|
||||||
|
coverage/
|
||||||
|
.nogit/
|
||||||
|
dist/assets/
|
||||||
|
test/assets/
|
38
.gitlab-ci.yml
Normal file
38
.gitlab-ci.yml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
image: hosttoday/ht-docker-node:npmts
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- test1
|
||||||
|
- test2
|
||||||
|
- release
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- npmci prepare ssh
|
||||||
|
|
||||||
|
testLTS:
|
||||||
|
stage: test1
|
||||||
|
script:
|
||||||
|
- npmci test lts
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- lossless
|
||||||
|
|
||||||
|
testSTABLE:
|
||||||
|
stage: test2
|
||||||
|
script:
|
||||||
|
- npmci test stable
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- lossless
|
||||||
|
|
||||||
|
release:
|
||||||
|
stage: release
|
||||||
|
script:
|
||||||
|
- npmci publish npm
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
tags:
|
||||||
|
- lossless
|
47
README.md
47
README.md
@ -1,16 +1,51 @@
|
|||||||
# Cert
|
# Cert
|
||||||
Easily obain SSL certificates from LetsEncrypt. Supports DNS-01 challenge. TypeScript ready.
|
Easily obain SSL certificates from LetsEncrypt. Supports DNS-01 challenge. TypeScript ready.
|
||||||
|
|
||||||
|
## Availabililty
|
||||||
|
[](https://www.npmjs.com/package/cert)
|
||||||
|
[](https://gitlab.com/pushrocks/cert)
|
||||||
|
[](https://github.com/pushrocks/cert)
|
||||||
|
[](https://pushrocks.gitlab.io/cert/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
[](https://gitlab.com/pushrocks/cert/commits/master)
|
||||||
|
[](https://gitlab.com/pushrocks/cert/commits/master)
|
||||||
|
[](https://david-dm.org/pushrocks/cert)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/cert/master/dependencies/npm)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/cert)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](http://standardjs.com/)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import {Cert} from "cert";
|
import {Cert} from "cert";
|
||||||
|
|
||||||
myCert = new Cert({
|
let myCert = new Cert({
|
||||||
cfEmail = "some@cloudflare.email",
|
cfEmail: "some@cloudflare.email",
|
||||||
cfKey = "someCloudflareApiKey",
|
cfKey: "someCloudflareApiKey",
|
||||||
outputPath = "someOutputPath" // NOTE: if you already have certificates, make sure you put them in here, so cert only requires the missing ones
|
sslDir: "someOutputPath", // NOTE: if you already have certificates, make sure you put them in here, so cert only requires the missing ones
|
||||||
|
gitOriginRepo: "git@githhub.com/someuser/somereopo" // good for persistence in highly volatile environments like docker
|
||||||
});
|
});
|
||||||
|
|
||||||
myCert.getDomainCert("example.com");
|
myCert.getDomainCert("example.com"); // returns promise
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **Note:** cert supports async parallel cert fetching.
|
||||||
|
However any subsequent calls will wait for the queue of the same dns zone to clear.
|
||||||
|
In other words: test1.domain1.tld and test2.domain2.tld will run in parallel, but test2.domain1.tld will wait for test1.domain1.tld !
|
||||||
|
|
||||||
|
## sslDir
|
||||||
|
to use the certificates it is important to understand what the structure of the ssl directory looks like.
|
||||||
|
|
||||||
|
## using a git origin repo.
|
||||||
|
Often times you want to keep track of certificates in order to keep them
|
||||||
|
even if the point of initial certificate request is gone. Imagine you have a dockerenvironement
|
||||||
|
and you keep starting new container versions for the same domain. YOu ideally want to use a proxy
|
||||||
|
that handles SSL managemet for you. But even the proxy needs to be updated from time to time.
|
||||||
|
|
||||||
|
So you need some kind of persistence between versions. This is why you can sync up all certificates to a git repo over ssh
|
||||||
|
Just make sure your id_rsa is in place for the node user and is allowed for the origin repo.
|
||||||
|
|
||||||
|
[](https://push.rocks)
|
||||||
|
43
dist/cert.classes.cert.d.ts
vendored
Normal file
43
dist/cert.classes.cert.d.ts
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/// <reference types="q" />
|
||||||
|
import * as q from 'q';
|
||||||
|
import { Stringmap, Objectmap } from 'lik';
|
||||||
|
import { Certificate } from './cert.classes.certificate';
|
||||||
|
import { Letsencrypt, TLeEnv } from './cert.classes.letsencrypt';
|
||||||
|
export interface ICertConstructorOptions {
|
||||||
|
cfEmail: string;
|
||||||
|
cfKey: string;
|
||||||
|
sslDirPath?: string;
|
||||||
|
gitOriginRepo?: string;
|
||||||
|
leEnv?: TLeEnv;
|
||||||
|
}
|
||||||
|
export declare class Cert {
|
||||||
|
domainStringRequestMap: Stringmap;
|
||||||
|
certificateMap: Objectmap<Certificate>;
|
||||||
|
letsencrypt: Letsencrypt;
|
||||||
|
private _challengeHandler;
|
||||||
|
private _certRepo;
|
||||||
|
/**
|
||||||
|
* Constructor for Cert object
|
||||||
|
*/
|
||||||
|
constructor(optionsArg: ICertConstructorOptions);
|
||||||
|
/**
|
||||||
|
* setup the Cert instanceof
|
||||||
|
* @executes ASYNC
|
||||||
|
* @return Promise
|
||||||
|
*/
|
||||||
|
setup(): q.Promise<{}>;
|
||||||
|
/**
|
||||||
|
* adds a Certificate for a given domain
|
||||||
|
*/
|
||||||
|
addCertificate(domainNameArg: string, optionsArg?: {
|
||||||
|
force: boolean;
|
||||||
|
}): q.Promise<{}>;
|
||||||
|
/**
|
||||||
|
* cleans up old certificates
|
||||||
|
*/
|
||||||
|
cleanOldCertificates(): void;
|
||||||
|
/**
|
||||||
|
* executes the current batch of jobs
|
||||||
|
*/
|
||||||
|
deploy(): void;
|
||||||
|
}
|
75
dist/cert.classes.cert.js
vendored
Normal file
75
dist/cert.classes.cert.js
vendored
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
"use strict";
|
||||||
|
const q = require("q");
|
||||||
|
const lik_1 = require("lik");
|
||||||
|
// classes
|
||||||
|
const cert_classes_certificate_1 = require("./cert.classes.certificate");
|
||||||
|
const cert_classes_certrepo_1 = require("./cert.classes.certrepo");
|
||||||
|
const cert_classes_letsencrypt_1 = require("./cert.classes.letsencrypt");
|
||||||
|
const cert_classes_challengehandler_1 = require("./cert.classes.challengehandler");
|
||||||
|
class Cert {
|
||||||
|
/**
|
||||||
|
* Constructor for Cert object
|
||||||
|
*/
|
||||||
|
constructor(optionsArg) {
|
||||||
|
this.domainStringRequestMap = new lik_1.Stringmap();
|
||||||
|
this.certificateMap = new lik_1.Objectmap();
|
||||||
|
// set up challengehandler
|
||||||
|
this._challengeHandler = new cert_classes_challengehandler_1.ChallengeHandler({
|
||||||
|
cfEmail: optionsArg.cfEmail,
|
||||||
|
cfKey: optionsArg.cfKey
|
||||||
|
});
|
||||||
|
// setup Letsencrypt
|
||||||
|
this.letsencrypt = new cert_classes_letsencrypt_1.Letsencrypt({
|
||||||
|
leEnv: optionsArg.leEnv,
|
||||||
|
sslDir: optionsArg.sslDirPath,
|
||||||
|
challengeHandler: this._challengeHandler
|
||||||
|
});
|
||||||
|
this._certRepo = new cert_classes_certrepo_1.CertRepo({
|
||||||
|
sslDirPath: optionsArg.sslDirPath,
|
||||||
|
remoteGitUrl: optionsArg.gitOriginRepo,
|
||||||
|
certInstance: this
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* setup the Cert instanceof
|
||||||
|
* @executes ASYNC
|
||||||
|
* @return Promise
|
||||||
|
*/
|
||||||
|
setup() {
|
||||||
|
return this._certRepo.setup();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* adds a Certificate for a given domain
|
||||||
|
*/
|
||||||
|
addCertificate(domainNameArg, optionsArg = { force: false }) {
|
||||||
|
let done = q.defer();
|
||||||
|
let certificateForDomain = this.certificateMap.find((certificate) => {
|
||||||
|
return certificate.domainName === domainNameArg;
|
||||||
|
});
|
||||||
|
if (certificateForDomain instanceof cert_classes_certificate_1.Certificate) {
|
||||||
|
certificateForDomain.renew()
|
||||||
|
.then(done.resolve);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
certificateForDomain = new cert_classes_certificate_1.Certificate({
|
||||||
|
certInstance: this,
|
||||||
|
domainName: domainNameArg
|
||||||
|
});
|
||||||
|
certificateForDomain.renew()
|
||||||
|
.then(done.resolve);
|
||||||
|
}
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* cleans up old certificates
|
||||||
|
*/
|
||||||
|
cleanOldCertificates() {
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* executes the current batch of jobs
|
||||||
|
*/
|
||||||
|
deploy() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.Cert = Cert;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2VydC5jbGFzc2VzLmNlcnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9jZXJ0LmNsYXNzZXMuY2VydC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsdUJBQXNCO0FBQ3RCLDZCQUEwQztBQUsxQyxVQUFVO0FBQ1YseUVBQXdEO0FBQ3hELG1FQUFrRDtBQUNsRCx5RUFBZ0U7QUFDaEUsbUZBQWtFO0FBV2xFO0lBT0k7O09BRUc7SUFDSCxZQUFZLFVBQW1DO1FBVC9DLDJCQUFzQixHQUFHLElBQUksZUFBUyxFQUFFLENBQUE7UUFDeEMsbUJBQWMsR0FBRyxJQUFJLGVBQVMsRUFBZSxDQUFBO1FBVXpDLDBCQUEwQjtRQUMxQixJQUFJLENBQUMsaUJBQWlCLEdBQUcsSUFBSSxnREFBZ0IsQ0FBQztZQUMxQyxPQUFPLEVBQUUsVUFBVSxDQ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UFBRTtpQkFDdkIsSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQTtRQUMzQixDQUFDO1FBQUMsSUFBSSxDQUFDLENBQUM7WUFDSixvQkFBb0IsR0FBRyxJQUFJLHNDQUFXLENBQUM7Z0JBQ25DLFlBQVksRUFBRSxJQUFJO2dCQUNsQixVQUFVLEVBQUUsYUFBYTthQUM1QixDQUFDLENBQUE7WUFDRixvQkFBb0IsQ0FBQyxLQUFLLEVBQUU7aUJBQ3ZCLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUE7UUFDM0IsQ0FBQztRQUNELE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0lBQ3ZCLENBQUM7SUFFRDs7T0FFRztJQUNILG9CQUFvQjtJQUVwQixDQUFDO0lBRUQ7O09BRUc7SUFDSCxNQUFNO0lBRU4sQ0FBQztDQUNKO0FBNUVELG9CQTRFQyJ9
|
48
dist/cert.classes.certificate.d.ts
vendored
Normal file
48
dist/cert.classes.certificate.d.ts
vendored
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/// <reference types="q" />
|
||||||
|
import * as q from 'q';
|
||||||
|
import * as plugins from './cert.plugins';
|
||||||
|
import { Cert } from './cert.classes.cert';
|
||||||
|
export interface ICertificateFsConfig {
|
||||||
|
domainName: string;
|
||||||
|
creationTime: number;
|
||||||
|
expiryTime: number;
|
||||||
|
}
|
||||||
|
export interface ICertificateConstructorOptions {
|
||||||
|
domainName: string;
|
||||||
|
certInstance: Cert;
|
||||||
|
}
|
||||||
|
export declare type TCertificateStatus = 'unregistered' | 'valid' | 'expiring' | 'expired';
|
||||||
|
export declare class Certificate {
|
||||||
|
domainName: string;
|
||||||
|
certInstance: Cert;
|
||||||
|
domainData: plugins.smartstring.Domain;
|
||||||
|
creationDate: Date;
|
||||||
|
expiryDate: Date;
|
||||||
|
publicKey: string;
|
||||||
|
privKey: string;
|
||||||
|
/**
|
||||||
|
* run when creating a new instance of Certificate
|
||||||
|
*/
|
||||||
|
constructor(optionsArg: ICertificateConstructorOptions);
|
||||||
|
/**
|
||||||
|
* the status of the Certificate
|
||||||
|
*/
|
||||||
|
readonly status: TCertificateStatus;
|
||||||
|
readonly sameZoneRequesting: boolean;
|
||||||
|
/**
|
||||||
|
* schedule a retry of certificate request
|
||||||
|
*/
|
||||||
|
scheduleRetry(): q.Promise<{}>;
|
||||||
|
/**
|
||||||
|
* renew certificate if needed
|
||||||
|
*/
|
||||||
|
renew(force?: boolean): q.Promise<{}>;
|
||||||
|
/**
|
||||||
|
* syncFs syncs the certificate with disk
|
||||||
|
*/
|
||||||
|
syncFs(): void;
|
||||||
|
/**
|
||||||
|
* deletes the certificate
|
||||||
|
*/
|
||||||
|
delete(): void;
|
||||||
|
}
|
103
dist/cert.classes.certificate.js
vendored
Normal file
103
dist/cert.classes.certificate.js
vendored
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
"use strict";
|
||||||
|
const q = require("q");
|
||||||
|
const plugins = require("./cert.plugins");
|
||||||
|
class Certificate {
|
||||||
|
/**
|
||||||
|
* run when creating a new instance of Certificate
|
||||||
|
*/
|
||||||
|
constructor(optionsArg) {
|
||||||
|
this.creationDate = null;
|
||||||
|
this.expiryDate = null;
|
||||||
|
this.publicKey = null;
|
||||||
|
this.privKey = null;
|
||||||
|
this.domainName = optionsArg.domainName;
|
||||||
|
this.domainData = new plugins.smartstring.Domain(this.domainName);
|
||||||
|
this.certInstance = optionsArg.certInstance;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* the status of the Certificate
|
||||||
|
*/
|
||||||
|
get status() {
|
||||||
|
let validTimeRemaining = 0;
|
||||||
|
if (this.creationDate !== null && this.expiryDate !== null) {
|
||||||
|
validTimeRemaining = this.expiryDate.getTime() - Date.now();
|
||||||
|
}
|
||||||
|
let MonthMilliseconds = 2629746000;
|
||||||
|
if (this.publicKey === null || this.privKey === null) {
|
||||||
|
return 'unregistered';
|
||||||
|
}
|
||||||
|
else if (validTimeRemaining >= MonthMilliseconds) {
|
||||||
|
return 'valid';
|
||||||
|
}
|
||||||
|
else if (validTimeRemaining < MonthMilliseconds && validTimeRemaining >= 0) {
|
||||||
|
return 'expiring';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 'expired';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get sameZoneRequesting() {
|
||||||
|
return this.certInstance.domainStringRequestMap.checkMinimatch('*' + this.domainData.zoneName);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* schedule a retry of certificate request
|
||||||
|
*/
|
||||||
|
scheduleRetry() {
|
||||||
|
let done = plugins.q.defer();
|
||||||
|
setTimeout(() => {
|
||||||
|
this.renew()
|
||||||
|
.then(done.resolve);
|
||||||
|
}, 60000);
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* renew certificate if needed
|
||||||
|
*/
|
||||||
|
renew(force = false) {
|
||||||
|
let done = q.defer();
|
||||||
|
if (this.status === 'valid') {
|
||||||
|
plugins.beautylog.log('Certificate still valid for more than 1 month, so it is not renewed now');
|
||||||
|
done.resolve();
|
||||||
|
}
|
||||||
|
else if (this.status === 'expiring' || this.status === 'expired' || this.status === 'unregistered') {
|
||||||
|
plugins.beautylog.info('Certificate not valid currently, going to renew now!');
|
||||||
|
if (this.sameZoneRequesting) {
|
||||||
|
this.certInstance.domainStringRequestMap.registerUntilTrue(() => {
|
||||||
|
return !this.sameZoneRequesting;
|
||||||
|
}, () => {
|
||||||
|
this.renew().then(done.resolve);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.certInstance.letsencrypt.registerDomain(this.domainName)
|
||||||
|
.then(() => {
|
||||||
|
return this.syncFs();
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
done.resolve();
|
||||||
|
}).catch((err) => { console.log(err); });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw Error(`weird status for certificate with domain name ${this.domainName}`);
|
||||||
|
}
|
||||||
|
done.resolve();
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* syncFs syncs the certificate with disk
|
||||||
|
*/
|
||||||
|
syncFs() {
|
||||||
|
let configJsonMemory = {
|
||||||
|
domainName: this.domainName,
|
||||||
|
creationTime: this.creationDate.getTime(),
|
||||||
|
expiryTime: this.expiryDate.getTime()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* deletes the certificate
|
||||||
|
*/
|
||||||
|
delete() { }
|
||||||
|
}
|
||||||
|
exports.Certificate = Certificate;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2VydC5jbGFzc2VzLmNlcnRpZmljYXRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvY2VydC5jbGFzc2VzLmNlcnRpZmljYXRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSx1QkFBc0I7QUFFdEIsMENBQXlDO0FBcUJ6QztJQVNJOztPQUVHO0lBQ0gsWUFBWSxVQUEwQztRQVJ0RCxpQkFBWSxHQUFTLElBQUksQ0FBQTtRQUN6QixlQUFVLEdBQVMsSUFBSSxDQUFBO1FBQ3ZCLGNBQVMsR0FBVyxJQUFJLENBQUE7UUFDeEIsWUFBTyxHQUFXLElBQUksQ0FBQTtRQU1sQixJQUFJLENBQUMsVUFBVSxHQUFHLFVBQVUsQ0FBQyxVQUFVLENBQUE7UUFDdkMsSUFBSSxDQUFDLFVBQVUsR0FBRyxJQUFJLE9BQU8sQ0FBQyxXQUFXLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsQ0FBQTtRQUNqRSxJQUFJLENBQUMsWUFBWSxHQUFHLFVBQVUsQ0FBQyxZQUFZLENBQUE7SUFDL0MsQ0FBQztJQUVEOztPQUVHO0lBQ0gsSUFBSSxNQUFNO1FBQ04sSUFBSSxrQkFBa0Is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EMsQ0FBQTtJQUVMLENBQUM7SUFFRDs7T0FFRztJQUNILE1BQU0sS0FBSyxDQUFDO0NBQ2Y7QUF6R0Qsa0NBeUdDIn0=
|
31
dist/cert.classes.certrepo.d.ts
vendored
Normal file
31
dist/cert.classes.certrepo.d.ts
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/// <reference types="q" />
|
||||||
|
import * as q from 'q';
|
||||||
|
import { Cert } from './cert.classes.cert';
|
||||||
|
export interface ICertRepoConstructorOptions {
|
||||||
|
sslDirPath: string;
|
||||||
|
remoteGitUrl: string;
|
||||||
|
certInstance: Cert;
|
||||||
|
}
|
||||||
|
export declare class CertRepo {
|
||||||
|
private _sslDirPath;
|
||||||
|
private _remoteGitUrl;
|
||||||
|
private gitRepo;
|
||||||
|
private _certInstance;
|
||||||
|
constructor(optionsArg: ICertRepoConstructorOptions);
|
||||||
|
/**
|
||||||
|
* setup the Cert instance
|
||||||
|
*/
|
||||||
|
setup(): q.Promise<{}>;
|
||||||
|
/**
|
||||||
|
* syncs an objectmap of Certificates with repo
|
||||||
|
*/
|
||||||
|
syncFs(): q.Promise<{}>;
|
||||||
|
/**
|
||||||
|
* Pulls already requested certificates from git origin
|
||||||
|
*/
|
||||||
|
sslGitOriginPull: () => void;
|
||||||
|
/**
|
||||||
|
* Pushes all new requested certificates to git origin
|
||||||
|
*/
|
||||||
|
sslGitOriginAddCommitPush: () => void;
|
||||||
|
}
|
59
dist/cert.classes.certrepo.js
vendored
Normal file
59
dist/cert.classes.certrepo.js
vendored
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
"use strict";
|
||||||
|
const q = require("q");
|
||||||
|
const plugins = require("./cert.plugins");
|
||||||
|
const paths = require("./cert.paths");
|
||||||
|
class CertRepo {
|
||||||
|
constructor(optionsArg) {
|
||||||
|
/**
|
||||||
|
* Pulls already requested certificates from git origin
|
||||||
|
*/
|
||||||
|
this.sslGitOriginPull = () => {
|
||||||
|
if (this.gitRepo) {
|
||||||
|
this.gitRepo.pull('origin', 'master');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Pushes all new requested certificates to git origin
|
||||||
|
*/
|
||||||
|
this.sslGitOriginAddCommitPush = () => {
|
||||||
|
if (this._remoteGitUrl) {
|
||||||
|
this.gitRepo.addAll();
|
||||||
|
this.gitRepo.commit('added new SSL certificates and deleted obsolete ones.');
|
||||||
|
this.gitRepo.push('origin', 'master');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this._sslDirPath = optionsArg.sslDirPath;
|
||||||
|
this._remoteGitUrl = optionsArg.remoteGitUrl;
|
||||||
|
this._certInstance = optionsArg.certInstance;
|
||||||
|
// setup sslDir
|
||||||
|
if (!this._sslDirPath) {
|
||||||
|
this._sslDirPath = paths.defaultSslDir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* setup the Cert instance
|
||||||
|
*/
|
||||||
|
setup() {
|
||||||
|
// setup Git
|
||||||
|
let done = q.defer();
|
||||||
|
if (this._remoteGitUrl) {
|
||||||
|
plugins.smartfile.fs.ensureEmptyDirSync(paths.defaultSslDir);
|
||||||
|
plugins.smartgit.createRepoFromClone(this._remoteGitUrl, paths.defaultSslDir)
|
||||||
|
.then(gitRepoArg => {
|
||||||
|
this.gitRepo = gitRepoArg;
|
||||||
|
done.resolve();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* syncs an objectmap of Certificates with repo
|
||||||
|
*/
|
||||||
|
syncFs() {
|
||||||
|
let done = q.defer();
|
||||||
|
done.resolve();
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.CertRepo = CertRepo;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2VydC5jbGFzc2VzLmNlcnRyZXBvLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvY2VydC5jbGFz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RQUMxQyxDQUFDO0lBQ0wsQ0FBQztJQUVEOztPQUVHO0lBQ0gsS0FBSztRQUNELFlBQVk7UUFDWixJQUFJLElBQUksR0FBRyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUE7UUFDcEIsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLGFBQWEsQ0FBQyxDQUFDLENBQUM7WUFDckIsT0FBTyxDQUFDLFNBQVMsQ0FBQyxFQUFFLENBQUMsa0JBQWtCLENBQUMsS0FBSyxDQUFDLGFBQWEsQ0FBQyxDQUFBO1lBQzVELE9BQU8sQ0FBQyxRQUFRLENBQUMsbUJBQW1CLENBQUMsSUFBSSxDQUFDLGFBQWEsRUFBRSxLQUFLLENBQUMsYUFBYSxDQUFDO2lCQUN4RSxJQUFJLENBQUMsVUFBVTtnQkFDWixJQUFJLENBQUMsT0FBTyxHQUFHLFVBQVUsQ0FBQTtnQkFDekIsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFBO1lBQ2xCLENBQUMsQ0FBQyxDQUFBO1FBQ1YsQ0FBQztRQUNELE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0lBQ3ZCLENBQUM7SUFFRDs7T0FFRztJQUNILE1BQU07UUFDRixJQUFJLElBQUksR0FBRyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUE7UUFDcEIsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFBO1FBQ2QsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7SUFDdkIsQ0FBQztDQXFCSjtBQTdERCw0QkE2REMifQ==
|
20
dist/cert.classes.challengehandler.d.ts
vendored
Normal file
20
dist/cert.classes.challengehandler.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/// <reference types="q" />
|
||||||
|
export interface IChallengehandlerConstructorOptions {
|
||||||
|
cfEmail: string;
|
||||||
|
cfKey: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* class ChallengeHandler handles challenges
|
||||||
|
*/
|
||||||
|
export declare class ChallengeHandler {
|
||||||
|
private _cfInstance;
|
||||||
|
constructor(optionsArg: IChallengehandlerConstructorOptions);
|
||||||
|
/**
|
||||||
|
* set a challenge
|
||||||
|
*/
|
||||||
|
setChallenge(domainNameArg: string, challengeArg: string): Q.Promise<{}>;
|
||||||
|
/**
|
||||||
|
* cleans a challenge
|
||||||
|
*/
|
||||||
|
cleanChallenge(domainNameArg: any): Q.Promise<{}>;
|
||||||
|
}
|
75
dist/cert.classes.challengehandler.js
vendored
Normal file
75
dist/cert.classes.challengehandler.js
vendored
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
"use strict";
|
||||||
|
const plugins = require("./cert.plugins");
|
||||||
|
/**
|
||||||
|
* class ChallengeHandler handles challenges
|
||||||
|
*/
|
||||||
|
class ChallengeHandler {
|
||||||
|
constructor(optionsArg) {
|
||||||
|
this._cfInstance = new plugins.cflare.CflareAccount();
|
||||||
|
this._cfInstance.auth({
|
||||||
|
email: optionsArg.cfEmail,
|
||||||
|
key: optionsArg.cfKey
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* set a challenge
|
||||||
|
*/
|
||||||
|
setChallenge(domainNameArg, challengeArg) {
|
||||||
|
let done = plugins.q.defer();
|
||||||
|
plugins.beautylog.log('setting challenge for ' + domainNameArg);
|
||||||
|
this._cfInstance.createRecord(prefixName(domainNameArg), 'TXT', challengeArg).then(() => {
|
||||||
|
plugins.beautylog.ok('Challenge has been set!');
|
||||||
|
plugins.beautylog.info('We need to cool down to let DNS propagate to edge locations!');
|
||||||
|
cooldown().then(() => {
|
||||||
|
done.resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* cleans a challenge
|
||||||
|
*/
|
||||||
|
cleanChallenge(domainNameArg) {
|
||||||
|
let done = plugins.q.defer();
|
||||||
|
plugins.beautylog.log('cleaning challenge for ' + domainNameArg);
|
||||||
|
this._cfInstance.removeRecord(prefixName(domainNameArg), 'TXT');
|
||||||
|
cooldown().then(() => {
|
||||||
|
done.resolve();
|
||||||
|
});
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ChallengeHandler = ChallengeHandler;
|
||||||
|
/**
|
||||||
|
* cooldown timer for letting DNS settle before answering the challengerequest
|
||||||
|
*/
|
||||||
|
let cooldown = () => {
|
||||||
|
let done = plugins.q.defer();
|
||||||
|
let cooldowntime = 60000;
|
||||||
|
let passedTime = 0;
|
||||||
|
plugins.beautylog.log('Cooling down! ' + (cooldowntime / 1000).toString() + ' seconds left');
|
||||||
|
let coolDownCounter = () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
if (cooldowntime <= passedTime) {
|
||||||
|
plugins.beautylog.ok('Cooled down!');
|
||||||
|
done.resolve();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
passedTime = passedTime + 5000;
|
||||||
|
plugins.beautylog.log('Cooling down! '
|
||||||
|
+ ((cooldowntime - passedTime) / 1000).toString()
|
||||||
|
+ ' seconds left');
|
||||||
|
coolDownCounter();
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
|
};
|
||||||
|
coolDownCounter();
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* prefix a domain name to make sure it complies with letsencrypt
|
||||||
|
*/
|
||||||
|
let prefixName = (domainNameArg) => {
|
||||||
|
return '_acme-challenge.' + domainNameArg;
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2VydC5jbGFzc2VzLmNoYWxsZW5nZWhhbmRsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9jZXJ0LmNsYXNzZXMuY2hhbGxlbmdlaGFuZGxlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMENBQXlDO0FBUXpDOztHQUVHO0FBQ0g7SUFFSSxZQ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yxVQUFVLEdBQUcsSUFBSSxDQUFBO2dCQUM5QixPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxnQkFBZ0I7c0JBQ2hDLENBQUMsQ0FBQyxZQUFZLEdBQUcsVUFBVSxDQUFDLEdBQUcsSUFBSSxDQUFDLENBQUMsUUFBUSxFQUFFO3NCQUMvQyxlQUFlLENBQ3BCLENBQUE7Z0JBQ0QsZUFBZSxFQUFFLENBQUE7WUFDckIsQ0FBQztRQUNMLENBQUMsRUFBRSxJQUFJLENBQUMsQ0FBQTtJQUNaLENBQUMsQ0FBQTtJQUNELGVBQWUsRUFBRSxDQUFBO0lBQ2pCLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0FBQ3ZCLENBQUMsQ0FBQTtBQUVEOztHQUVHO0FBQ0gsSUFBSSxVQUFVLEdBQUcsQ0FBQyxhQUFxQjtJQUNuQyxNQUFNLENBQUMsa0JBQWtCLEdBQUcsYUFBYSxDQUFBO0FBQzdDLENBQUMsQ0FBQSJ9
|
26
dist/cert.classes.letsencrypt.d.ts
vendored
Normal file
26
dist/cert.classes.letsencrypt.d.ts
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/// <reference types="q" />
|
||||||
|
import * as q from 'q';
|
||||||
|
import { ChallengeHandler } from './cert.classes.challengehandler';
|
||||||
|
export declare type TLeEnv = 'production' | 'staging';
|
||||||
|
export interface ILetsencryptConstructorOptions {
|
||||||
|
leEnv: TLeEnv;
|
||||||
|
challengeHandler: ChallengeHandler;
|
||||||
|
sslDir: string;
|
||||||
|
}
|
||||||
|
export declare class Letsencrypt {
|
||||||
|
leEnv: TLeEnv;
|
||||||
|
challengeHandler: ChallengeHandler;
|
||||||
|
sslDir: string;
|
||||||
|
private _leInstance;
|
||||||
|
private _leServerUrl;
|
||||||
|
constructor(optionsArg: ILetsencryptConstructorOptions);
|
||||||
|
/**
|
||||||
|
* register a domain
|
||||||
|
*/
|
||||||
|
registerDomain(domainNameArg: string): q.Promise<{}>;
|
||||||
|
private _leCopyToDestination(domainNameArg);
|
||||||
|
/**
|
||||||
|
* translates to the format expected by letsencrypt node implementation
|
||||||
|
*/
|
||||||
|
private _leChallengeHandler();
|
||||||
|
}
|
136
dist/cert.classes.letsencrypt.js
vendored
Normal file
136
dist/cert.classes.letsencrypt.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
dist/cert.paths.d.ts
vendored
Normal file
4
dist/cert.paths.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export declare let projectDir: string;
|
||||||
|
export declare let assetDir: string;
|
||||||
|
export declare let defaultSslDir: string;
|
||||||
|
export declare let leConfigDir: string;
|
10
dist/cert.paths.js
vendored
Normal file
10
dist/cert.paths.js
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
"use strict";
|
||||||
|
const plugins = require("./cert.plugins");
|
||||||
|
// dirs
|
||||||
|
exports.projectDir = plugins.path.join(__dirname, '../');
|
||||||
|
exports.assetDir = plugins.path.join(exports.projectDir, 'assets');
|
||||||
|
exports.defaultSslDir = plugins.path.join(exports.assetDir, 'defaultSslDir');
|
||||||
|
exports.leConfigDir = plugins.path.join(exports.assetDir, 'letsencrypt');
|
||||||
|
plugins.smartfile.fs.ensureDirSync(exports.leConfigDir);
|
||||||
|
plugins.smartfile.fs.ensureDirSync(exports.defaultSslDir);
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2VydC5wYXRocy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2NlcnQucGF0aHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBDQUF5QztBQUV6QyxPQUFPO0FBQ0ksUUFBQSxVQUFVLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFDLEtBQUssQ0FBQyxDQUFBO0FBQy9DLFFBQUEsUUFBUSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLGtCQUFVLEVBQUMsUUFBUSxDQUFDLENBQUE7QUFDakQsUUFBQSxhQUFhLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsZ0JBQVEsRUFBQyxlQUFlLENBQUMsQ0FBQTtBQUMzRCxRQUFBLFdBQVcsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxnQkFBUSxFQUFDLGFBQWEsQ0FBQyxDQUFBO0FBQ2xFLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLGFBQWEsQ0FBQyxtQkFBVyxDQUFDLENBQUE7QUFDL0MsT0FBTyxDQUFDLFNBQVMsQ0FBQyxFQUFFLENBQUMsYUFBYSxDQUFDLHFCQUFhLENBQUMsQ0FBQSJ9
|
13
dist/cert.plugins.d.ts
vendored
Normal file
13
dist/cert.plugins.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import 'typings-global';
|
||||||
|
import * as beautylog from 'beautylog';
|
||||||
|
import * as cflare from 'cflare';
|
||||||
|
declare let fs: any;
|
||||||
|
import * as lik from 'lik';
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as q from 'q';
|
||||||
|
import * as shelljs from 'shelljs';
|
||||||
|
import * as smartcli from 'smartcli';
|
||||||
|
import * as smartfile from 'smartfile';
|
||||||
|
import * as smartgit from 'smartgit';
|
||||||
|
import * as smartstring from 'smartstring';
|
||||||
|
export { beautylog, cflare, fs, lik, path, q, shelljs, smartcli, smartfile, smartgit, smartstring };
|
25
dist/cert.plugins.js
vendored
Normal file
25
dist/cert.plugins.js
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
"use strict";
|
||||||
|
require("typings-global");
|
||||||
|
const beautylog = require("beautylog");
|
||||||
|
exports.beautylog = beautylog;
|
||||||
|
const cflare = require("cflare");
|
||||||
|
exports.cflare = cflare;
|
||||||
|
let fs = require('fs-extra');
|
||||||
|
exports.fs = fs;
|
||||||
|
const lik = require("lik");
|
||||||
|
exports.lik = lik;
|
||||||
|
const path = require("path");
|
||||||
|
exports.path = path;
|
||||||
|
const q = require("q");
|
||||||
|
exports.q = q;
|
||||||
|
const shelljs = require("shelljs");
|
||||||
|
exports.shelljs = shelljs;
|
||||||
|
const smartcli = require("smartcli");
|
||||||
|
exports.smartcli = smartcli;
|
||||||
|
const smartfile = require("smartfile");
|
||||||
|
exports.smartfile = smartfile;
|
||||||
|
const smartgit = require("smartgit");
|
||||||
|
exports.smartgit = smartgit;
|
||||||
|
const smartstring = require("smartstring");
|
||||||
|
exports.smartstring = smartstring;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2VydC5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvY2VydC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwwQkFBdUI7QUFDdkIsdUNBQXNDO0FBYWxDLDhCQUFTO0FBWmIsaUNBQWdDO0FBYTVCLHdCQUFNO0FBWlYsSUFBSSxFQUFFLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFBO0FBYXhCLGdCQUFFO0FBWk4sMkJBQTBCO0FBYXRCLGtCQUFHO0FBWlAsNkJBQTRCO0FBYXhCLG9CQUFJO0FBWlIsdUJBQXNCO0FBYWxCLGNBQUM7QUFaTCxtQ0FBa0M7QUFhOUIsMEJBQU87QUFaWCxxQ0FBb0M7QUFhaEMsNEJBQVE7QUFaWix1Q0FBc0M7QUFhbEMsOEJBQVM7QUFaYixxQ0FBb0M7QUFhaEMsNEJBQVE7QUFaWiwyQ0FBMEM7QUFhdEMsa0NBQVcifQ==
|
1
dist/index.d.ts
vendored
Normal file
1
dist/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './cert.classes.cert';
|
6
dist/index.js
vendored
Normal file
6
dist/index.js
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
"use strict";
|
||||||
|
function __export(m) {
|
||||||
|
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||||
|
}
|
||||||
|
__export(require("./cert.classes.cert"));
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEseUNBQW1DIn0=
|
5
npmextra.json
Normal file
5
npmextra.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"npmts": {
|
||||||
|
"mode": "default"
|
||||||
|
}
|
||||||
|
}
|
36
package.json
36
package.json
@ -1,14 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "cert",
|
"name": "cert",
|
||||||
"version": "0.0.1",
|
"version": "1.0.8",
|
||||||
"description": "automatic cert generation for coreos clusters",
|
"description": "Easily obain SSL certificates from LetsEncrypt. Supports DNS-01 challenge. TypeScript ready.",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)"
|
"test": "(npm run cleanTest && npmts --nodocs)",
|
||||||
|
"cleanTest": "(rm -rf ./test/assets)",
|
||||||
|
"compile": "(npmts --notest)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/pushrocks/cert.git"
|
"url": "git+https://gitlab.com/pushrocks/cert.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"coreos",
|
"coreos",
|
||||||
@ -19,10 +22,29 @@
|
|||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/pushrocks/cert/issues"
|
"url": "https://gitlab.com/pushrocks/cert/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/pushrocks/cert#readme",
|
"homepage": "https://gitlab.com/pushrocks/cert#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"letsencrypt": "^1.4.4"
|
"@types/minimatch": "2.x.x",
|
||||||
|
"@types/q": "0.0.32",
|
||||||
|
"beautylog": "^6.0.0",
|
||||||
|
"cflare": "0.0.10",
|
||||||
|
"fs-extra": "^1.0.0",
|
||||||
|
"lik": "^1.0.27",
|
||||||
|
"q": "^1.4.1",
|
||||||
|
"smartacme": "^1.0.2",
|
||||||
|
"smartcli": "^2.0.1",
|
||||||
|
"smartfile": "^4.1.1",
|
||||||
|
"smartgit": "1.0.5",
|
||||||
|
"smartstring": "^2.0.22",
|
||||||
|
"typings-global": "^1.0.14"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/should": "^8.1.30",
|
||||||
|
"npmts-g": "^5.2.10",
|
||||||
|
"qenv": "^1.1.1",
|
||||||
|
"should": "^11.1.2",
|
||||||
|
"typings-test": "^1.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1656
pnpm-lock.yaml
generated
Normal file
1656
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
1
test/test.d.ts
vendored
Normal file
1
test/test.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
import 'typings-test';
|
43
test/test.js
Normal file
43
test/test.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
"use strict";
|
||||||
|
require("typings-test");
|
||||||
|
const should = require("should");
|
||||||
|
const qenv_1 = require("qenv");
|
||||||
|
const path = require("path");
|
||||||
|
const q = require("q");
|
||||||
|
const cert = require("../dist/index");
|
||||||
|
let testQenv = new qenv_1.Qenv(process.cwd(), process.cwd() + '/.nogit');
|
||||||
|
let testCert;
|
||||||
|
describe('cert', function () {
|
||||||
|
describe('Cert', function () {
|
||||||
|
it('should create a new Cert object from class', function () {
|
||||||
|
testCert = new cert.Cert({
|
||||||
|
cfEmail: process.env.CF_EMAIL,
|
||||||
|
cfKey: process.env.CF_KEY,
|
||||||
|
sslDirPath: path.join(process.cwd(), 'test/assets'),
|
||||||
|
gitOriginRepo: 'git@gitlab.com:sandboxzone/sandbox-sslorigin.git',
|
||||||
|
leEnv: 'staging'
|
||||||
|
});
|
||||||
|
should(testCert).be.instanceof(cert.Cert);
|
||||||
|
});
|
||||||
|
it('should run class Cert.setup() successful', function (done) {
|
||||||
|
this.timeout(40000);
|
||||||
|
testCert.setup().then(() => {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should get a valid certificate', function (done) {
|
||||||
|
this.timeout(1200000);
|
||||||
|
let promiseArray = [];
|
||||||
|
function getRandomArbitrary(min, max) {
|
||||||
|
return Math.floor(Math.random() * (max - min) + min);
|
||||||
|
}
|
||||||
|
promiseArray.push(testCert.addCertificate(`testing${getRandomArbitrary(1, 100000)}.bleu.de`));
|
||||||
|
// promiseArray.push(testCert.addCertificate(`testing${getRandomArbitrary(1,100000)}.bleu.de`))
|
||||||
|
// promiseArray.push(testCert.addCertificate(`testing${getRandomArbitrary(1,100000)}.bleu.de`))
|
||||||
|
q.all(promiseArray).then(() => {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQixpQ0FBZ0M7QUFDaEMsK0JBQXlCO0FBQ3pCLDZCQUE2QjtBQUM3Qix1QkFBdUI7QUFDdkIsc0NBQXFDO0FBR3JD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UksQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUE7WUFDckIsSUFBSSxZQUFZLEdBQUcsRUFBRSxDQUFBO1lBQ3JCLDRCQUE0QixHQUFHLEVBQUUsR0FBRztnQkFDaEMsTUFBTSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLE1BQU0sRUFBRSxHQUFHLENBQUMsR0FBRyxHQUFHLEdBQUcsQ0FBQyxHQUFHLEdBQUcsQ0FBQyxDQUFBO1lBQ3hELENBQUM7WUFDRCxZQUFZLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxjQUFjLENBQUMsVUFBVSxrQkFBa0IsQ0FBQyxDQUFDLEVBQUMsTUFBTSxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUE7WUFDNUYsK0ZBQStGO1lBQy9GLCtGQUErRjtZQUMvRixDQUFDLENBQUMsR0FBRyxDQUFDLFlBQVksQ0FBQyxDQUFDLElBQUksQ0FBQztnQkFDckIsSUFBSSxFQUFFLENBQUE7WUFDVixDQUFDLENBQUMsQ0FBQTtRQUNOLENBQUMsQ0FBQyxDQUFBO0lBQ04sQ0FBQyxDQUFDLENBQUE7QUFDTixDQUFDLENBQUMsQ0FBQSJ9
|
45
test/test.ts
Normal file
45
test/test.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import 'typings-test'
|
||||||
|
import * as should from 'should'
|
||||||
|
import {Qenv} from 'qenv'
|
||||||
|
import path = require('path')
|
||||||
|
import q = require('q')
|
||||||
|
import * as cert from '../dist/index'
|
||||||
|
|
||||||
|
|
||||||
|
let testQenv = new Qenv(process.cwd(), process.cwd() + '/.nogit')
|
||||||
|
|
||||||
|
let testCert: cert.Cert
|
||||||
|
|
||||||
|
describe('cert',function(){
|
||||||
|
describe('Cert',function(){
|
||||||
|
it('should create a new Cert object from class',function(){
|
||||||
|
testCert = new cert.Cert({
|
||||||
|
cfEmail: process.env.CF_EMAIL,
|
||||||
|
cfKey: process.env.CF_KEY,
|
||||||
|
sslDirPath: path.join(process.cwd(),'test/assets'),
|
||||||
|
gitOriginRepo: 'git@gitlab.com:sandboxzone/sandbox-sslorigin.git',
|
||||||
|
leEnv: 'staging'
|
||||||
|
})
|
||||||
|
should(testCert).be.instanceof(cert.Cert)
|
||||||
|
})
|
||||||
|
it('should run class Cert.setup() successful', function(done){
|
||||||
|
this.timeout(40000)
|
||||||
|
testCert.setup().then(() => {
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
it('should get a valid certificate',function(done){
|
||||||
|
this.timeout(1200000)
|
||||||
|
let promiseArray = []
|
||||||
|
function getRandomArbitrary(min, max) {
|
||||||
|
return Math.floor(Math.random() * (max - min) + min)
|
||||||
|
}
|
||||||
|
promiseArray.push(testCert.addCertificate(`testing${getRandomArbitrary(1,100000)}.bleu.de`))
|
||||||
|
// promiseArray.push(testCert.addCertificate(`testing${getRandomArbitrary(1,100000)}.bleu.de`))
|
||||||
|
// promiseArray.push(testCert.addCertificate(`testing${getRandomArbitrary(1,100000)}.bleu.de`))
|
||||||
|
q.all(promiseArray).then(() => {
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
98
ts/cert.classes.cert.ts
Normal file
98
ts/cert.classes.cert.ts
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
import * as q from 'q'
|
||||||
|
import { Stringmap, Objectmap } from 'lik'
|
||||||
|
|
||||||
|
import * as plugins from './cert.plugins'
|
||||||
|
import * as paths from './cert.paths'
|
||||||
|
|
||||||
|
// classes
|
||||||
|
import { Certificate } from './cert.classes.certificate'
|
||||||
|
import { CertRepo } from './cert.classes.certrepo'
|
||||||
|
import { Letsencrypt, TLeEnv } from './cert.classes.letsencrypt'
|
||||||
|
import { ChallengeHandler } from './cert.classes.challengehandler'
|
||||||
|
|
||||||
|
|
||||||
|
export interface ICertConstructorOptions {
|
||||||
|
cfEmail: string,
|
||||||
|
cfKey: string,
|
||||||
|
sslDirPath?: string,
|
||||||
|
gitOriginRepo?: string,
|
||||||
|
leEnv?: TLeEnv
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Cert {
|
||||||
|
domainStringRequestMap = new Stringmap()
|
||||||
|
certificateMap = new Objectmap<Certificate>()
|
||||||
|
letsencrypt: Letsencrypt
|
||||||
|
private _challengeHandler: ChallengeHandler
|
||||||
|
private _certRepo: CertRepo
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for Cert object
|
||||||
|
*/
|
||||||
|
constructor(optionsArg: ICertConstructorOptions) {
|
||||||
|
|
||||||
|
// set up challengehandler
|
||||||
|
this._challengeHandler = new ChallengeHandler({
|
||||||
|
cfEmail: optionsArg.cfEmail,
|
||||||
|
cfKey: optionsArg.cfKey
|
||||||
|
})
|
||||||
|
|
||||||
|
// setup Letsencrypt
|
||||||
|
this.letsencrypt = new Letsencrypt({
|
||||||
|
leEnv: optionsArg.leEnv,
|
||||||
|
sslDir: optionsArg.sslDirPath,
|
||||||
|
challengeHandler: this._challengeHandler
|
||||||
|
})
|
||||||
|
|
||||||
|
this._certRepo = new CertRepo({
|
||||||
|
sslDirPath: optionsArg.sslDirPath,
|
||||||
|
remoteGitUrl: optionsArg.gitOriginRepo,
|
||||||
|
certInstance: this
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* setup the Cert instanceof
|
||||||
|
* @executes ASYNC
|
||||||
|
* @return Promise
|
||||||
|
*/
|
||||||
|
setup() {
|
||||||
|
return this._certRepo.setup()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adds a Certificate for a given domain
|
||||||
|
*/
|
||||||
|
addCertificate(domainNameArg: string, optionsArg: { force: boolean } = { force: false }) {
|
||||||
|
let done = q.defer()
|
||||||
|
let certificateForDomain = this.certificateMap.find((certificate) => {
|
||||||
|
return certificate.domainName === domainNameArg
|
||||||
|
})
|
||||||
|
if (certificateForDomain instanceof Certificate) {
|
||||||
|
certificateForDomain.renew()
|
||||||
|
.then(done.resolve)
|
||||||
|
} else {
|
||||||
|
certificateForDomain = new Certificate({
|
||||||
|
certInstance: this,
|
||||||
|
domainName: domainNameArg
|
||||||
|
})
|
||||||
|
certificateForDomain.renew()
|
||||||
|
.then(done.resolve)
|
||||||
|
}
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cleans up old certificates
|
||||||
|
*/
|
||||||
|
cleanOldCertificates() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* executes the current batch of jobs
|
||||||
|
*/
|
||||||
|
deploy() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
129
ts/cert.classes.certificate.ts
Normal file
129
ts/cert.classes.certificate.ts
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
import * as q from 'q'
|
||||||
|
|
||||||
|
import * as plugins from './cert.plugins'
|
||||||
|
import * as paths from './cert.paths'
|
||||||
|
|
||||||
|
// import classes
|
||||||
|
import { Cert } from './cert.classes.cert'
|
||||||
|
import { Letsencrypt } from './cert.classes.letsencrypt'
|
||||||
|
import { CertRepo } from './cert.classes.certrepo'
|
||||||
|
|
||||||
|
export interface ICertificateFsConfig {
|
||||||
|
domainName: string
|
||||||
|
creationTime: number
|
||||||
|
expiryTime: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICertificateConstructorOptions {
|
||||||
|
domainName: string,
|
||||||
|
certInstance: Cert
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TCertificateStatus = 'unregistered' | 'valid' | 'expiring' | 'expired'
|
||||||
|
|
||||||
|
export class Certificate {
|
||||||
|
domainName: string
|
||||||
|
certInstance: Cert
|
||||||
|
domainData: plugins.smartstring.Domain
|
||||||
|
creationDate: Date = null
|
||||||
|
expiryDate: Date = null
|
||||||
|
publicKey: string = null
|
||||||
|
privKey: string = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* run when creating a new instance of Certificate
|
||||||
|
*/
|
||||||
|
constructor(optionsArg: ICertificateConstructorOptions) {
|
||||||
|
this.domainName = optionsArg.domainName
|
||||||
|
this.domainData = new plugins.smartstring.Domain(this.domainName)
|
||||||
|
this.certInstance = optionsArg.certInstance
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the status of the Certificate
|
||||||
|
*/
|
||||||
|
get status(): TCertificateStatus {
|
||||||
|
let validTimeRemaining: number = 0
|
||||||
|
if (this.creationDate !== null && this.expiryDate !== null) {
|
||||||
|
validTimeRemaining = this.expiryDate.getTime() - Date.now()
|
||||||
|
}
|
||||||
|
let MonthMilliseconds = 2629746000
|
||||||
|
if (this.publicKey === null || this.privKey === null) {
|
||||||
|
return 'unregistered'
|
||||||
|
} else if (validTimeRemaining >= MonthMilliseconds) {
|
||||||
|
return 'valid'
|
||||||
|
} else if (validTimeRemaining < MonthMilliseconds && validTimeRemaining >= 0) {
|
||||||
|
return 'expiring'
|
||||||
|
} else {
|
||||||
|
return 'expired'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get sameZoneRequesting(): boolean {
|
||||||
|
return this.certInstance.domainStringRequestMap.checkMinimatch('*' + this.domainData.zoneName)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* schedule a retry of certificate request
|
||||||
|
*/
|
||||||
|
scheduleRetry() {
|
||||||
|
let done = plugins.q.defer()
|
||||||
|
setTimeout(() => {
|
||||||
|
this.renew()
|
||||||
|
.then(done.resolve)
|
||||||
|
}, 60000)
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* renew certificate if needed
|
||||||
|
*/
|
||||||
|
renew(force: boolean = false) {
|
||||||
|
let done = q.defer()
|
||||||
|
if (this.status === 'valid') {
|
||||||
|
plugins.beautylog.log('Certificate still valid for more than 1 month, so it is not renewed now')
|
||||||
|
done.resolve()
|
||||||
|
} else if (this.status === 'expiring' || this.status === 'expired' || this.status === 'unregistered') {
|
||||||
|
plugins.beautylog.info('Certificate not valid currently, going to renew now!')
|
||||||
|
if (this.sameZoneRequesting) {
|
||||||
|
this.certInstance.domainStringRequestMap.registerUntilTrue(
|
||||||
|
() => {
|
||||||
|
return !this.sameZoneRequesting
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
this.renew().then(done.resolve)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
this.certInstance.letsencrypt.registerDomain(this.domainName)
|
||||||
|
.then(() => {
|
||||||
|
return this.syncFs()
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
done.resolve()
|
||||||
|
}).catch((err) => { console.log(err) })
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw Error(`weird status for certificate with domain name ${this.domainName}`)
|
||||||
|
}
|
||||||
|
done.resolve()
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* syncFs syncs the certificate with disk
|
||||||
|
*/
|
||||||
|
syncFs() {
|
||||||
|
let configJsonMemory: ICertificateFsConfig = {
|
||||||
|
domainName: this.domainName,
|
||||||
|
creationTime: this.creationDate.getTime(),
|
||||||
|
expiryTime: this.expiryDate.getTime()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* deletes the certificate
|
||||||
|
*/
|
||||||
|
delete() { }
|
||||||
|
}
|
77
ts/cert.classes.certrepo.ts
Normal file
77
ts/cert.classes.certrepo.ts
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
import * as q from 'q'
|
||||||
|
import { GitRepo } from 'smartgit'
|
||||||
|
|
||||||
|
import * as plugins from './cert.plugins'
|
||||||
|
import * as paths from './cert.paths'
|
||||||
|
|
||||||
|
import { Cert } from './cert.classes.cert'
|
||||||
|
import { Certificate } from './cert.classes.certificate'
|
||||||
|
|
||||||
|
export interface ICertRepoConstructorOptions {
|
||||||
|
sslDirPath: string
|
||||||
|
remoteGitUrl: string
|
||||||
|
certInstance: Cert
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CertRepo {
|
||||||
|
private _sslDirPath: string
|
||||||
|
private _remoteGitUrl: string
|
||||||
|
private gitRepo: GitRepo
|
||||||
|
private _certInstance: Cert
|
||||||
|
constructor(optionsArg: ICertRepoConstructorOptions) {
|
||||||
|
this._sslDirPath = optionsArg.sslDirPath
|
||||||
|
this._remoteGitUrl = optionsArg.remoteGitUrl
|
||||||
|
this._certInstance = optionsArg.certInstance
|
||||||
|
|
||||||
|
// setup sslDir
|
||||||
|
if (!this._sslDirPath) {
|
||||||
|
this._sslDirPath = paths.defaultSslDir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* setup the Cert instance
|
||||||
|
*/
|
||||||
|
setup() {
|
||||||
|
// setup Git
|
||||||
|
let done = q.defer()
|
||||||
|
if (this._remoteGitUrl) {
|
||||||
|
plugins.smartfile.fs.ensureEmptyDirSync(paths.defaultSslDir)
|
||||||
|
plugins.smartgit.createRepoFromClone(this._remoteGitUrl, paths.defaultSslDir)
|
||||||
|
.then(gitRepoArg => {
|
||||||
|
this.gitRepo = gitRepoArg
|
||||||
|
done.resolve()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* syncs an objectmap of Certificates with repo
|
||||||
|
*/
|
||||||
|
syncFs() {
|
||||||
|
let done = q.defer()
|
||||||
|
done.resolve()
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pulls already requested certificates from git origin
|
||||||
|
*/
|
||||||
|
sslGitOriginPull = () => {
|
||||||
|
if (this.gitRepo) {
|
||||||
|
this.gitRepo.pull('origin', 'master')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pushes all new requested certificates to git origin
|
||||||
|
*/
|
||||||
|
sslGitOriginAddCommitPush = () => {
|
||||||
|
if (this._remoteGitUrl) {
|
||||||
|
this.gitRepo.addAll()
|
||||||
|
this.gitRepo.commit('added new SSL certificates and deleted obsolete ones.')
|
||||||
|
this.gitRepo.push('origin', 'master')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
84
ts/cert.classes.challengehandler.ts
Normal file
84
ts/cert.classes.challengehandler.ts
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
import * as plugins from './cert.plugins'
|
||||||
|
import * as paths from './cert.paths'
|
||||||
|
|
||||||
|
export interface IChallengehandlerConstructorOptions {
|
||||||
|
cfEmail: string,
|
||||||
|
cfKey: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* class ChallengeHandler handles challenges
|
||||||
|
*/
|
||||||
|
export class ChallengeHandler {
|
||||||
|
private _cfInstance: plugins.cflare.CflareAccount
|
||||||
|
constructor(optionsArg: IChallengehandlerConstructorOptions) {
|
||||||
|
this._cfInstance = new plugins.cflare.CflareAccount()
|
||||||
|
this._cfInstance.auth({
|
||||||
|
email: optionsArg.cfEmail,
|
||||||
|
key: optionsArg.cfKey
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set a challenge
|
||||||
|
*/
|
||||||
|
setChallenge(domainNameArg: string, challengeArg: string) {
|
||||||
|
let done = plugins.q.defer()
|
||||||
|
plugins.beautylog.log('setting challenge for ' + domainNameArg)
|
||||||
|
this._cfInstance.createRecord(prefixName(domainNameArg), 'TXT', challengeArg).then(() => {
|
||||||
|
plugins.beautylog.ok('Challenge has been set!')
|
||||||
|
plugins.beautylog.info('We need to cool down to let DNS propagate to edge locations!')
|
||||||
|
cooldown().then(() => {
|
||||||
|
done.resolve()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cleans a challenge
|
||||||
|
*/
|
||||||
|
cleanChallenge(domainNameArg) {
|
||||||
|
let done = plugins.q.defer()
|
||||||
|
plugins.beautylog.log('cleaning challenge for ' + domainNameArg)
|
||||||
|
this._cfInstance.removeRecord(prefixName(domainNameArg), 'TXT')
|
||||||
|
cooldown().then(() => {
|
||||||
|
done.resolve()
|
||||||
|
})
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cooldown timer for letting DNS settle before answering the challengerequest
|
||||||
|
*/
|
||||||
|
let cooldown = () => {
|
||||||
|
let done = plugins.q.defer()
|
||||||
|
let cooldowntime = 60000
|
||||||
|
let passedTime = 0
|
||||||
|
plugins.beautylog.log('Cooling down! ' + (cooldowntime / 1000).toString() + ' seconds left')
|
||||||
|
let coolDownCounter = () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
if (cooldowntime <= passedTime) {
|
||||||
|
plugins.beautylog.ok('Cooled down!')
|
||||||
|
done.resolve()
|
||||||
|
} else {
|
||||||
|
passedTime = passedTime + 5000
|
||||||
|
plugins.beautylog.log('Cooling down! '
|
||||||
|
+ ((cooldowntime - passedTime) / 1000).toString()
|
||||||
|
+ ' seconds left'
|
||||||
|
)
|
||||||
|
coolDownCounter()
|
||||||
|
}
|
||||||
|
}, 5000)
|
||||||
|
}
|
||||||
|
coolDownCounter()
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* prefix a domain name to make sure it complies with letsencrypt
|
||||||
|
*/
|
||||||
|
let prefixName = (domainNameArg: string): string => {
|
||||||
|
return '_acme-challenge.' + domainNameArg
|
||||||
|
}
|
48
ts/cert.classes.letsencrypt.ts
Normal file
48
ts/cert.classes.letsencrypt.ts
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import * as q from 'q'
|
||||||
|
let letsencrypt = require('letsencrypt')
|
||||||
|
let leStore = require('le-store-certbot')
|
||||||
|
|
||||||
|
import * as plugins from './cert.plugins'
|
||||||
|
import * as paths from './cert.paths'
|
||||||
|
|
||||||
|
import { ChallengeHandler } from './cert.classes.challengehandler'
|
||||||
|
|
||||||
|
export type TLeEnv = 'production' | 'staging'
|
||||||
|
|
||||||
|
export interface ILetsencryptConstructorOptions {
|
||||||
|
leEnv: TLeEnv,
|
||||||
|
challengeHandler: ChallengeHandler,
|
||||||
|
sslDir: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Letsencrypt {
|
||||||
|
leEnv: TLeEnv
|
||||||
|
challengeHandler: ChallengeHandler // this is the format we use
|
||||||
|
sslDir: string
|
||||||
|
private _leServerUrl: string
|
||||||
|
|
||||||
|
constructor(optionsArg: ILetsencryptConstructorOptions) {
|
||||||
|
// determine leEnv
|
||||||
|
this.leEnv = optionsArg.leEnv
|
||||||
|
this.challengeHandler = optionsArg.challengeHandler
|
||||||
|
this.sslDir = optionsArg.sslDir
|
||||||
|
|
||||||
|
// set letsencrypt environment
|
||||||
|
if (this.leEnv === 'production') {
|
||||||
|
this._leServerUrl = letsencrypt.productionServerUrl
|
||||||
|
} else if (this.leEnv === 'staging') {
|
||||||
|
this._leServerUrl = letsencrypt.stagingServerUrl
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* register a domain
|
||||||
|
*/
|
||||||
|
registerDomain(domainNameArg: string) {
|
||||||
|
plugins.beautylog.log(`trying to register domain ${domainNameArg}`)
|
||||||
|
let done = q.defer()
|
||||||
|
plugins.smartfile.fs.ensureDirSync(plugins.path.join(paths.leConfigDir, 'live', domainNameArg))
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
}
|
9
ts/cert.paths.ts
Normal file
9
ts/cert.paths.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import * as plugins from './cert.plugins'
|
||||||
|
|
||||||
|
// dirs
|
||||||
|
export let projectDir = plugins.path.join(__dirname,'../')
|
||||||
|
export let assetDir = plugins.path.join(projectDir,'assets')
|
||||||
|
export let defaultSslDir = plugins.path.join(assetDir,'defaultSslDir')
|
||||||
|
export let leConfigDir = plugins.path.join(assetDir,'letsencrypt')
|
||||||
|
plugins.smartfile.fs.ensureDirSync(leConfigDir)
|
||||||
|
plugins.smartfile.fs.ensureDirSync(defaultSslDir)
|
26
ts/cert.plugins.ts
Normal file
26
ts/cert.plugins.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import 'typings-global'
|
||||||
|
import * as beautylog from 'beautylog'
|
||||||
|
import * as cflare from 'cflare'
|
||||||
|
let fs = require('fs-extra')
|
||||||
|
import * as lik from 'lik'
|
||||||
|
import * as path from 'path'
|
||||||
|
import * as q from 'q'
|
||||||
|
import * as shelljs from 'shelljs'
|
||||||
|
import * as smartcli from 'smartcli'
|
||||||
|
import * as smartfile from 'smartfile'
|
||||||
|
import * as smartgit from 'smartgit'
|
||||||
|
import * as smartstring from 'smartstring'
|
||||||
|
|
||||||
|
export {
|
||||||
|
beautylog,
|
||||||
|
cflare,
|
||||||
|
fs,
|
||||||
|
lik,
|
||||||
|
path,
|
||||||
|
q,
|
||||||
|
shelljs,
|
||||||
|
smartcli,
|
||||||
|
smartfile,
|
||||||
|
smartgit,
|
||||||
|
smartstring
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
export * from './cert.classes.cert'
|
Loading…
x
Reference in New Issue
Block a user