fix
This commit is contained in:
parent
7455891097
commit
fd89e54295
6
dist/cert.classes.cert.d.ts
vendored
6
dist/cert.classes.cert.d.ts
vendored
@ -20,6 +20,12 @@ export declare class Cert {
|
|||||||
* Constructor for Cert object
|
* Constructor for Cert object
|
||||||
*/
|
*/
|
||||||
constructor(optionsArg: ICertConstructorOptions);
|
constructor(optionsArg: ICertConstructorOptions);
|
||||||
|
/**
|
||||||
|
* setup the Cert instanceof
|
||||||
|
* @executes ASYNC
|
||||||
|
* @return Promise
|
||||||
|
*/
|
||||||
|
setup(): q.Promise<{}>;
|
||||||
/**
|
/**
|
||||||
* adds a Certificate for a given domain
|
* adds a Certificate for a given domain
|
||||||
*/
|
*/
|
||||||
|
18
dist/cert.classes.cert.js
vendored
18
dist/cert.classes.cert.js
vendored
@ -3,6 +3,7 @@ const q = require("q");
|
|||||||
const lik_1 = require("lik");
|
const lik_1 = require("lik");
|
||||||
// classes
|
// classes
|
||||||
const cert_classes_certificate_1 = require("./cert.classes.certificate");
|
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_letsencrypt_1 = require("./cert.classes.letsencrypt");
|
||||||
const cert_classes_challengehandler_1 = require("./cert.classes.challengehandler");
|
const cert_classes_challengehandler_1 = require("./cert.classes.challengehandler");
|
||||||
class Cert {
|
class Cert {
|
||||||
@ -23,12 +24,19 @@ class Cert {
|
|||||||
sslDir: optionsArg.sslDirPath,
|
sslDir: optionsArg.sslDirPath,
|
||||||
challengeHandler: this._challengeHandler
|
challengeHandler: this._challengeHandler
|
||||||
});
|
});
|
||||||
// setup CertRpo
|
this._certRepo = new cert_classes_certrepo_1.CertRepo({
|
||||||
/* this._certRepo = new CertRepo({
|
|
||||||
sslDirPath: optionsArg.sslDirPath,
|
sslDirPath: optionsArg.sslDirPath,
|
||||||
gitOriginRepo: optionsArg.gitOriginRepo,
|
remoteGitUrl: optionsArg.gitOriginRepo,
|
||||||
certInstance: this
|
certInstance: this
|
||||||
}) */
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* setup the Cert instanceof
|
||||||
|
* @executes ASYNC
|
||||||
|
* @return Promise
|
||||||
|
*/
|
||||||
|
setup() {
|
||||||
|
return this._certRepo.setup();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* adds a Certificate for a given domain
|
* adds a Certificate for a given domain
|
||||||
@ -64,4 +72,4 @@ class Cert {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Cert = Cert;
|
exports.Cert = Cert;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2VydC5jbGFzc2VzLmNlcnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9jZXJ0LmNsYXNzZXMuY2VydC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsdUJBQXNCO0FBQ3RCLDZCQUEwQztBQUsxQyxVQUFVO0FBQ1YseUVBQXdEO0FBRXhELHlFQUFnRTtBQUNoRSxtRkFBa0U7QUFXbEU7SUFPSTs7T0FFRztJQUNILFlBQVksVUFBbUM7UUFUL0MsMkJBQXNCLEdBQUcsSUFBSSxlQUFTLEVBQUUsQ0FBQTtRQUN4QyxtQkFBYyxHQUFHLElBQUksZUFBUyxFQUFlLENBQUE7UUFVekMsMEJBQTBCO1FBQzFCLElBQUksQ0FBQyxpQkFBaUIsR0FBRyxJQUFJLGdEQUFnQixDQUFDO1lBQzFDLE9BQU8sRUFBRSxVQUFVLENBQUMsT0FBTztZQUMzQixLQUFLLEVBQUUsVUFBVSxDQUFDLEtBQUs7U0FDMUIsQ0FBQyxDQUFBO1FBRUYsb0JBQW9CO1FBQ3BCLElBQUksQ0FBQyxXQUFXLEdBQUcsSUFBSSxzQ0FBVyxDQUFDO1lBQy9CLEtBQUssRUFBRSxVQUF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BRUQ7O09BRUc7SUFDSCxNQUFNO0lBRU4sQ0FBQztDQUNKO0FBNUVELG9CQTRFQyJ9
|
9
dist/cert.classes.certrepo.d.ts
vendored
9
dist/cert.classes.certrepo.d.ts
vendored
@ -3,14 +3,19 @@ import * as q from 'q';
|
|||||||
import { Cert } from './cert.classes.cert';
|
import { Cert } from './cert.classes.cert';
|
||||||
export interface ICertRepoConstructorOptions {
|
export interface ICertRepoConstructorOptions {
|
||||||
sslDirPath: string;
|
sslDirPath: string;
|
||||||
gitOriginRepo: string;
|
remoteGitUrl: string;
|
||||||
certInstance: Cert;
|
certInstance: Cert;
|
||||||
}
|
}
|
||||||
export declare class CertRepo {
|
export declare class CertRepo {
|
||||||
private _sslDirPath;
|
private _sslDirPath;
|
||||||
private _gitOriginRepo;
|
private _remoteGitUrl;
|
||||||
|
private gitRepo;
|
||||||
private _certInstance;
|
private _certInstance;
|
||||||
constructor(optionsArg: ICertRepoConstructorOptions);
|
constructor(optionsArg: ICertRepoConstructorOptions);
|
||||||
|
/**
|
||||||
|
* setup the Cert instance
|
||||||
|
*/
|
||||||
|
setup(): q.Promise<{}>;
|
||||||
/**
|
/**
|
||||||
* syncs an objectmap of Certificates with repo
|
* syncs an objectmap of Certificates with repo
|
||||||
*/
|
*/
|
||||||
|
36
dist/cert.classes.certrepo.js
vendored
36
dist/cert.classes.certrepo.js
vendored
@ -8,33 +8,43 @@ class CertRepo {
|
|||||||
* Pulls already requested certificates from git origin
|
* Pulls already requested certificates from git origin
|
||||||
*/
|
*/
|
||||||
this.sslGitOriginPull = () => {
|
this.sslGitOriginPull = () => {
|
||||||
if (this._gitOriginRepo) {
|
if (this.gitRepo) {
|
||||||
plugins.smartgit.pull(this._sslDirPath, 'origin', 'master');
|
this.gitRepo.pull('origin', 'master');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Pushes all new requested certificates to git origin
|
* Pushes all new requested certificates to git origin
|
||||||
*/
|
*/
|
||||||
this.sslGitOriginAddCommitPush = () => {
|
this.sslGitOriginAddCommitPush = () => {
|
||||||
if (this._gitOriginRepo) {
|
if (this._remoteGitUrl) {
|
||||||
plugins.smartgit.add.addAll(this._sslDirPath);
|
this.gitRepo.addAll();
|
||||||
plugins.smartgit.commit(this._sslDirPath, 'added new SSL certificates and deleted obsolete ones.');
|
this.gitRepo.commit('added new SSL certificates and deleted obsolete ones.');
|
||||||
plugins.smartgit.push(this._sslDirPath, 'origin', 'master');
|
this.gitRepo.push('origin', 'master');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this._sslDirPath = optionsArg.sslDirPath;
|
this._sslDirPath = optionsArg.sslDirPath;
|
||||||
this._gitOriginRepo = optionsArg.gitOriginRepo;
|
this._remoteGitUrl = optionsArg.remoteGitUrl;
|
||||||
this._certInstance = optionsArg.certInstance;
|
this._certInstance = optionsArg.certInstance;
|
||||||
// setup sslDir
|
// setup sslDir
|
||||||
if (!this._sslDirPath) {
|
if (!this._sslDirPath) {
|
||||||
this._sslDirPath = paths.defaultSslDir;
|
this._sslDirPath = paths.defaultSslDir;
|
||||||
}
|
}
|
||||||
// setup Git
|
|
||||||
if (this._gitOriginRepo) {
|
|
||||||
plugins.smartgit.init(this._sslDirPath);
|
|
||||||
plugins.smartgit.remote.add(this._sslDirPath, 'origin', this._gitOriginRepo);
|
|
||||||
this.sslGitOriginPull();
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 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
|
* syncs an objectmap of Certificates with repo
|
||||||
@ -46,4 +56,4 @@ class CertRepo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.CertRepo = CertRepo;
|
exports.CertRepo = CertRepo;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2VydC5jbGFzc2VzLmNlcnRyZXBvLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvY2VydC5jbGFzc2VzLmNlcnRyZXBvLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSx1QkFBc0I7QUFFdEIsMENBQXlDO0FBQ3pDLHNDQUFxQztBQVdyQztJQUlJLFlBQVksVUFBdUM7UUEyQm5EOztXQUVHO1FBQ0gscUJBQWdCLEdBQUc7WUFDZixFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsY0FBYyxDQUFDLENBQUMsQ0FBQztnQkFDdEIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFdBQVcsRUFBRSxRQUFRLEVBQUUsUUFBUSxDQUFDLENBQUE7WUFDL0QsQ0FBQztRQUNMLENBQUMsQ0FBQTtRQUVEOztXQUVHO1FBQ0gsOEJBQXlCLEdBQUc7WUFDeEIsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUM7Z0JBQ3RCLE9BQU8sQ0FBQyxRQUFRLENBQUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLENBQUE7Z0JBQzdDLE9BQU8sQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxXQUFXLEVBQUUsdURBQXVELENBQUMsQ0FBQTtnQkFDbEcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxJQUFJLENBQUMsSUFBS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FBQyxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsQ0FBQyxDQUFDO1lBQ3BCLElBQUksQ0FBQyxXQUFXLEdBQUcsS0FBSyxDQUFDLGFBQWEsQ0FBQTtRQUMxQyxDQUFDO0lBQ0wsQ0FBQztJQUVEOztPQUVHO0lBQ0gsS0FBSztRQUNELFlBQVk7UUFDWixJQUFJLElBQUksR0FBRyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUE7UUFDcEIsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLGFBQWEsQ0FBQyxDQUFDLENBQUM7WUFDckIsT0FBTyxDQUFDLFNBQVMsQ0FBQyxFQUFFLENBQUMsa0JBQWtCLENBQUMsS0FBSyxDQUFDLGFBQWEsQ0FBQyxDQUFBO1lBQzVELE9BQU8sQ0FBQyxRQUFRLENBQUMsbUJBQW1CLENBQUMsSUFBSSxDQUFDLGFBQWEsRUFBRSxLQUFLLENBQUMsYUFBYSxDQUFDO2lCQUN4RSxJQUFJLENBQUMsVUFBVTtnQkFDWixJQUFJLENBQUMsT0FBTyxHQUFHLFVBQVUsQ0FBQTtnQkFDekIsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFBO1lBQ2xCLENBQUMsQ0FBQyxDQUFBO1FBQ1YsQ0FBQztRQUNELE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0lBQ3ZCLENBQUM7SUFFRDs7T0FFRztJQUNILE1BQU07UUFDRixJQUFJLElBQUksR0FBRyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUE7UUFDcEIsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFBO1FBQ2QsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7SUFDdkIsQ0FBQztDQXFCSjtBQTdERCw0QkE2REMifQ==
|
65
dist/cert.classes.letsencrypt.js
vendored
65
dist/cert.classes.letsencrypt.js
vendored
File diff suppressed because one or more lines are too long
2
dist/cert.plugins.js
vendored
2
dist/cert.plugins.js
vendored
@ -22,4 +22,4 @@ const smartgit = require("smartgit");
|
|||||||
exports.smartgit = smartgit;
|
exports.smartgit = smartgit;
|
||||||
const smartstring = require("smartstring");
|
const smartstring = require("smartstring");
|
||||||
exports.smartstring = smartstring;
|
exports.smartstring = smartstring;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2VydC5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvY2VydC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwwQkFBdUI7QUFDdkIsdUNBQXNDO0FBYWxDLG9CQWJRLFNBQVMsQ0FhUjtBQVpiLGlDQUFnQztBQWE1QixpQkFiUSxNQUFNLENBYVI7QUFaVixJQUFJLEVBQUUsR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFDLENBQUE7QUFheEIsYUFiQSxFQUFFLENBYUE7QUFaTiwyQkFBMEI7QUFhdEIsY0FiUSxHQUFHLENBYVI7QUFaUCw2QkFBNEI7QUFheEIsZUFiUSxJQUFJLENBYVI7QUFaUix1QkFBc0I7QUFhbEIsWUFiUSxDQUFDLENBYVI7QUFaTCxtQ0FBa0M7QUFhOUIsa0JBYlEsT0FBTyxDQWFSO0FBWlgscUNBQW9DO0FBYWhDLG1CQWJRLFFBQVEsQ0FhUjtBQVpaLHVDQUFzQztBQWFsQyxvQkFiUSxTQUFTLENBYVI7QUFaYixxQ0FBb0M7QUFhaEMsbUJBYlEsUUFBUSxDQWFSO0FBWlosMkNBQTBDO0FBYXRDLHNCQWJRLFdBQVcsQ0FhUiJ9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2VydC5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvY2VydC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwwQkFBdUI7QUFDdkIsdUNBQXNDO0FBYWxDLDhCQUFTO0FBWmIsaUNBQWdDO0FBYTVCLHdCQUFNO0FBWlYsSUFBSSxFQUFFLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFBO0FBYXhCLGdCQUFFO0FBWk4sMkJBQTBCO0FBYXRCLGtCQUFHO0FBWlAsNkJBQTRCO0FBYXhCLG9CQUFJO0FBWlIsdUJBQXNCO0FBYWxCLGNBQUM7QUFaTCxtQ0FBa0M7QUFhOUIsMEJBQU87QUFaWCxxQ0FBb0M7QUFhaEMsNEJBQVE7QUFaWix1Q0FBc0M7QUFhbEMsOEJBQVM7QUFaYixxQ0FBb0M7QUFhaEMsNEJBQVE7QUFaWiwyQ0FBMEM7QUFhdEMsa0NBQVcifQ==
|
18
package.json
18
package.json
@ -5,7 +5,7 @@
|
|||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npm run cleanTest && npmts)",
|
"test": "(npm run cleanTest && npmts --nodocs)",
|
||||||
"cleanTest": "(rm -rf ./test/assets)",
|
"cleanTest": "(rm -rf ./test/assets)",
|
||||||
"compile": "(npmts --notest)"
|
"compile": "(npmts --notest)"
|
||||||
},
|
},
|
||||||
@ -30,22 +30,22 @@
|
|||||||
"@types/q": "0.0.32",
|
"@types/q": "0.0.32",
|
||||||
"beautylog": "^6.0.0",
|
"beautylog": "^6.0.0",
|
||||||
"cflare": "0.0.10",
|
"cflare": "0.0.10",
|
||||||
"fs-extra": "^0.30.0",
|
"fs-extra": "^1.0.0",
|
||||||
"le-store-certbot": "^2.0.3",
|
"le-store-certbot": "^2.0.3",
|
||||||
"letsencrypt": "^2.1.8",
|
"letsencrypt": "^2.1.8",
|
||||||
"lik": "^1.0.24",
|
"lik": "^1.0.27",
|
||||||
"q": "^1.4.1",
|
"q": "^1.4.1",
|
||||||
"smartcli": "^1.0.10",
|
"smartcli": "^2.0.1",
|
||||||
"smartfile": "^4.0.24",
|
"smartfile": "^4.1.1",
|
||||||
"smartgit": "0.1.9",
|
"smartgit": "1.0.5",
|
||||||
"smartstring": "^2.0.17",
|
"smartstring": "^2.0.22",
|
||||||
"typings-global": "^1.0.14"
|
"typings-global": "^1.0.14"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/should": "^8.1.30",
|
"@types/should": "^8.1.30",
|
||||||
"npmts-g": "^5.2.8",
|
"npmts-g": "^5.2.10",
|
||||||
"qenv": "^1.1.1",
|
"qenv": "^1.1.1",
|
||||||
"should": "^11.1.1",
|
"should": "^11.1.2",
|
||||||
"typings-test": "^1.0.3"
|
"typings-test": "^1.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ let testCert;
|
|||||||
describe('cert', function () {
|
describe('cert', function () {
|
||||||
describe('Cert', function () {
|
describe('Cert', function () {
|
||||||
it('should create a new Cert object from class', function () {
|
it('should create a new Cert object from class', function () {
|
||||||
this.timeout(40000);
|
|
||||||
testCert = new cert.Cert({
|
testCert = new cert.Cert({
|
||||||
cfEmail: process.env.CF_EMAIL,
|
cfEmail: process.env.CF_EMAIL,
|
||||||
cfKey: process.env.CF_KEY,
|
cfKey: process.env.CF_KEY,
|
||||||
@ -20,6 +19,12 @@ describe('cert', function () {
|
|||||||
});
|
});
|
||||||
should(testCert).be.instanceof(cert.Cert);
|
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) {
|
it('should get a valid certificate', function (done) {
|
||||||
this.timeout(1200000);
|
this.timeout(1200000);
|
||||||
let promiseArray = [];
|
let promiseArray = [];
|
||||||
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O1lBQzdDLElBQUksQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUE7WUFDckIsSUFBSSxZQUFZLEdBQUcsRUFBRSxDQUFBO1lBQ3JCLDRCQUE0QixHQUFHLEVBQUUsR0FBRztnQkFDaEMsTUFBTSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLE1BQU0sRUFBRSxHQUFHLENBQUMsR0FBRyxHQUFHLEdBQUcsQ0FBQyxHQUFHLEdBQUcsQ0FBQyxDQUFBO1lBQ3hELENBQUM7WUFDRCxZQUFZLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxjQUFjLENBQUMsVUFBVSxrQkFBa0IsQ0FBQyxDQUFDLEVBQUMsTUFBTSxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUE7WUFDNUYsK0ZBQStGO1lBQy9GLCtGQUErRjtZQUMvRixDQUFDLENBQUMsR0FBRyxDQUFDLFlBQVksQ0FBQyxDQUFDLElBQUksQ0FBQztnQkFDckIsSUFBSSxFQUFFLENBQUE7WUFDVixDQUFDLENBQUMsQ0FBQTtRQUNOLENBQUMsQ0FBQyxDQUFBO0lBQ04sQ0FBQyxDQUFDLENBQUE7QUFDTixDQUFDLENBQUMsQ0FBQSJ9
|
@ -13,7 +13,6 @@ let testCert: cert.Cert
|
|||||||
describe('cert',function(){
|
describe('cert',function(){
|
||||||
describe('Cert',function(){
|
describe('Cert',function(){
|
||||||
it('should create a new Cert object from class',function(){
|
it('should create a new Cert object from class',function(){
|
||||||
this.timeout(40000)
|
|
||||||
testCert = new cert.Cert({
|
testCert = new cert.Cert({
|
||||||
cfEmail: process.env.CF_EMAIL,
|
cfEmail: process.env.CF_EMAIL,
|
||||||
cfKey: process.env.CF_KEY,
|
cfKey: process.env.CF_KEY,
|
||||||
@ -23,6 +22,12 @@ describe('cert',function(){
|
|||||||
})
|
})
|
||||||
should(testCert).be.instanceof(cert.Cert)
|
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){
|
it('should get a valid certificate',function(done){
|
||||||
this.timeout(1200000)
|
this.timeout(1200000)
|
||||||
let promiseArray = []
|
let promiseArray = []
|
||||||
|
@ -44,12 +44,20 @@ export class Cert {
|
|||||||
challengeHandler: this._challengeHandler
|
challengeHandler: this._challengeHandler
|
||||||
})
|
})
|
||||||
|
|
||||||
// setup CertRpo
|
this._certRepo = new CertRepo({
|
||||||
/* this._certRepo = new CertRepo({
|
|
||||||
sslDirPath: optionsArg.sslDirPath,
|
sslDirPath: optionsArg.sslDirPath,
|
||||||
gitOriginRepo: optionsArg.gitOriginRepo,
|
remoteGitUrl: optionsArg.gitOriginRepo,
|
||||||
certInstance: this
|
certInstance: this
|
||||||
}) */
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* setup the Cert instanceof
|
||||||
|
* @executes ASYNC
|
||||||
|
* @return Promise
|
||||||
|
*/
|
||||||
|
setup() {
|
||||||
|
return this._certRepo.setup()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as q from 'q'
|
import * as q from 'q'
|
||||||
|
import { GitRepo } from 'smartgit'
|
||||||
|
|
||||||
import * as plugins from './cert.plugins'
|
import * as plugins from './cert.plugins'
|
||||||
import * as paths from './cert.paths'
|
import * as paths from './cert.paths'
|
||||||
@ -8,30 +9,41 @@ import { Certificate } from './cert.classes.certificate'
|
|||||||
|
|
||||||
export interface ICertRepoConstructorOptions {
|
export interface ICertRepoConstructorOptions {
|
||||||
sslDirPath: string
|
sslDirPath: string
|
||||||
gitOriginRepo: string
|
remoteGitUrl: string
|
||||||
certInstance: Cert
|
certInstance: Cert
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CertRepo {
|
export class CertRepo {
|
||||||
private _sslDirPath: string
|
private _sslDirPath: string
|
||||||
private _gitOriginRepo: string
|
private _remoteGitUrl: string
|
||||||
|
private gitRepo: GitRepo
|
||||||
private _certInstance: Cert
|
private _certInstance: Cert
|
||||||
constructor(optionsArg: ICertRepoConstructorOptions) {
|
constructor(optionsArg: ICertRepoConstructorOptions) {
|
||||||
this._sslDirPath = optionsArg.sslDirPath
|
this._sslDirPath = optionsArg.sslDirPath
|
||||||
this._gitOriginRepo = optionsArg.gitOriginRepo
|
this._remoteGitUrl = optionsArg.remoteGitUrl
|
||||||
this._certInstance = optionsArg.certInstance
|
this._certInstance = optionsArg.certInstance
|
||||||
|
|
||||||
// setup sslDir
|
// setup sslDir
|
||||||
if (!this._sslDirPath){
|
if (!this._sslDirPath) {
|
||||||
this._sslDirPath = paths.defaultSslDir
|
this._sslDirPath = paths.defaultSslDir
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup Git
|
|
||||||
if (this._gitOriginRepo) {
|
|
||||||
plugins.smartgit.init(this._sslDirPath)
|
|
||||||
plugins.smartgit.remote.add(this._sslDirPath, 'origin', this._gitOriginRepo)
|
|
||||||
this.sslGitOriginPull()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,8 +59,8 @@ export class CertRepo {
|
|||||||
* Pulls already requested certificates from git origin
|
* Pulls already requested certificates from git origin
|
||||||
*/
|
*/
|
||||||
sslGitOriginPull = () => {
|
sslGitOriginPull = () => {
|
||||||
if (this._gitOriginRepo) {
|
if (this.gitRepo) {
|
||||||
plugins.smartgit.pull(this._sslDirPath, 'origin', 'master')
|
this.gitRepo.pull('origin', 'master')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,10 +68,10 @@ export class CertRepo {
|
|||||||
* Pushes all new requested certificates to git origin
|
* Pushes all new requested certificates to git origin
|
||||||
*/
|
*/
|
||||||
sslGitOriginAddCommitPush = () => {
|
sslGitOriginAddCommitPush = () => {
|
||||||
if (this._gitOriginRepo) {
|
if (this._remoteGitUrl) {
|
||||||
plugins.smartgit.add.addAll(this._sslDirPath)
|
this.gitRepo.addAll()
|
||||||
plugins.smartgit.commit(this._sslDirPath, 'added new SSL certificates and deleted obsolete ones.')
|
this.gitRepo.commit('added new SSL certificates and deleted obsolete ones.')
|
||||||
plugins.smartgit.push(this._sslDirPath, 'origin', 'master')
|
this.gitRepo.push('origin', 'master')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,21 @@ export interface ILetsencryptConstructorOptions {
|
|||||||
sslDir: string
|
sslDir: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let leStoreConfig = {
|
||||||
|
configDir: paths.leConfigDir,
|
||||||
|
privkeyPath: ':configDir/:hostname/privkey.pem',
|
||||||
|
fullchainPath: ':configDir/:hostname/fullchain.pem',
|
||||||
|
certPath: ':configDir/:hostname/cert.pem',
|
||||||
|
chainPath: ':configDir/:hostname/chain.pem',
|
||||||
|
|
||||||
|
workDir: ':configDir/letsencrypt/var/lib',
|
||||||
|
logsDir: ':configDir/letsencrypt/var/log',
|
||||||
|
|
||||||
|
debug: true
|
||||||
|
}
|
||||||
|
|
||||||
|
let leStoreInstance = leStore.create(leStoreConfig)
|
||||||
|
|
||||||
export class Letsencrypt {
|
export class Letsencrypt {
|
||||||
leEnv: TLeEnv
|
leEnv: TLeEnv
|
||||||
challengeHandler: ChallengeHandler // this is the format we use
|
challengeHandler: ChallengeHandler // this is the format we use
|
||||||
@ -43,14 +58,14 @@ export class Letsencrypt {
|
|||||||
'dns-01': this._leChallengeHandler()
|
'dns-01': this._leChallengeHandler()
|
||||||
},
|
},
|
||||||
challengeType: 'dns-01',
|
challengeType: 'dns-01',
|
||||||
store: leStore.create({
|
store: leStoreInstance,
|
||||||
configDir: paths.leConfigDir,
|
|
||||||
debug: true
|
|
||||||
}),
|
|
||||||
agreeToTerms: (opts, agreeCb) => {
|
agreeToTerms: (opts, agreeCb) => {
|
||||||
agreeCb(null, opts.tosUrl)
|
agreeCb(null, opts.tosUrl)
|
||||||
},
|
},
|
||||||
debug: true
|
debug: true,
|
||||||
|
log: function (debug) {
|
||||||
|
console.info(arguments)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
console.log()
|
console.log()
|
||||||
}
|
}
|
||||||
@ -61,25 +76,33 @@ export class Letsencrypt {
|
|||||||
registerDomain(domainNameArg: string) {
|
registerDomain(domainNameArg: string) {
|
||||||
plugins.beautylog.log(`trying to register domain ${domainNameArg}`)
|
plugins.beautylog.log(`trying to register domain ${domainNameArg}`)
|
||||||
let done = q.defer()
|
let done = q.defer()
|
||||||
console.log('test')
|
plugins.smartfile.fs.ensureDirSync(plugins.path.join(paths.leConfigDir, 'live', domainNameArg))
|
||||||
console.log(this._leServerUrl)
|
this._leInstance.check({ domains: [domainNameArg] }).then((cert) => {
|
||||||
this._leInstance.register({
|
console.log(cert)
|
||||||
|
let opts = {
|
||||||
domains: [domainNameArg],
|
domains: [domainNameArg],
|
||||||
email: 'office@lossless.com',
|
email: 'domains@lossless.org',
|
||||||
agreeTos: true,
|
agreeTos: true,
|
||||||
rsaKeySize: 2048,
|
rsaKeySize: 2048, // 2048 or higher
|
||||||
challengeType: 'dns-01'
|
challengeType: 'dns-01',
|
||||||
}).then(
|
duplicate: true
|
||||||
results => {
|
|
||||||
plugins.beautylog.success(`Got certificates for ${domainNameArg}`)
|
|
||||||
this._leCopyToDestination(domainNameArg).then(done.resolve)
|
|
||||||
},
|
|
||||||
(err) => {
|
|
||||||
console.error('[Error]: node-letsencrypt/examples/standalone')
|
|
||||||
console.error(err.stack)
|
|
||||||
done.resolve()
|
|
||||||
}
|
}
|
||||||
).catch(err => { console.log(err) })
|
|
||||||
|
if (cert) {
|
||||||
|
if (true) {
|
||||||
|
return this._leInstance.renew(opts, cert).catch((err) => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return cert
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Register Certificate manually
|
||||||
|
return this._leInstance.register(opts).catch((err) => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
return done.promise
|
return done.promise
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +149,7 @@ export class Letsencrypt {
|
|||||||
cb()
|
cb()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
loopback: (defaults, domain, challenge, done) => {
|
loopback: (defaults, domain, token, keyAuthorization, done) => {
|
||||||
done()
|
done()
|
||||||
},
|
},
|
||||||
test: (defaults, domain, challenge, cb) => {
|
test: (defaults, domain, challenge, cb) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user