spec-3nweb-server 1.7.13 → 1.7.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/{config/cli → cli}/index.js +1 -1
- package/build/config/letsencrypt.js +5 -3
- package/build/lib-server/resources/mailerid-authorizer.d.ts +6 -1
- package/build/lib-server/resources/mailerid-authorizer.js +6 -5
- package/build/lib-server/routes/sessions/mid-auth.js +3 -3
- package/build/mailerId/mailerId-app.d.ts +5 -1
- package/build/mailerId/mailerId-app.js +8 -2
- package/build/main.js +1 -1
- package/build/services.js +8 -3
- package/package.json +1 -1
- /package/build/{config/cli → cli}/index.d.ts +0 -0
- /package/build/{config/cli → cli}/run-cmd.d.ts +0 -0
- /package/build/{config/cli → cli}/run-cmd.js +0 -0
- /package/build/{config/cli → cli}/show-sample-config.d.ts +0 -0
- /package/build/{config/cli → cli}/show-sample-config.js +0 -0
- /package/build/{config/cli → cli}/signup-cmd.d.ts +0 -0
- /package/build/{config/cli → cli}/signup-cmd.js +0 -0
- /package/build/{config/cli → cli}/user-cmd.d.ts +0 -0
- /package/build/{config/cli → cli}/user-cmd.js +0 -0
- /package/build/{config/cli → cli}/utils.d.ts +0 -0
- /package/build/{config/cli → cli}/utils.js +0 -0
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.parseProcessArgv = void 0;
|
|
20
|
-
const default_confs_1 = require("../default-confs");
|
|
20
|
+
const default_confs_1 = require("../config/default-confs");
|
|
21
21
|
const run_cmd_1 = require("./run-cmd");
|
|
22
22
|
const show_sample_config_1 = require("./show-sample-config");
|
|
23
23
|
const signup_cmd_1 = require("./signup-cmd");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2023 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2023, 2025 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -19,13 +19,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.sslOptsFromConfig = void 0;
|
|
20
20
|
const fs_1 = require("fs");
|
|
21
21
|
const path_1 = require("path");
|
|
22
|
+
const LETSENCRYPT_CERT_FILE = 'fullchain.pem';
|
|
23
|
+
const LETSENCRYPT_KEY_FILE = 'privkey.pem';
|
|
22
24
|
function sslOptsFromConfig(letsencrypt, sslOpts, skipReloadOnCertsChange) {
|
|
23
25
|
if (!sslOpts) {
|
|
24
26
|
sslOpts = {};
|
|
25
27
|
}
|
|
26
28
|
if (letsencrypt) {
|
|
27
|
-
sslOpts.cert = (0, fs_1.readFileSync)((0, path_1.join)(letsencrypt,
|
|
28
|
-
sslOpts.key = (0, fs_1.readFileSync)((0, path_1.join)(letsencrypt,
|
|
29
|
+
sslOpts.cert = (0, fs_1.readFileSync)((0, path_1.join)(letsencrypt, LETSENCRYPT_CERT_FILE));
|
|
30
|
+
sslOpts.key = (0, fs_1.readFileSync)((0, path_1.join)(letsencrypt, LETSENCRYPT_KEY_FILE));
|
|
29
31
|
if (skipReloadOnCertsChange) {
|
|
30
32
|
return { sslOpts };
|
|
31
33
|
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
import { SignedLoad } from '../../lib-common/jwkeys';
|
|
1
2
|
import { MidAuthorizer } from '../routes/sessions/mid-auth';
|
|
2
|
-
export declare function validator(): MidAuthorizer;
|
|
3
|
+
export declare function validator(ownMidService: OwnMidService | undefined): MidAuthorizer;
|
|
4
|
+
export interface OwnMidService {
|
|
5
|
+
domain: string;
|
|
6
|
+
getRoot: () => SignedLoad;
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2016, 2019 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015 - 2016, 2019, 2025 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -62,11 +62,11 @@ function getRootCert(serviceURL) {
|
|
|
62
62
|
}
|
|
63
63
|
// TODO need to add caching of certs using domain->(kid->cert)
|
|
64
64
|
// (this will speed things up)
|
|
65
|
-
function validator() {
|
|
66
|
-
return (rpDomain, sessionId, userId, assertion, userCert, provCert) => validate(rpDomain, sessionId, userId, assertion, userCert, provCert);
|
|
65
|
+
function validator(ownMidService) {
|
|
66
|
+
return (rpDomain, sessionId, userId, assertion, userCert, provCert) => validate(rpDomain, sessionId, userId, assertion, userCert, provCert, ownMidService);
|
|
67
67
|
}
|
|
68
68
|
exports.validator = validator;
|
|
69
|
-
async function validate(rpDomain, sessionId, userId, assertion, userCert, provCert) {
|
|
69
|
+
async function validate(rpDomain, sessionId, userId, assertion, userCert, provCert, ownMidService) {
|
|
70
70
|
const validAt = Date.now() / 1000;
|
|
71
71
|
try {
|
|
72
72
|
// check that certificate is for the user
|
|
@@ -83,7 +83,8 @@ async function validate(rpDomain, sessionId, userId, assertion, userCert, provCe
|
|
|
83
83
|
return false;
|
|
84
84
|
}
|
|
85
85
|
// get root certificate and check the whole chain
|
|
86
|
-
const rootCert =
|
|
86
|
+
const rootCert = ((ownMidService && (issuer === ownMidService.domain)) ?
|
|
87
|
+
ownMidService.getRoot() : await getRootCert(serviceURL));
|
|
87
88
|
const assertInfo = mid.relyingParty.verifyAssertion(assertion, { user: userCert, prov: provCert, root: rootCert }, issuer, validAt);
|
|
88
89
|
if ((assertInfo.relyingPartyDomain === rpDomain)
|
|
89
90
|
&& (assertInfo.sessionId === sessionId)) {
|
|
@@ -36,9 +36,9 @@ function midLogin(relyingPartyDomain, midAuthorizingFunc) {
|
|
|
36
36
|
}
|
|
37
37
|
const rb = req.body;
|
|
38
38
|
const sessionId = req.session.id;
|
|
39
|
-
if (!(0, jwkeys_1.isLikeSignedMailerIdAssertion)(rb.assertion)
|
|
40
|
-
!(0, jwkeys_1.isLikeSignedKeyCert)(rb.userCert)
|
|
41
|
-
!(0, jwkeys_1.isLikeSignedKeyCert)(rb.provCert)) {
|
|
39
|
+
if (!(0, jwkeys_1.isLikeSignedMailerIdAssertion)(rb.assertion)
|
|
40
|
+
|| !(0, jwkeys_1.isLikeSignedKeyCert)(rb.userCert)
|
|
41
|
+
|| !(0, jwkeys_1.isLikeSignedKeyCert)(rb.provCert)) {
|
|
42
42
|
res.sendStatus(login_1.ERR_SC.malformed);
|
|
43
43
|
req.session.close();
|
|
44
44
|
return;
|
|
@@ -4,4 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import * as express from 'express';
|
|
6
6
|
import { ErrLogger } from '../lib-server/middleware/error-handler';
|
|
7
|
-
|
|
7
|
+
import { OwnMidService } from '../lib-server/resources/mailerid-authorizer';
|
|
8
|
+
export declare function makeMailerIdApp(rootFolder: string, domain: string, certFile: string, errLogger?: ErrLogger): {
|
|
9
|
+
app: express.Express;
|
|
10
|
+
ownService: OwnMidService;
|
|
11
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2016, 2020, 2024 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015 - 2016, 2020, 2024 - 2025 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -64,7 +64,13 @@ function makeMailerIdApp(rootFolder, domain, certFile, errLogger) {
|
|
|
64
64
|
res.status(200).json(json); // content type application/json
|
|
65
65
|
});
|
|
66
66
|
app.use((0, error_handler_1.makeErrHandler)(errLogger));
|
|
67
|
-
return
|
|
67
|
+
return {
|
|
68
|
+
app,
|
|
69
|
+
ownService: {
|
|
70
|
+
domain,
|
|
71
|
+
getRoot: () => certifier.getRootCert()
|
|
72
|
+
}
|
|
73
|
+
};
|
|
68
74
|
}
|
|
69
75
|
exports.makeMailerIdApp = makeMailerIdApp;
|
|
70
76
|
Object.freeze(exports);
|
package/build/main.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
const cli_1 = require("./
|
|
20
|
+
const cli_1 = require("./cli");
|
|
21
21
|
const from_yaml_1 = require("./config/from-yaml");
|
|
22
22
|
const letsencrypt_1 = require("./config/letsencrypt");
|
|
23
23
|
const lib_1 = require("./lib");
|
package/build/services.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2017, 2020, 2024 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015 - 2017, 2020, 2024 - 2025 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -30,12 +30,17 @@ function servicesApp(conf, errLogger, logSetup) {
|
|
|
30
30
|
throw new Error('Missing enabled-services sections in confs.');
|
|
31
31
|
}
|
|
32
32
|
const app = new app_1.AppWithWSs();
|
|
33
|
-
|
|
33
|
+
let midAuthorizer; // share, allowing for caching of certs
|
|
34
34
|
if (conf.enabledServices.mailerId) {
|
|
35
|
-
app
|
|
35
|
+
const { app: midApp, ownService } = (0, mailerId_app_1.makeMailerIdApp)(conf.rootFolder, conf.domain, conf.mailerId.certs, (errLogger === 'console') ? (0, error_handler_1.makeErrLoggerToConsole)('MailerId') : errLogger);
|
|
36
|
+
app.http.use('/mailerid', midApp);
|
|
36
37
|
if (logSetup === 'console') {
|
|
37
38
|
console.log(`Enabled MailerId service with provider domain ${conf.domain}`);
|
|
38
39
|
}
|
|
40
|
+
midAuthorizer = (0, mailerid_authorizer_1.validator)(ownService);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
midAuthorizer = (0, mailerid_authorizer_1.validator)(undefined);
|
|
39
44
|
}
|
|
40
45
|
if (conf.enabledServices.asmail) {
|
|
41
46
|
app.use('/asmail', (0, asmail_app_1.makeASMailApp)(conf.rootFolder, conf.domain, midAuthorizer, (errLogger === 'console') ? (0, error_handler_1.makeErrLoggerToConsole)('ASMail') : errLogger));
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|