Initial fork commit
This commit is contained in:
parent
f3fe584bfa
commit
34d9abec19
25 changed files with 36 additions and 3840 deletions
|
|
@ -2,4 +2,4 @@ Copyright 2021 Zachary Balder
|
|||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
# certnode
|
||||
|
||||
Modified certnode. Please see https://github.com/zbo14/certnode
|
||||
Modified certnode. Please see https://github.com/zbo14/certnode
|
||||
|
|
@ -10,6 +10,7 @@ import pem from "pem";
|
|||
import * as common from "./common.js";
|
||||
import request from "./request.js";
|
||||
const createCsr = promisify(pem.createCSR);
|
||||
|
||||
/**
|
||||
* Represents a Let's Encrypt account and
|
||||
* sends requests to get valid TLS certificates.
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export const PRIVATE_KEY_TYPE = 'pkcs8';
|
|||
export const PUBLIC_KEY_FORMAT = 'pem';
|
||||
export const PUBLIC_KEY_PERMISSIONS = 0o666;
|
||||
export const PUBLIC_KEY_TYPE = 'spki';
|
||||
|
||||
/**
|
||||
* @param {crypto.KeyObject} privateKey
|
||||
* @param {String} [passphrase]
|
||||
|
|
@ -30,6 +31,7 @@ export const exportPrivateKey = (privateKey, passphrase) => {
|
|||
}
|
||||
return privateKey.export(privateKeyOpts);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {crypto.KeyObject} publicKey
|
||||
*/
|
||||
|
|
@ -40,6 +42,7 @@ export const exportPublicKey = publicKey => {
|
|||
format: PUBLIC_KEY_FORMAT
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {String} privateKeyData
|
||||
* @param {String} [passphrase]
|
||||
|
|
@ -63,6 +66,7 @@ export const importPrivateKey = (privateKeyData, passphrase) => {
|
|||
throw new Error('Failed to import private key');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {String} publicKeyData
|
||||
*
|
||||
|
|
@ -80,6 +84,7 @@ export const importPublicKey = publicKeyData => {
|
|||
throw new Error('Failed to import public key');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {String} filename
|
||||
* @param {crypto.KeyObject|string} key
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
import Client from './client.js';
|
||||
export * from './common.js';
|
||||
export { Client };
|
||||
export { Client };
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import https from "https";
|
||||
|
||||
/**
|
||||
* @param {string | URL} url
|
||||
* @param {import('https').RequestOptions & {data?: string}} [options]
|
||||
|
|
|
|||
|
|
@ -9,10 +9,12 @@ import { findTxtRecord, isHostBlacklisted, combineURLs } from "./util.js";
|
|||
* @property {number} expire
|
||||
* @property {number} httpStatus
|
||||
*/
|
||||
|
||||
/**
|
||||
* @type {Object<string, Cache>}
|
||||
*/
|
||||
const resolveCache = {};
|
||||
|
||||
/**
|
||||
* @param {string} host
|
||||
* @returns {Promise<Cache>}
|
||||
|
|
@ -42,7 +44,9 @@ async function buildCache(host) {
|
|||
httpStatus: parseInt(httpStatus),
|
||||
};
|
||||
}
|
||||
|
||||
const acme_prefix = '/.well-known/acme-challenge/';
|
||||
|
||||
/**
|
||||
* @type {import('http').RequestListener}
|
||||
*/
|
||||
|
|
@ -92,4 +96,5 @@ const listener = async function (req, res) {
|
|||
res.end();
|
||||
}
|
||||
};
|
||||
|
||||
export default listener;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ function getCertCachePath(host) {
|
|||
const hash = md5(host);
|
||||
return path.join(certsDir, hash.substring(0, 2), hash.substring(2), host);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} host
|
||||
*/
|
||||
|
|
@ -71,6 +72,7 @@ async function buildCache(host) {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} servername
|
||||
*/
|
||||
|
|
@ -89,6 +91,7 @@ async function getKeyCert(servername) {
|
|||
cert: cache.cert,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} servername
|
||||
* @param {(err: any, cb: tls.SecureContext|undefined) => void} ctx
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import request from "./certnode/lib/request.js";
|
|||
import crypto from "crypto";
|
||||
import fs from "fs";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const recordParamDestUrl = 'forward-domain';
|
||||
const recordParamHttpStatus = 'http-status';
|
||||
let blacklistURL = null;
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue