carta-controller 2.0.4 → 3.0.0-beta.1d
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/.prettierrc.json +18 -0
- package/README.md +3 -3
- package/config/config_schema.json +10 -0
- package/config/snippet_schema.json +44 -0
- package/dist/auth/google.js.map +1 -1
- package/dist/auth/index.js +2 -2
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/ldap.js +2 -2
- package/dist/auth/ldap.js.map +1 -1
- package/dist/auth/local.js +2 -2
- package/dist/auth/local.js.map +1 -1
- package/dist/auth/pam.js.map +1 -1
- package/dist/controllerTests.js +38 -27
- package/dist/database.js +93 -0
- package/dist/index.js +2 -2
- package/dist/serverHandlers.js +29 -22
- package/dist/util.js +3 -3
- package/docs/_build/doctrees/configuration.doctree +0 -0
- package/docs/_build/doctrees/environment.pickle +0 -0
- package/docs/_build/doctrees/index.doctree +0 -0
- package/docs/_build/doctrees/introduction.doctree +0 -0
- package/docs/_build/doctrees/schema.doctree +0 -0
- package/docs/_build/html/.buildinfo +1 -1
- package/docs/_build/html/_sources/configuration.rst.txt +4 -1
- package/docs/_build/html/_sources/index.rst.txt +2 -2
- package/docs/_build/html/_sources/introduction.rst.txt +1 -1
- package/docs/_build/html/_static/config/config_schema.json +10 -0
- package/docs/_build/html/_static/config/snippet_schema.json +44 -0
- package/docs/_build/html/_static/documentation_options.js +1 -1
- package/docs/_build/html/configuration.html +5 -1
- package/docs/_build/html/genindex.html +1 -1
- package/docs/_build/html/index.html +2 -2
- package/docs/_build/html/installation.html +1 -1
- package/docs/_build/html/introduction.html +2 -2
- package/docs/_build/html/schema.html +56 -32
- package/docs/_build/html/search.html +1 -1
- package/docs/_build/html/searchindex.js +1 -1
- package/docs/_build/html/ubuntu_focal_instructions.html +1 -1
- package/docs/src/conf.py +1 -1
- package/docs/src/configuration.rst +4 -1
- package/docs/src/index.rst +3 -3
- package/docs/src/installation.rst +2 -2
- package/docs/src/introduction.rst +1 -1
- package/docs/src/ubuntu_focal_instructions.rst +2 -2
- package/package.json +6 -3
- package/views/templated.pug +1 -1
package/.prettierrc.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"arrowParens": "avoid",
|
|
3
|
+
"bracketSpacing": false,
|
|
4
|
+
"embeddedLanguageFormatting": "auto",
|
|
5
|
+
"htmlWhitespaceSensitivity": "css",
|
|
6
|
+
"insertPragma": false,
|
|
7
|
+
"jsxBracketSameLine": false,
|
|
8
|
+
"jsxSingleQuote": false,
|
|
9
|
+
"proseWrap": "preserve",
|
|
10
|
+
"quoteProps": "as-needed",
|
|
11
|
+
"requirePragma": false,
|
|
12
|
+
"semi": true,
|
|
13
|
+
"singleQuote": false,
|
|
14
|
+
"trailingComma": "none",
|
|
15
|
+
"useTabs": false,
|
|
16
|
+
"printWidth": 240,
|
|
17
|
+
"tabWidth": 4
|
|
18
|
+
}
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# CARTA Controller
|
|
2
2
|
|
|
3
|
-
[](https://npmjs.org/package/carta-controller "View this project on npm")
|
|
3
|
+
[](https://github.com/CARTAvis/carta-backend/releases/tag/v3.0.0-beta.1c)
|
|
4
|
+
[](https://npmjs.org/package/carta-controller "View this project on npm")
|
|
5
5
|

|
|
6
6
|

|
|
7
7
|
|
|
8
8
|
The CARTA controller provides a simple dashboard which authenticates users and allows them to manage their CARTA backend processes. It also serves static frontend code to clients, and dynamically redirects authenticated client connections to the appropriate backend processes. The controller can either handle authentication itself, or delegate it to an external OAuth2-based authentication server.
|
|
9
9
|
|
|
10
|
-
For installation and configuration instructions, and more detailed information about the controller's features, please consult [the full documentation on ReadTheDocs](https://carta-controller.readthedocs.io/en/
|
|
10
|
+
For installation and configuration instructions, and more detailed information about the controller's features, please consult [the full documentation on ReadTheDocs](https://carta-controller.readthedocs.io/en/dev/).
|
|
11
11
|
|
|
12
12
|
If you encounter a problem with the controller or documentation, please submit an issue in the controller repo. If you need assistance in configuration or deployment, please contact the [CARTA helpdesk](mailto:carta_helpdesk@asiaa.sinica.edu.tw).
|
|
@@ -399,6 +399,11 @@
|
|
|
399
399
|
"type": "string",
|
|
400
400
|
"examples": ["localhost", "127.0.0.1"]
|
|
401
401
|
},
|
|
402
|
+
"httpOnly": {
|
|
403
|
+
"description": "Allow HTTP-only connections. For testing or internal networks only",
|
|
404
|
+
"type": "boolean",
|
|
405
|
+
"default": false
|
|
406
|
+
},
|
|
402
407
|
"serverAddress": {
|
|
403
408
|
"description": "Public-facing server address",
|
|
404
409
|
"type": "string",
|
|
@@ -455,6 +460,11 @@
|
|
|
455
460
|
],
|
|
456
461
|
"default": "/usr/bin/carta_backend"
|
|
457
462
|
},
|
|
463
|
+
"preserveEnv": {
|
|
464
|
+
"description": "Use the --preserve-env argument when calling sudo",
|
|
465
|
+
"type": "boolean",
|
|
466
|
+
"default": true
|
|
467
|
+
},
|
|
458
468
|
"killCommand": {
|
|
459
469
|
"description": "Path to CARTA kill script",
|
|
460
470
|
"type": "string",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "Snippet",
|
|
4
|
+
"description": "Schema for CARTA Snippet (Version 1)",
|
|
5
|
+
"$id": "carta_snippet_1",
|
|
6
|
+
"required": ["snippetVersion", "frontendVersion", "code"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"snippetVersion": {
|
|
9
|
+
"description": "The version of the snippet contained",
|
|
10
|
+
"type": "integer",
|
|
11
|
+
"minimum": 1,
|
|
12
|
+
"maximum": 1
|
|
13
|
+
},
|
|
14
|
+
"frontendVersion": {
|
|
15
|
+
"description": "The version of the frontend targeted by this snippet",
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
"code": {
|
|
19
|
+
"description": "Snippet source code",
|
|
20
|
+
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
"tags": {
|
|
23
|
+
"description": "List of tags associated with this snippet",
|
|
24
|
+
"type": "array",
|
|
25
|
+
"items": {
|
|
26
|
+
"type": "string"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"categories": {
|
|
30
|
+
"description": "List of categories under which to place this snippet",
|
|
31
|
+
"type": "array",
|
|
32
|
+
"items": {
|
|
33
|
+
"type": "string"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"requires": {
|
|
37
|
+
"description": "List of snippets (by name) which need to be run before running this snippet",
|
|
38
|
+
"type": "array",
|
|
39
|
+
"items": {
|
|
40
|
+
"type": "string"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
package/dist/auth/google.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google.js","sourceRoot":"","sources":["../../src/auth/google.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,6DAAiD;AAEpC,QAAA,kBAAkB,GAAG,CAAC,qBAAqB,EAAE,6BAA6B,CAAC,
|
|
1
|
+
{"version":3,"file":"google.js","sourceRoot":"","sources":["../../src/auth/google.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,6DAAiD;AAEpC,QAAA,kBAAkB,GAAG,CAAC,qBAAqB,EAAE,6BAA6B,CAAC,CAAC;AAEzF,SAAgB,sBAAsB,CAAC,WAAkC,EAAE,QAA+B;IACtG,MAAM,gBAAgB,GAAG,IAAI,kCAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC7D,MAAM,QAAQ,GAAG,CAAO,YAAoB,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,aAAa,CAAC;YAChD,OAAO,EAAE,YAAY;YACrB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;SAC9B,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAEpC,4DAA4D;QAC5D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC;QAEvE,mDAAmD;QACnD,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,CAAA,EAAE;YACvC,OAAO,CAAC,GAAG,CAAC,qEAAqE,CAAC,CAAC;YACnF,OAAO,SAAS,CAAC;SACpB;QAED,6BAA6B;QAC7B,IAAI,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAC,WAAW,KAAK,OAAO,CAAC,EAAE,EAAE;YAC7D,OAAO,CAAC,GAAG,CAAC,iDAAiD,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;YAC3E,OAAO,SAAS,CAAC;SACpB;QAED,uCAAW,OAAO,KAAE,QAAQ,IAAE;IAClC,CAAC,CAAA,CAAC;IAEF,KAAK,MAAM,GAAG,IAAI,0BAAkB,EAAE;QAClC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;KAClC;AACL,CAAC;AA9BD,wDA8BC"}
|
package/dist/auth/index.js
CHANGED
|
@@ -115,7 +115,7 @@ function logoutHandler(req, res) {
|
|
|
115
115
|
path: config_1.RuntimeConfig.authPath,
|
|
116
116
|
maxAge: 0,
|
|
117
117
|
httpOnly: true,
|
|
118
|
-
secure:
|
|
118
|
+
secure: !config_1.ServerConfig.httpOnly,
|
|
119
119
|
sameSite: "strict"
|
|
120
120
|
});
|
|
121
121
|
return res.json({ success: true });
|
|
@@ -123,7 +123,7 @@ function logoutHandler(req, res) {
|
|
|
123
123
|
function handleCheckAuth(req, res) {
|
|
124
124
|
res.json({
|
|
125
125
|
success: true,
|
|
126
|
-
username: req.username
|
|
126
|
+
username: req.username
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
exports.authRouter = express.Router();
|
package/dist/auth/index.js.map
CH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,IAAI,EAAC,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,eAAe,CAAC,GAAyB,EAAE,GAAqB;IACrE,GAAG,CAAC,IAAI,CAAC;QACL,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,GAAG,CAAC,QAAQ;KACzB,CAAC,CAAC;AACP,CAAC;AAEY,QAAA,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAC3C,kBAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAO,EAAE,YAAY,CAAC,CAAC;AACjD,kBAAU,CAAC,IAAI,CAAC,SAAS,EAAE,cAAO,EAAE,aAAa,CAAC,CAAC;AACnD,kBAAU,CAAC,IAAI,CAAC,UAAU,EAAE,cAAO,EAAE,cAAc,CAAC,CAAC;AACrD,kBAAU,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,cAAO,EAAE,eAAe,CAAC,CAAC"}
|
package/dist/auth/ldap.js
CHANGED
|
@@ -8,7 +8,7 @@ const util_1 = require("../util");
|
|
|
8
8
|
let ldap;
|
|
9
9
|
function getLdapLoginHandler(authConf) {
|
|
10
10
|
ldap = new LdapAuth(authConf.ldapOptions);
|
|
11
|
-
ldap.on(
|
|
11
|
+
ldap.on("error", err => console.error("LdapAuth: ", err));
|
|
12
12
|
setTimeout(() => {
|
|
13
13
|
var _a, _b;
|
|
14
14
|
const ldapConnected = (_b = (_a = ldap) === null || _a === void 0 ? void 0 : _a._userClient) === null || _b === void 0 ? void 0 : _b.connected;
|
|
@@ -53,7 +53,7 @@ function getLdapLoginHandler(authConf) {
|
|
|
53
53
|
console.log(`TLS error encountered. Reconnecting to the LDAP server!`);
|
|
54
54
|
ldap.close();
|
|
55
55
|
ldap = new LdapAuth(authConf.ldapOptions);
|
|
56
|
-
ldap.on(
|
|
56
|
+
ldap.on("error", err => console.error("LdapAuth: ", err));
|
|
57
57
|
// Wait for the connection to be re-established
|
|
58
58
|
setTimeout(() => {
|
|
59
59
|
ldap.authenticate(username, password, handleAuth);
|
package/dist/auth/ldap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ldap.js","sourceRoot":"","sources":["../../src/auth/ldap.ts"],"names":[],"mappings":";;;AACA,iCAAiC;AACjC,0CAA0C;AAE1C,mCAA4C;AAC5C,kCAAiD;
|
|
1
|
+
{"version":3,"file":"ldap.js","sourceRoot":"","sources":["../../src/auth/ldap.ts"],"names":[],"mappings":";;;AACA,iCAAiC;AACjC,0CAA0C;AAE1C,mCAA4C;AAC5C,kCAAiD;AAEjD,IAAI,IAAc,CAAC;AAEnB,SAAgB,mBAAmB,CAAC,QAA6B;IAC7D,IAAI,GAAG,IAAI,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC1C,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC;IAC1D,UAAU,CAAC,GAAG,EAAE;;QACZ,MAAM,aAAa,GAAG,MAAA,MAAC,IAAY,0CAAE,WAAW,0CAAE,SAAS,CAAC;QAC5D,IAAI,aAAa,EAAE;YACf,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;SAC3C;aAAM;YACH,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;SACxC;IACL,CAAC,EAAE,IAAI,CAAC,CAAC;IAET,OAAO,CAAC,GAAoB,EAAE,GAAqB,EAAE,EAAE;;QACnD,IAAI,QAAQ,GAAG,MAAA,GAAG,CAAC,IAAI,0CAAE,QAAQ,CAAC;QAClC,MAAM,QAAQ,GAAG,MAAA,GAAG,CAAC,IAAI,0CAAE,QAAQ,CAAC;QAEpC,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE;YACxB,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAC,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,yBAA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C,8BAA8B,CAAC,EAAE;gBAC1D,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;gBACvE,IAAI,CAAC,KAAK,EAAE,CAAC;gBACb,IAAI,GAAG,IAAI,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;gBAC1C,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC;gBAC1D,+CAA+C;gBAC/C,UAAU,CAAC,GAAG,EAAE;oBACZ,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;gBACtD,CAAC,EAAE,GAAG,CAAC,CAAC;aACX;iBAAM;gBACH,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;aAC3B;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AAxDD,kDAwDC"}
|
package/dist/auth/local.js
CHANGED
|
@@ -40,7 +40,7 @@ function addTokensToResponse(authConf, username, res) {
|
|
|
40
40
|
path: config_1.RuntimeConfig.authPath,
|
|
41
41
|
maxAge: ms(authConf.refreshTokenAge),
|
|
42
42
|
httpOnly: true,
|
|
43
|
-
secure:
|
|
43
|
+
secure: !config_1.ServerConfig.httpOnly,
|
|
44
44
|
sameSite: "strict"
|
|
45
45
|
});
|
|
46
46
|
const access_token = generateToken(authConf, username, false);
|
|
@@ -53,7 +53,7 @@ function addTokensToResponse(authConf, username, res) {
|
|
|
53
53
|
exports.addTokensToResponse = addTokensToResponse;
|
|
54
54
|
function generateLocalVerifier(verifierMap, authConf) {
|
|
55
55
|
const publicKey = fs.readFileSync(authConf.publicKeyLocation);
|
|
56
|
-
verifierMap.set(authConf.issuer,
|
|
56
|
+
verifierMap.set(authConf.issuer, cookieString => {
|
|
57
57
|
const payload = jwt.verify(cookieString, publicKey, { algorithm: authConf.keyAlgorithm });
|
|
58
58
|
if (payload && payload.iss === authConf.issuer) {
|
|
59
59
|
return payload;
|
package/dist/auth/local.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/auth/local.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yBAAyB;AACzB,oCAAoC;AAGpC,iCAAiC;AACjC,mCAAoC;AACpC,yBAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/auth/local.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yBAAyB;AACzB,oCAAoC;AAGpC,iCAAiC;AACjC,mCAAoC;AACpC,yBAA0B;AAC1B,sCAAsD;AAEtD,IAAI,UAAkB,CAAC;AAEvB,SAAgB,aAAa,CAAC,QAA8B,EAAE,QAAgB,EAAE,YAAqB;IACjG,IAAI,CAAC,UAAU,EAAE;QACb,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;KAC7D;IACD,IAAI,CAAC,QAAQ,IAAI,CAAC,UAAU,EAAE;QAC1B,OAAO,IAAI,CAAC;KACf;IACD,OAAO,GAAG,CAAC,IAAI,CACX;QACI,GAAG,EAAE,QAAQ,CAAC,MAAM;QACpB,QAAQ;QACR,YAAY;KACf,EACD,UAAU,EACV;QACI,SAAS,EAAE,QAAQ,CAAC,YAAY;QAChC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,cAAc;KAC/E,CACJ,CAAC;AACN,CAAC;AAnBD,sCAmBC;AAED,SAAgB,mBAAmB,CAAC,QAA8B,EAAE,QAAgB,EAAE,GAAqB;IACvG,MAAM,YAAY,GAAG,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC7D,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,YAAY,EAAE;QACtC,IAAI,EAAE,sBAAa,CAAC,QAAQ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) {
|
|
|
40
40
|
}
|
|
41
41
|
yield testDatabase();
|
|
42
42
|
if (config_1.ServerConfig.logFileTemplate) {
|
|
43
|
-
testLog(username);
|
|
43
|
+
yield testLog(username);
|
|
44
44
|
}
|
|
45
45
|
testFrontend();
|
|
46
46
|
const backendProcess = yield testBackendStartup(username);
|
|
@@ -49,21 +49,21 @@ function runTests(username) {
|
|
|
49
49
|
}
|
|
50
50
|
exports.runTests = runTests;
|
|
51
51
|
function testLog(username) {
|
|
52
|
-
|
|
53
|
-
.replace("{username}", username)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
const logLocation = config_1.ServerConfig.logFileTemplate.replace("{username}", username).replace("{pid}", "9999").replace("{datetime}", moment().format("YYYYMMDD.h_mm_ss"));
|
|
54
|
+
try {
|
|
55
|
+
const logStream = fs.createWriteStream(logLocation, { flags: "a" });
|
|
56
|
+
// Transform callbacks into awaits
|
|
57
|
+
yield new Promise(res => logStream.write("test", res));
|
|
58
|
+
yield new Promise(res => logStream.end(res));
|
|
59
|
+
fs.unlinkSync(logLocation);
|
|
60
|
+
console.log(logSymbols.success, `Checked log writing for user ${username}`);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
util_1.verboseError(err);
|
|
64
|
+
throw new Error(`Could not create log file at ${logLocation} for user ${username}. Please check your config file's logFileTemplate option`);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
67
|
}
|
|
68
68
|
function testLdap(authConf, username) {
|
|
69
69
|
return new Promise((resolve, reject) => {
|
|
@@ -180,22 +180,33 @@ function testFrontend() {
|
|
|
180
180
|
function testBackendStartup(username) {
|
|
181
181
|
return __awaiter(this, void 0, void 0, function* () {
|
|
182
182
|
const port = config_1.ServerConfig.backendPorts.max - 1;
|
|
183
|
-
let args = [
|
|
184
|
-
|
|
185
|
-
"-
|
|
183
|
+
let args = [];
|
|
184
|
+
if (config_1.ServerConfig.preserveEnv) {
|
|
185
|
+
args.push("--preserve-env=CARTA_AUTH_TOKEN");
|
|
186
|
+
}
|
|
187
|
+
args = args.concat([
|
|
188
|
+
"-n",
|
|
189
|
+
"-u",
|
|
190
|
+
`${username}`,
|
|
186
191
|
config_1.ServerConfig.processCommand,
|
|
187
|
-
"--no_http",
|
|
188
|
-
"--debug_no_auth",
|
|
189
|
-
"--
|
|
190
|
-
|
|
191
|
-
"--top_level_folder",
|
|
192
|
-
config_1.ServerConfig.
|
|
193
|
-
];
|
|
192
|
+
"--no_http",
|
|
193
|
+
"--debug_no_auth",
|
|
194
|
+
"--port",
|
|
195
|
+
`${port}`,
|
|
196
|
+
"--top_level_folder",
|
|
197
|
+
config_1.ServerConfig.rootFolderTemplate.replace("{username}", username)
|
|
198
|
+
]);
|
|
199
|
+
if (config_1.ServerConfig.logFileTemplate) {
|
|
200
|
+
args.push("--no_log");
|
|
201
|
+
}
|
|
194
202
|
if (config_1.ServerConfig.additionalArgs) {
|
|
195
203
|
args = args.concat(config_1.ServerConfig.additionalArgs);
|
|
196
204
|
}
|
|
205
|
+
// Finally, add the positional argument for the base folder
|
|
206
|
+
args.push(config_1.ServerConfig.baseFolderTemplate.replace("{username}", username));
|
|
197
207
|
util_1.verboseLog(`running sudo ${args.join(" ")}`);
|
|
198
|
-
|
|
208
|
+
// Use same stdout and stderr stream for the backend process
|
|
209
|
+
const backendProcess = child_process_1.spawn("sudo", args, { stdio: "inherit" });
|
|
199
210
|
yield util_1.delay(2000);
|
|
200
211
|
if (backendProcess.signalCode) {
|
|
201
212
|
throw new Error(`Backend process terminated with code ${backendProcess.signalCode}. Please check your sudoers config, processCommand option and additionalArgs section`);
|
package/dist/database.js
CHANGED
|
@@ -19,15 +19,19 @@ const util_1 = require("./util");
|
|
|
19
19
|
const config_1 = require("./config");
|
|
20
20
|
const PREFERENCE_SCHEMA_VERSION = 2;
|
|
21
21
|
const LAYOUT_SCHEMA_VERSION = 2;
|
|
22
|
+
const SNIPPET_SCHEMA_VERSION = 1;
|
|
22
23
|
const preferenceSchema = require("../config/preference_schema_2.json");
|
|
23
24
|
const layoutSchema = require("../config/layout_schema_2.json");
|
|
25
|
+
const snippetSchema = require("../config/snippet_schema.json");
|
|
24
26
|
const ajv = new ajv_1.default({ useDefaults: true, strictTypes: false });
|
|
25
27
|
ajv_formats_1.default(ajv);
|
|
26
28
|
const validatePreferences = ajv.compile(preferenceSchema);
|
|
27
29
|
const validateLayout = ajv.compile(layoutSchema);
|
|
30
|
+
const validateSnippet = ajv.compile(snippetSchema);
|
|
28
31
|
let client;
|
|
29
32
|
let preferenceCollection;
|
|
30
33
|
let layoutsCollection;
|
|
34
|
+
let snippetsCollection;
|
|
31
35
|
function updateUsernameIndex(collection, unique) {
|
|
32
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
37
|
const hasIndex = yield collection.indexExists("username");
|
|
@@ -57,11 +61,13 @@ function initDB() {
|
|
|
57
61
|
client = yield mongodb_1.MongoClient.connect(config_1.ServerConfig.database.uri, { useUnifiedTopology: true });
|
|
58
62
|
const db = yield client.db(config_1.ServerConfig.database.databaseName);
|
|
59
63
|
layoutsCollection = yield createOrGetCollection(db, "layouts");
|
|
64
|
+
snippetsCollection = yield createOrGetCollection(db, "snippets");
|
|
60
65
|
preferenceCollection = yield createOrGetCollection(db, "preferences");
|
|
61
66
|
// Remove any existing validation in preferences collection
|
|
62
67
|
yield db.command({ collMod: "preferences", validator: {}, validationLevel: "off" });
|
|
63
68
|
// Update collection indices if necessary
|
|
64
69
|
yield updateUsernameIndex(layoutsCollection, false);
|
|
70
|
+
yield updateUsernameIndex(snippetsCollection, false);
|
|
65
71
|
yield updateUsernameIndex(preferenceCollection, true);
|
|
66
72
|
console.log(`Connected to server ${config_1.ServerConfig.database.uri} and database ${config_1.ServerConfig.database.databaseName}`);
|
|
67
73
|
}
|
|
@@ -253,6 +259,90 @@ function handleClearLayout(req, res, next) {
|
|
|
253
259
|
}
|
|
254
260
|
});
|
|
255
261
|
}
|
|
262
|
+
function handleGetSnippets(req, res, next) {
|
|
263
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
264
|
+
if (!req.username) {
|
|
265
|
+
return next({ statusCode: 403, message: "Invalid username" });
|
|
266
|
+
}
|
|
267
|
+
if (!snippetsCollection) {
|
|
268
|
+
return next({ statusCode: 501, message: "Database not configured" });
|
|
269
|
+
}
|
|
270
|
+
try {
|
|
271
|
+
const snippetList = yield snippetsCollection.find({ username: req.username }, { projection: { _id: 0, username: 0 } }).toArray();
|
|
272
|
+
const snippets = {};
|
|
273
|
+
for (const entry of snippetList) {
|
|
274
|
+
if (entry.name && entry.snippet) {
|
|
275
|
+
snippets[entry.name] = entry.snippet;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
res.json({ success: true, snippets });
|
|
279
|
+
}
|
|
280
|
+
catch (err) {
|
|
281
|
+
util_1.verboseError(err);
|
|
282
|
+
return next({ statusCode: 500, message: "Problem retrieving snippets" });
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
function handleSetSnippet(req, res, next) {
|
|
287
|
+
var _a, _b, _c;
|
|
288
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
289
|
+
if (!req.username) {
|
|
290
|
+
return next({ statusCode: 403, message: "Invalid username" });
|
|
291
|
+
}
|
|
292
|
+
if (!snippetsCollection) {
|
|
293
|
+
return next({ statusCode: 501, message: "Database not configured" });
|
|
294
|
+
}
|
|
295
|
+
const snippetName = (_a = req.body) === null || _a === void 0 ? void 0 : _a.snippetName;
|
|
296
|
+
const snippet = (_b = req.body) === null || _b === void 0 ? void 0 : _b.snippet;
|
|
297
|
+
// Check for malformed update
|
|
298
|
+
if (!snippetName || !snippet || snippet.snippetVersion !== SNIPPET_SCHEMA_VERSION) {
|
|
299
|
+
return next({ statusCode: 400, message: "Malformed snippet update" });
|
|
300
|
+
}
|
|
301
|
+
const validUpdate = validateSnippet(snippet);
|
|
302
|
+
if (!validUpdate) {
|
|
303
|
+
console.log(validateSnippet.errors);
|
|
304
|
+
return next({ statusCode: 400, message: "Malformed snippet update" });
|
|
305
|
+
}
|
|
306
|
+
try {
|
|
307
|
+
const updateResult = yield snippetsCollection.updateOne({ username: req.username, name: snippetName, snippet }, { $set: { snippet } }, { upsert: true });
|
|
308
|
+
if ((_c = updateResult.result) === null || _c === void 0 ? void 0 : _c.ok) {
|
|
309
|
+
res.json({ success: true });
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
return next({ statusCode: 500, message: "Problem updating snippet" });
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
catch (err) {
|
|
316
|
+
util_1.verboseError(err);
|
|
317
|
+
return next({ statusCode: 500, message: err.errmsg });
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
function handleClearSnippet(req, res, next) {
|
|
322
|
+
var _a, _b;
|
|
323
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
324
|
+
if (!req.username) {
|
|
325
|
+
return next({ statusCode: 403, message: "Invalid username" });
|
|
326
|
+
}
|
|
327
|
+
if (!snippetsCollection) {
|
|
328
|
+
return next({ statusCode: 501, message: "Database not configured" });
|
|
329
|
+
}
|
|
330
|
+
const snippetName = (_a = req.body) === null || _a === void 0 ? void 0 : _a.snippetName;
|
|
331
|
+
try {
|
|
332
|
+
const deleteResult = yield snippetsCollection.deleteOne({ username: req.username, name: snippetName });
|
|
333
|
+
if ((_b = deleteResult.result) === null || _b === void 0 ? void 0 : _b.ok) {
|
|
334
|
+
res.json({ success: true });
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
return next({ statusCode: 500, message: "Problem clearing snippet" });
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
catch (err) {
|
|
341
|
+
console.log(err);
|
|
342
|
+
return next({ statusCode: 500, message: "Problem clearing snippet" });
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
256
346
|
exports.databaseRouter = express.Router();
|
|
257
347
|
exports.databaseRouter.get("/preferences", auth_1.authGuard, util_1.noCache, handleGetPreferences);
|
|
258
348
|
exports.databaseRouter.put("/preferences", auth_1.authGuard, util_1.noCache, handleSetPreferences);
|
|
@@ -260,4 +350,7 @@ exports.databaseRouter.delete("/preferences", auth_1.authGuard, util_1.noCache,
|
|
|
260
350
|
exports.databaseRouter.get("/layouts", auth_1.authGuard, util_1.noCache, handleGetLayouts);
|
|
261
351
|
exports.databaseRouter.put("/layout", auth_1.authGuard, util_1.noCache, handleSetLayout);
|
|
262
352
|
exports.databaseRouter.delete("/layout", auth_1.authGuard, util_1.noCache, handleClearLayout);
|
|
353
|
+
exports.databaseRouter.get("/snippets", auth_1.authGuard, util_1.noCache, handleGetSnippets);
|
|
354
|
+
exports.databaseRouter.put("/snippet", auth_1.authGuard, util_1.noCache, handleSetSnippet);
|
|
355
|
+
exports.databaseRouter.delete("/snippet", auth_1.authGuard, util_1.noCache, handleClearSnippet);
|
|
263
356
|
//# sourceMappingURL=database.js.map
|
package/dist/index.js
CHANGED
|
@@ -57,7 +57,7 @@ else {
|
|
|
57
57
|
// Prevent caching of the frontend HTML code
|
|
58
58
|
const staticHeaderHandler = (res, path) => {
|
|
59
59
|
if (path.endsWith(".html")) {
|
|
60
|
-
res.setHeader("Cache-Control",
|
|
60
|
+
res.setHeader("Cache-Control", "no-cache");
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
if (config_1.ServerConfig.frontendPath) {
|
|
@@ -73,7 +73,7 @@ else {
|
|
|
73
73
|
let bannerDataUri;
|
|
74
74
|
if ((_a = config_1.ServerConfig.dashboard) === null || _a === void 0 ? void 0 : _a.bannerImage) {
|
|
75
75
|
const isBannerSvg = config_1.ServerConfig.dashboard.bannerImage.toLowerCase().endsWith(".svg");
|
|
76
|
-
const bannerDataBase64 = fs.readFileSync(config_1.ServerConfig.dashboard.bannerImage,
|
|
76
|
+
const bannerDataBase64 = fs.readFileSync(config_1.ServerConfig.dashboard.bannerImage, "base64");
|
|
77
77
|
if (isBannerSvg) {
|
|
78
78
|
bannerDataUri = "data:image/svg+xml;base64," + bannerDataBase64;
|
|
79
79
|
}
|
package/dist/serverHandlers.js
CHANGED
|
@@ -27,8 +27,8 @@ const processMap = new Map();
|
|
|
27
27
|
const logMap = new Map();
|
|
28
28
|
const LOG_LIMIT = 1000;
|
|
29
29
|
const userProcessesMetric = io.metric({
|
|
30
|
-
name:
|
|
31
|
-
id:
|
|
30
|
+
name: "Active Backend Processes",
|
|
31
|
+
id: "app/realtime/backend"
|
|
32
32
|
});
|
|
33
33
|
function appendLog(username, output) {
|
|
34
34
|
if (!username) {
|
|
@@ -98,7 +98,7 @@ function handleCheckServer(req, res) {
|
|
|
98
98
|
if (existingProcess) {
|
|
99
99
|
res.json({
|
|
100
100
|
success: true,
|
|
101
|
-
running: true
|
|
101
|
+
running: true
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
else {
|
|
@@ -176,37 +176,44 @@ function startServer(username) {
|
|
|
176
176
|
if (port < 0) {
|
|
177
177
|
throw { statusCode: 500, message: "No available ports for the backend process" };
|
|
178
178
|
}
|
|
179
|
-
let args = [
|
|
180
|
-
|
|
181
|
-
"-
|
|
179
|
+
let args = [];
|
|
180
|
+
if (config_1.ServerConfig.preserveEnv) {
|
|
181
|
+
args.push("--preserve-env=CARTA_AUTH_TOKEN");
|
|
182
|
+
}
|
|
183
|
+
args = args.concat([
|
|
184
|
+
"-n",
|
|
185
|
+
"-u",
|
|
186
|
+
`${username}`,
|
|
182
187
|
config_1.ServerConfig.processCommand,
|
|
183
|
-
"--no_http",
|
|
184
|
-
"--
|
|
185
|
-
|
|
186
|
-
"--top_level_folder",
|
|
187
|
-
config_1.ServerConfig.
|
|
188
|
-
];
|
|
188
|
+
"--no_http",
|
|
189
|
+
"--port",
|
|
190
|
+
`${port}`,
|
|
191
|
+
"--top_level_folder",
|
|
192
|
+
config_1.ServerConfig.rootFolderTemplate.replace("{username}", username)
|
|
193
|
+
]);
|
|
194
|
+
if (config_1.ServerConfig.logFileTemplate) {
|
|
195
|
+
args.push("--no_log");
|
|
196
|
+
}
|
|
189
197
|
if (config_1.ServerConfig.additionalArgs) {
|
|
190
198
|
args = args.concat(config_1.ServerConfig.additionalArgs);
|
|
191
199
|
}
|
|
200
|
+
// Finally, add the positional argument for the base folder
|
|
201
|
+
args.push(config_1.ServerConfig.baseFolderTemplate.replace("{username}", username));
|
|
192
202
|
const headerToken = uuid_1.v4();
|
|
193
203
|
const child = child_process_1.spawn("sudo", args, { env: { CARTA_AUTH_TOKEN: headerToken } });
|
|
194
204
|
setPendingProcess(username, port, headerToken, child);
|
|
195
205
|
let logLocation;
|
|
196
206
|
if (config_1.ServerConfig.logFileTemplate) {
|
|
197
|
-
logLocation = config_1.ServerConfig.logFileTemplate
|
|
198
|
-
.replace("{username}", username)
|
|
199
|
-
.replace("{pid}", child.pid.toString())
|
|
200
|
-
.replace("{datetime}", moment().format("YYYYMMDD.h_mm_ss"));
|
|
207
|
+
logLocation = config_1.ServerConfig.logFileTemplate.replace("{username}", username).replace("{pid}", child.pid.toString()).replace("{datetime}", moment().format("YYYYMMDD.h_mm_ss"));
|
|
201
208
|
try {
|
|
202
209
|
logStream = fs.createWriteStream(logLocation, { flags: "a" });
|
|
203
210
|
child.stdout.pipe(logStream);
|
|
204
211
|
child.stderr.pipe(logStream);
|
|
205
|
-
child.stdout.on(
|
|
212
|
+
child.stdout.on("data", function (data) {
|
|
206
213
|
const line = data.toString();
|
|
207
214
|
appendLog(username, line);
|
|
208
215
|
});
|
|
209
|
-
child.stderr.on(
|
|
216
|
+
child.stderr.on("data", function (data) {
|
|
210
217
|
const line = data.toString();
|
|
211
218
|
appendLog(username, line);
|
|
212
219
|
});
|
|
@@ -218,12 +225,12 @@ function startServer(username) {
|
|
|
218
225
|
}
|
|
219
226
|
else {
|
|
220
227
|
logLocation = "stdout";
|
|
221
|
-
child.stdout.on(
|
|
228
|
+
child.stdout.on("data", function (data) {
|
|
222
229
|
const line = data.toString();
|
|
223
230
|
appendLog(username, line);
|
|
224
231
|
console.log(line);
|
|
225
232
|
});
|
|
226
|
-
child.stderr.on(
|
|
233
|
+
child.stderr.on("data", function (data) {
|
|
227
234
|
const line = data.toString();
|
|
228
235
|
appendLog(username, line);
|
|
229
236
|
console.log(line);
|
|
@@ -232,7 +239,7 @@ function startServer(username) {
|
|
|
232
239
|
child.on("exit", code => {
|
|
233
240
|
console.log(`Process ${child.pid} exited with code ${code} and signal ${child.signalCode}`);
|
|
234
241
|
deleteProcess(username);
|
|
235
|
-
logStream === null || logStream === void 0 ? void 0 : logStream.
|
|
242
|
+
logStream === null || logStream === void 0 ? void 0 : logStream.end();
|
|
236
243
|
});
|
|
237
244
|
// Check for early exit of backend process
|
|
238
245
|
yield util_1.delay(config_1.ServerConfig.startDelay);
|
|
@@ -248,7 +255,7 @@ function startServer(username) {
|
|
|
248
255
|
catch (e) {
|
|
249
256
|
util_1.verboseError(e);
|
|
250
257
|
console.log(`Problem starting process for user ${username}`);
|
|
251
|
-
logStream === null || logStream === void 0 ? void 0 : logStream.
|
|
258
|
+
logStream === null || logStream === void 0 ? void 0 : logStream.end();
|
|
252
259
|
if (e.statusCode && e.message) {
|
|
253
260
|
throw e;
|
|
254
261
|
}
|
package/dist/util.js
CHANGED
|
@@ -21,9 +21,9 @@ function delay(delay) {
|
|
|
21
21
|
}
|
|
22
22
|
exports.delay = delay;
|
|
23
23
|
function noCache(req, res, next) {
|
|
24
|
-
res.header(
|
|
25
|
-
res.header(
|
|
26
|
-
res.header(
|
|
24
|
+
res.header("Cache-Control", "private, no-cache, no-store, must-revalidate");
|
|
25
|
+
res.header("Expires", "-1");
|
|
26
|
+
res.header("Pragma", "no-cache");
|
|
27
27
|
next();
|
|
28
28
|
}
|
|
29
29
|
exports.noCache = noCache;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
# Sphinx build info version 1
|
|
2
2
|
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
|
|
3
|
-
config:
|
|
3
|
+
config: cab4ab9f21bbbaa15a42a39a8e17d156
|
|
4
4
|
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
|
@@ -26,7 +26,10 @@ To provide the ``carta`` user with these privileges, you must make modifications
|
|
|
26
26
|
|
|
27
27
|
.. warning::
|
|
28
28
|
Please only edit your sudoers configuration with ``visudo`` or equivalent.
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
.. note::
|
|
31
|
+
Older versions of ``sudo`` do not support the ``--preserve-env=VARIABLE`` argument. If your version of ``sudo`` is too old, set ``"preserveEnv"`` to ``false`` in your controller configuration, and add ``Defaults env_keep += "CARTA_AUTH_TOKEN"`` to your sudoers configuration.
|
|
32
|
+
|
|
30
33
|
.. _config-authentication:
|
|
31
34
|
|
|
32
35
|
Authentication
|