express server läuft jetzt mit https
This commit is contained in:
Lukas Nowy
2018-12-16 19:08:08 +01:00
parent 5589b0df3f
commit fd947bd852
475 changed files with 91128 additions and 0 deletions

21
express-server/node_modules/certpem/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016 Daplie, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

65
express-server/node_modules/certpem/README.md generated vendored Normal file
View File

@ -0,0 +1,65 @@
cert-info.js
============
Read basic info from a cert.pem / x509 certificate.
Used for [Greenlock.js](https://git.coolaj86.com/coolaj86/greenlock-express.js)
Install
=======
```bash
# bin
npm install --global certpem
# node.js library
npm install --save certpem
```
Usage
=====
CLI
---
For basic info (subject, altnames, issuedAt, expiresAt):
```bash
certpem /path/to/cert.pem
```
Output all info by passing `--debug` or use `--json` to see the basic info pretty-printed.
node.js
-------
```javascript
'use strict';
var certpem = require('certpem').certpem
var cert = fs.readFile('cert.pem', 'ascii', function (err, certstr) {
// basic info
console.info(certpem.info(certstr));
// way too much info
// (requires npm install --save node.extend@1)
console.info(certpem.debug(certstr));
});
```
Example output:
```javascript
{
"subject": "localhost.daplie.com",
"altnames": [
"localhost.daplie.com"
],
"issuedAt": 1465516800000,
"expiresAt": 1499731199000
}
```
With a few small changes this could also work in the browser (that's how its dependencies are designed).

52
express-server/node_modules/certpem/bin/certpem.js generated vendored Normal file
View File

@ -0,0 +1,52 @@
#!/usr/bin/env node
'use strict';
var certpem = require('../').certpem;
var path = require('path');
var filepath = (process.cwd() + path.sep + 'cert.pem');
var debug = false;
var json;
var cert;
if (/--debug/.test(process.argv[2]) || /--debug/.test(process.argv[3])) {
debug = true;
}
if (/--json/.test(process.argv[2]) || /--json/.test(process.argv[3])) {
json = true;
}
if (process.argv[2] && !/^--/.test(process.argv[2])) {
filepath = process.argv[2];
}
if (process.argv[3] && !/^--/.test(process.argv[3])) {
filepath = process.argv[3];
}
if (filepath.length > 256) {
cert = filepath;
}
else {
cert = require('fs').readFileSync(filepath, 'ascii');
}
if (debug) {
console.info(JSON.stringify(certpem.debug(cert), null, ' '));
} else {
var c = certpem.info(cert);
if (json) {
console.info(JSON.stringify(c, null, ' '));
return;
}
console.info('');
console.info('Certificate for', c.subject);
console.info('');
console.info('Altnames:', c.altnames.join(', '));
console.info('');
console.info('Issued at', new Date(c.issuedAt));
console.info('Expires at', new Date(c.expiresAt));
console.info('');
}

31
express-server/node_modules/certpem/cert.pem generated vendored Normal file
View File

@ -0,0 +1,31 @@
-----BEGIN CERTIFICATE-----
MIIFajCCBFKgAwIBAgIQdsKX6kswrkbK7NZ/kc31vTANBgkqhkiG9w0BAQsFADBC
MQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMS
UmFwaWRTU0wgU0hBMjU2IENBMB4XDTE2MDYxMDAwMDAwMFoXDTE3MDcxMDIzNTk1
OVowHzEdMBsGA1UEAwwUbG9jYWxob3N0LmRhcGxpZS5jb20wggEiMA0GCSqGSIb3
DQEBAQUAA4IBDwAwggEKAoIBAQCd49Z2PuWyX9qFlURgq8E0OzMP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uxOizGdwCjw1mAT5G9+443fNDsgN3BAAAAFVOonO8gAABAMARTBDAh84cfLQthSR
Pe6hFgL8TPSuCUxIFBcEbnIPNB7ZxQwYAiBTClbmIn81bBkwAjasJu2u+UdxGE0i
Wx5lFe5X9pqsUTANBgkqhkiG9w0BAQsFAAOCAQEAAWYuT/fTBZdXb4kwoVaUnc82
2CEnGuOHr9QMdGRMqWJRe068StADdw1u3V6bcB7+mBiGl8C+WOLhv9WxYKqNFvyj
Eeaeekb4GqfrfuxNvoOU/vHdYaww2J9N1ESgIV4BdFF8aNgOnjpRcKSMsMgzNJdU
lh6l7jhnTeNYCyMnn+2dVQBcRQvptKmpkS4sK6NAVSMWDioImEoGj0PCdLqG8k21
d3vNddCEQmcNUTHs38nswUKZxfQKpjo+z9jBFmurmaNqSFnd8ySmBELZjXEOXEQz
KBlUSDj3UYVmH49t0toGyHVfKHPCBLyUZhvUTy0tNVgn9Nc+/MXJnv+c5rxVeQ==
-----END CERTIFICATE-----

120
express-server/node_modules/certpem/index.js generated vendored Normal file
View File

@ -0,0 +1,120 @@
'use strict';
var certInfo = module.exports;
module.exports.certpem = certInfo;
// ES5 version of mergeDeep
// https://stackoverflow.com/questions/27936772/how-to-deep-merge-instead-of-shallow-merge
/**
* Simple object check.
* @param item
* @returns {boolean}
*/
function isObject(item) {
return (item && typeof item === 'object' && !Array.isArray(item));
}
/**
* Deep merge two objects.
* @param target
* @param ...sources
*/
function merge(target) {
var sources = Array.prototype.slice.call(arguments);
sources.shift();
if (!sources.length) { return target; }
var source = sources.shift();
var obj;
if (isObject(target) && isObject(source)) {
Object.keys(source).forEach(function (key) {
if (isObject(source[key])) {
if (!target[key]) { obj = {}; obj[key] = {}; Object.assign(target, obj); }
merge(target[key], source[key]);
} else {
obj = {}; obj[key] = source[key];
Object.assign(target, obj);
}
});
}
sources.unshift(target);
return merge.apply(null, sources);
}
var common = require("asn1js/org/pkijs/common");
var _asn1js = require("asn1js");
var _pkijs = require("pkijs");
var _x509schema = require("pkijs/org/pkijs/x509_schema");
// #region Merging function/object declarations for ASN1js and PKIjs
var asn1js = merge(_asn1js, common);
var x509schema = merge(_x509schema, asn1js);
var pkijs_1 = merge(_pkijs, asn1js);
var pkijs = merge(pkijs_1, x509schema);
// this is really memory expensive to do
// (about half of a megabyte of loaded code)
certInfo._pemToBinAb = function (pem) {
var b64 = pem.replace(/(-----(BEGIN|END) CERTIFICATE-----|[\n\r])/g, '');
var buf = Buffer.from(b64, 'base64');
var ab = new Uint8Array(buf).buffer; // WORKS
//var ab = buf.buffer // Doesn't work
return ab;
};
certInfo.debug = certInfo.getCertInfo = function (pem) {
var ab = module.exports._pemToBinAb(pem);
var asn1 = pkijs.org.pkijs.fromBER(ab);
var certSimpl = new pkijs.org.pkijs.simpl.CERT({ schema: asn1.result });
return certSimpl;
};
certInfo.info = certInfo.getBasicInfo = function (pem) {
var c = certInfo.getCertInfo(pem);
var domains = [];
var sub;
c.extensions.forEach(function (ext) {
if (ext.parsedValue && ext.parsedValue.altNames) {
ext.parsedValue.altNames.forEach(function (alt) {
domains.push(alt.Name);
});
}
});
sub = c.subject.types_and_values[0].value.value_block.value || null;
return {
subject: sub
, altnames: domains
// for debugging during console.log
// do not expect these values to be here
, _issuedAt: c.notBefore.value
, _expiresAt: c.notAfter.value
, issuedAt: new Date(c.notBefore.value).valueOf()
, expiresAt: new Date(c.notAfter.value).valueOf()
};
};
certInfo.getCertInfoFromFile = function (pemFile) {
return require('fs').readFileSync(pemFile, 'ascii');
};
/*
certInfo.testGetCertInfo = function (pathname) {
var path = require('path');
var pemFile = pathname || path.join(__dirname, '..', 'tests', 'example.cert.pem');
return certInfo.getCertInfo(certInfo.getCertInfoFromFile(pemFile));
};
certInfo.testBasicCertInfo = function (pathname) {
var path = require('path');
var pemFile = pathname || path.join(__dirname, '..', 'tests', 'example.cert.pem');
return certInfo.getBasicInfo(certInfo.getCertInfoFromFile(pemFile));
};
*/

105
express-server/node_modules/certpem/package.json generated vendored Normal file
View File

@ -0,0 +1,105 @@
{
"_args": [
[
"certpem@^1.1.0",
"/nodeapps/https-test/greenlock-express.js/node_modules/greenlock"
]
],
"_from": "certpem@>=1.1.0 <2.0.0",
"_id": "certpem@1.1.2",
"_inCache": true,
"_installable": true,
"_location": "/certpem",
"_nodeVersion": "10.6.0",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/certpem_1.1.2_1534472297185_0.6089090318511978"
},
"_npmUser": {
"email": "coolaj86@gmail.com",
"name": "coolaj86"
},
"_npmVersion": "6.1.0",
"_phantomChildren": {},
"_requested": {
"name": "certpem",
"raw": "certpem@^1.1.0",
"rawSpec": "^1.1.0",
"scope": null,
"spec": ">=1.1.0 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/greenlock"
],
"_resolved": "https://registry.npmjs.org/certpem/-/certpem-1.1.2.tgz",
"_shasum": "b532a03e9be59dcfe99c0350aff21d6bbbb4b83d",
"_shrinkwrap": null,
"_spec": "certpem@^1.1.0",
"_where": "/nodeapps/https-test/greenlock-express.js/node_modules/greenlock",
"author": {
"email": "coolaj86@gmail.com",
"name": "AJ ONeal",
"url": "https://coolaj86.com/"
},
"bin": {
"certpem": "bin/certpem.js"
},
"bugs": {
"url": "https://git.coolaj86.com/coolaj86/cert-info.js/issues"
},
"dependencies": {
"asn1js": "^1.2.12",
"pkijs": "^1.3.27"
},
"description": "Read basic info (subject, altnames, expiresAt, issuedAt) from a cert.pem / x509 certificate (tls / ssl / https) ",
"devDependencies": {},
"directories": {},
"dist": {
"fileCount": 7,
"integrity": "sha512-rqddNO1OdN6o7j1C486Os9USHgGEyoBSRHDgVAqx0jVAmGlgGQ1XPCrrl2KKxzdWBNC184V3gpV5BsvcDDQ+Vg==",
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbdjBpCRA9TVsSAnZWagAA7y0P/ijpH77/RCiFiLVcZYbP\ne5ifxMsLDwRyORj6PDOyoHUTtz3Km7aBCmKl104pBp4R2LvE49zYge5IzGUB\nunpwAciLL06JnG9aOLPVJGR60Vk6i3no4dtbZxOzubMDiAnyaE5377uHnXLk\ni82+UZM056ZxVTnf8FMsSdE7PYpqitPy+jRHw0h9F8k4mo7V6RftuVImUJYW\nOknvSTsbMe/B+5MjUKWGx9hTIwBE/926P48x+VHnRMP+6yj2JWGKpllRueuc\ndLntSBXGUgtNGVkG0Q4uZ4VM+hm1BYUinu6BNKy7999JH+QChK3HqpSuy3dw\nbYkfdRAFAVquk12r668kFT7I5F7zAsqrjL8rbZ/3bwR5fstqSrJ3W98EMbLK\nzYQ33pm4UiDfXmT33gXW+pWWbP+4V5eNfz9JqEET5xxlluqnPNqJzhK0J4dY\nImSg5lu0VO5n1wkCcwA5txwH5RyTTTQ8cvS+yj82+IL9n6QXkFr4tpBX08Ug\nF7N8Vx+u6NIZWOhkApL04BW6PmlOcRk6hfCJ8S+5niUe3Tew1odbuo2ayzYV\nSZakVRx1JPsDe4Jpjaz0xTtnudkRzVENg+HGiWlflOuC+DEjpER1Y6uN5j66\nmGSBx1NRcJ4P/Vc8zVPUNMpN3MD37zRXoh0JUQdcGUtucT6zBCX1JZvMlHO+\nhBsN\r\n=c78a\r\n-----END PGP SIGNATURE-----\r\n",
"shasum": "b532a03e9be59dcfe99c0350aff21d6bbbb4b83d",
"tarball": "https://registry.npmjs.org/certpem/-/certpem-1.1.2.tgz",
"unpackedSize": 9695
},
"gitHead": "1b62407ea523e9e58799ff0516eadeaeb34347f5",
"homepage": "https://git.coolaj86.com/coolaj86/cert-info.js",
"keywords": [
"altnames",
"asn1",
"at",
"cert",
"cert.pem",
"certificate",
"expired",
"expires",
"expiresAt",
"issued",
"issuedAt",
"notAfter",
"notBefore",
"pki",
"subject",
"x509"
],
"license": "(MIT OR Apache-2.0)",
"main": "index.js",
"maintainers": [
{
"name": "coolaj86",
"email": "coolaj86@gmail.com"
}
],
"name": "certpem",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "https://git.coolaj86.com/coolaj86/cert-info.js.git"
},
"scripts": {
"test": "node test.js"
},
"version": "1.1.2"
}

3
express-server/node_modules/certpem/test.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
'use strict';
require('./bin/certpem.js');