improve logs and cooldown
This commit is contained in:
parent
d94a097443
commit
05b7c7ab45
29
dist/cert.hook.js
vendored
29
dist/cert.hook.js
vendored
File diff suppressed because one or more lines are too long
2
dist/cert.paths.d.ts
vendored
2
dist/cert.paths.d.ts
vendored
@ -2,4 +2,4 @@ import "typings-global";
|
||||
export declare let certHook: string;
|
||||
export declare let config: string;
|
||||
export declare let letsencryptSh: string;
|
||||
export declare let sslDir: string;
|
||||
export declare let certDir: string;
|
||||
|
4
dist/cert.paths.js
vendored
4
dist/cert.paths.js
vendored
@ -4,6 +4,6 @@ var plugins = require("./cert.plugins");
|
||||
exports.certHook = plugins.path.join(__dirname, "cert.hook.js");
|
||||
exports.config = plugins.path.join(__dirname, "assets/config.json");
|
||||
exports.letsencryptSh = plugins.path.join(__dirname, "assets/letsencrypt.sh");
|
||||
exports.sslDir = plugins.path.join(__dirname, "/assets/certs");
|
||||
exports.certDir = plugins.path.join(__dirname, "/assets/certs");
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNlcnQucGF0aHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixJQUFZLE9BQU8sV0FBTSxnQkFBZ0IsQ0FBQyxDQUFBO0FBRS9CLGdCQUFRLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFDLGNBQWMsQ0FBQyxDQUFDO0FBQ3ZELGNBQU0sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUMsb0JBQW9CLENBQUMsQ0FBQztBQUMzRCxxQkFBYSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBQyx1QkFBdUIsQ0FBQyxDQUFDO0FBQ3JFLGNBQU0sR0FBRyxPQUFPLENBQUMsSU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QUFDLFNBQVMsRUFBQyx1QkFBdUIsQ0FBQyxDQUFDO0FBQ3JFLGVBQU8sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUMsZUFBZSxDQUFDLENBQUMiLCJmaWxlIjoiY2VydC5wYXRocy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XG5pbXBvcnQgKiBhcyBwbHVnaW5zIGZyb20gXCIuL2NlcnQucGx1Z2luc1wiO1xuXG5leHBvcnQgbGV0IGNlcnRIb29rID0gcGx1Z2lucy5wYXRoLmpvaW4oX19kaXJuYW1lLFwiY2VydC5ob29rLmpzXCIpO1xuZXhwb3J0IGxldCBjb25maWcgPSBwbHVnaW5zLnBhdGguam9pbihfX2Rpcm5hbWUsXCJhc3NldHMvY29uZmlnLmpzb25cIik7XG5leHBvcnQgbGV0IGxldHNlbmNyeXB0U2ggPSBwbHVnaW5zLnBhdGguam9pbihfX2Rpcm5hbWUsXCJhc3NldHMvbGV0c2VuY3J5cHQuc2hcIik7XG5leHBvcnQgbGV0IGNlcnREaXIgPSBwbHVnaW5zLnBhdGguam9pbihfX2Rpcm5hbWUsXCIvYXNzZXRzL2NlcnRzXCIpOyJdfQ==
|
||||
|
1
dist/cert.plugins.d.ts
vendored
1
dist/cert.plugins.d.ts
vendored
@ -7,4 +7,5 @@ export declare let q: any;
|
||||
export declare let shelljs: any;
|
||||
export import smartcli = require("smartcli");
|
||||
export import smartfile = require("smartfile");
|
||||
export import smartgit = require("smartgit");
|
||||
export import smartstring = require("smartstring");
|
||||
|
3
dist/cert.plugins.js
vendored
3
dist/cert.plugins.js
vendored
@ -8,6 +8,7 @@ exports.q = require("q");
|
||||
exports.shelljs = require("shelljs");
|
||||
exports.smartcli = require("smartcli");
|
||||
exports.smartfile = require("smartfile");
|
||||
exports.smartgit = require("smartgit");
|
||||
exports.smartstring = require("smartstring");
|
||||
|
||||
//# sourceMappingUR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7XG5leHBvcnQgaW1wb3J0IHBhdGggPSByZXF1aXJlKFwicGF0aFwiKTtcbmV4cG9ydCBsZXQgcSA9IHJlcXVpcmUoXCJxXCIpO1xuZXhwb3J0IGxldCBzaGVsbGpzID0gcmVxdWlyZShcInNoZWxsanNcIik7XG5leHBvcnQgaW1wb3J0IHNtYXJ0Y2xpID0gcmVxdWlyZShcInNtYXJ0Y2xpXCIpO1xuZXhwb3J0IGltcG9ydCBzbWFydGZpbGUgPSByZXF1aXJlKFwic21hcnRmaWxlXCIpO1xuZXhwb3J0IGltcG9ydCBzbWFydGdpdCA9IHJlcXVpcmUoXCJzbWFydGdpdFwiKTtcbmV4cG9ydCBpbXBvcnQgc21hcnRzdHJpbmcgPSByZXF1aXJlKFwic21hcnRzdHJpbmdcIik7XG5cbiJdfQ==
|
||||
|
8
dist/index.d.ts
vendored
8
dist/index.d.ts
vendored
@ -2,8 +2,8 @@ export declare class Cert {
|
||||
cfEmail: string;
|
||||
cfKey: string;
|
||||
sslDir: string;
|
||||
certificatesPresent: any;
|
||||
certificatesValid: any;
|
||||
certificatesPresent: Certificate[];
|
||||
certificatesValid: Certificate[];
|
||||
gitOriginRepo: any;
|
||||
constructor(optionsArg: {
|
||||
cfEmail: string;
|
||||
@ -11,7 +11,9 @@ export declare class Cert {
|
||||
sslDir: string;
|
||||
gitOriginRepo?: string;
|
||||
});
|
||||
getDomainCert(domainNameArg: string): any;
|
||||
getDomainCert(domainNameArg: string, optionsArg?: {
|
||||
force: boolean;
|
||||
}): any;
|
||||
}
|
||||
export declare class Certificate {
|
||||
domainName: string;
|
||||
|
31
dist/index.js
vendored
31
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -25,13 +25,13 @@
|
||||
"homepage": "https://gitlab.com/pushrocks/cert#readme",
|
||||
"dependencies": {
|
||||
"beautylog": "^5.0.12",
|
||||
"cflare": "0.0.7",
|
||||
"cflare": "0.0.9",
|
||||
"fs-extra": "^0.30.0",
|
||||
"q": "^1.4.1",
|
||||
"shelljs": "^0.7.0",
|
||||
"smartcli": "^1.0.4",
|
||||
"smartfile": "^3.0.10",
|
||||
"smartgit": "0.0.10",
|
||||
"smartfile": "^4.0.5",
|
||||
"smartgit": "0.1.0",
|
||||
"smartstring": "^2.0.10",
|
||||
"typings-global": "^1.0.3"
|
||||
},
|
||||
|
@ -16,7 +16,7 @@ describe("cert", function () {
|
||||
});
|
||||
});
|
||||
describe("Cert", function () {
|
||||
it("should create a new 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,
|
||||
@ -26,11 +26,11 @@ describe("cert", function () {
|
||||
});
|
||||
it("should get a valid certificate", function (done) {
|
||||
this.timeout(120000);
|
||||
testCert.getDomainCert("sub2.bleu.de").then(function () {
|
||||
testCert.getDomainCert("sub6.bleu.de").then(function () {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsUUFBTyxRQUFRLENBQUMsQ0FBQTtBQUNoQixxQkFBbUIsTUFBTSxDQUFDLENBQUE7QUFFMUIsd0JBQTJCLGlCQUFpQixDQUFDLENBQUE7QUFDN0MsSUFBWSxJQUFJLFdBQU0sZUFBZSxDQUFDLENBQUE7QUFHdEMsSUFBSSxRQUFRLEdBQUcsSUFBSSxXQUFJLENBQUMsT0FBTyxDQUFDLEdBQUcsRUFBRSxFQUFFLE9BQU8sQ0FBQyxHQUFHLEVBQUUsR0FBRyxTQUFTLENBQUMsQ0FBQztBQUVsRSxJQUFJLFFBQWtCLENBQUM7QUFFdkIsUUFBUSxDQUFDLE1BQU0sRUFBQztJQUNaLFFBQVEsQ0FBQyxTQU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MDAwMCk7XG4gICAgICAgICAgICB0ZXN0Q2VydC5nZXREb21haW5DZXJ0KFwic3ViNi5ibGV1LmRlXCIpLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KVxuICAgIH0pXG59KTsiXX0=
|
||||
|
@ -30,7 +30,7 @@ describe("cert",function(){
|
||||
})
|
||||
it("should get a valid certificate",function(done){
|
||||
this.timeout(120000);
|
||||
testCert.getDomainCert("sub3.bleu.de").then(() => {
|
||||
testCert.getDomainCert("sub6.bleu.de").then(() => {
|
||||
done();
|
||||
});
|
||||
})
|
||||
|
@ -7,7 +7,7 @@ import * as paths from "./cert.paths";
|
||||
|
||||
let smartcli = new plugins.smartcli.Smartcli();
|
||||
|
||||
let config = plugins.smartfile.local.toObjectSync(paths.config);
|
||||
let config = plugins.smartfile.fs.toObjectSync(paths.config);
|
||||
let cflare = new plugins.cflare.CflareAccount();
|
||||
cflare.auth({
|
||||
email: config.cfEmail,
|
||||
@ -16,7 +16,10 @@ cflare.auth({
|
||||
|
||||
let setChallenge = (domainNameArg: string, challengeArg: string) => {
|
||||
let done = plugins.q.defer();
|
||||
plugins.beautylog.log("setting challenge for " + domainNameArg);
|
||||
cflare.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();
|
||||
});
|
||||
@ -26,16 +29,29 @@ let setChallenge = (domainNameArg: string, challengeArg: string) => {
|
||||
|
||||
let cleanChallenge = (domainNameArg) => {
|
||||
let done = plugins.q.defer();
|
||||
plugins.beautylog.log("cleaning challenge for " + domainNameArg);
|
||||
cflare.removeRecord(prefixName(domainNameArg), "TXT");
|
||||
return done.promise;
|
||||
}
|
||||
|
||||
let cooldown = () => {
|
||||
let done = plugins.q.defer();
|
||||
console.log("Cooling down!");
|
||||
setTimeout(() => {
|
||||
done.resolve();
|
||||
}, 20000)
|
||||
let cooldowntime = 40000;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -4,4 +4,4 @@ import * as plugins from "./cert.plugins";
|
||||
export let certHook = plugins.path.join(__dirname,"cert.hook.js");
|
||||
export let config = plugins.path.join(__dirname,"assets/config.json");
|
||||
export let letsencryptSh = plugins.path.join(__dirname,"assets/letsencrypt.sh");
|
||||
export let sslDir = plugins.path.join(__dirname,"/assets/certs");
|
||||
export let certDir = plugins.path.join(__dirname,"/assets/certs");
|
14
ts/index.ts
14
ts/index.ts
@ -22,14 +22,18 @@ export class Cert {
|
||||
cfEmail: this.cfEmail,
|
||||
cfKey: this.cfKey
|
||||
}
|
||||
plugins.smartfile.memory.toFsSync(JSON.stringify(config), { fileName: "config.json", filePath: plugins.path.join(__dirname, "assets/") });
|
||||
plugins.smartfile.memory.toFsSync(JSON.stringify(config),plugins.path.join(__dirname, "assets/config.json"));
|
||||
};
|
||||
getDomainCert(domainNameArg: string,optionsArg:{force:boolean}) {
|
||||
getDomainCert(domainNameArg: string,optionsArg?:{force:boolean}) {
|
||||
let done = plugins.q.defer();
|
||||
if (!checkDomainStillValid(domainNameArg) || optionsArg.force) {
|
||||
plugins.shelljs.exec("chmod 700 " + paths.letsencryptSh);
|
||||
plugins.shelljs.exec("chmod 700 " + paths.certHook);
|
||||
plugins.shelljs.exec("bash -c \"" + paths.letsencryptSh + " -c -d " + domainNameArg + " -t dns-01 -k " + paths.certHook + " -o " + paths.sslDir + "\"");
|
||||
plugins.shelljs.exec("bash -c \"" + paths.letsencryptSh + " -c -d " + domainNameArg + " -t dns-01 -k " + paths.certHook + " -o " + paths.certDir + "\"");
|
||||
let fetchedCertsArray:string[] = plugins.smartfile.fs.listFoldersSync(paths.certDir);
|
||||
if(fetchedCertsArray.indexOf(domainNameArg) != -1){
|
||||
updateSslDir(domainNameArg);
|
||||
}
|
||||
done.resolve();
|
||||
} else {
|
||||
plugins.beautylog.info("certificate for " + domainNameArg + " is still valid! Not fetching new one!");
|
||||
@ -39,7 +43,7 @@ export class Cert {
|
||||
};
|
||||
}
|
||||
|
||||
class Certificate {
|
||||
export class Certificate {
|
||||
domainName: string;
|
||||
creationDate: Date;
|
||||
expiryDate: Date;
|
||||
@ -52,7 +56,7 @@ let checkDomainStillValid = (domainNameArg: string): boolean => {
|
||||
return false;
|
||||
}
|
||||
|
||||
let updateSslDir = () => {
|
||||
let updateSslDir = (domainNameArg) => {
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user