sliftutils 1.7.136 → 1.7.137
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/examplestorage/browser.tsx +3 -2
- package/index.d.ts +10 -3
- package/misc/dist/strings.ts.cache +2 -2
- package/misc/https/certs.d.ts +5 -1
- package/misc/https/certs.ts +5 -1
- package/misc/https/dist/certs.ts.cache +8 -4
- package/misc/https/dist/persistentLocalStorage.ts.cache +2 -2
- package/package.json +1 -1
- package/security/authorizedKeys/daemon/daemon.ts +4 -3
- package/security/authorizedKeys/daemon/dist/changes.ts.cache +2 -2
- package/security/authorizedKeys/daemon/dist/git.ts.cache +2 -2
- package/security/authorizedKeys/daemon/dist/notify.ts.cache +2 -2
- package/security/authorizedKeys/daemon/dist/paths.ts.cache +2 -2
- package/security/authorizedKeys/daemon/dist/repoFiles.ts.cache +2 -2
- package/security/authorizedKeys/daemon/dist/revocation.ts.cache +0 -0
- package/security/authorizedKeys/daemon/dist/sessions.ts.cache +2 -2
- package/security/authorizedKeys/daemon/dist/state.ts.cache +2 -2
- package/security/authorizedKeys/daemon/dist/trust.ts.cache +126 -4
- package/security/authorizedKeys/daemon/revocation.d.ts +4 -7
- package/security/authorizedKeys/daemon/revocation.ts +0 -0
- package/security/authorizedKeys/daemon/trust.d.ts +12 -1
- package/security/authorizedKeys/daemon/trust.ts +124 -1
- package/security/authorizedKeys/dist/authorizedKeys.ts.cache +2 -2
- package/security/authorizedKeys/dist/keysRepo.ts.cache +2 -2
- package/security/authorizedKeys/dist/revokeSource.ts.cache +2 -2
- package/security/authorizedKeys/dist/sources.ts.cache +2 -2
- package/security/authorizedKeys/dist/unrevoke.ts.cache +5 -186
- package/security/authorizedKeys/dist/unrevokeCli.ts.cache +195 -0
- package/security/helpers/dist/paths.ts.cache +2 -2
- package/security/helpers/dist/remoteSSH.ts.cache +2 -2
- package/security/helpers/dist/spawn.ts.cache +2 -2
- package/security/keys/dist/deriveKey.ts.cache +2 -2
- package/security/keys/dist/sshKeyFile.ts.cache +2 -2
- package/security/machines/dist/machines.ts.cache +20 -68
- package/security/machines/machines.ts +18 -67
- package/security/notifications/dist/discord.ts.cache +2 -2
- package/security/signedFiles/dist/manifest.ts.cache +2 -2
- package/security/signedFiles/dist/signFiles.ts.cache +16 -52
- package/security/signedFiles/dist/sshsig.ts.cache +2 -2
- package/storage/remoteStorage/ArchivesRemote.d.ts +2 -1
- package/storage/remoteStorage/ArchivesRemote.ts +14 -7
- package/storage/remoteStorage/accessPage.tsx +7 -123
- package/storage/remoteStorage/createArchives.d.ts +2 -1
- package/storage/remoteStorage/createArchives.ts +1 -1
- package/storage/remoteStorage/dist/ArchivesRemote.ts.cache +14 -7
- package/storage/remoteStorage/dist/createArchives.ts.cache +2 -2
- package/storage/remoteStorage/dist/sourceWrapper.ts.cache +3 -3
- package/storage/remoteStorage/dist/storageController.ts.cache +8 -7
- package/storage/remoteStorage/sourceWrapper.ts +1 -1
- package/storage/remoteStorage/storageController.d.ts +1 -0
- package/storage/remoteStorage/storageController.ts +8 -6
|
@@ -5,7 +5,7 @@ import { setHTTPResultHeaders, getCurrentHTTPRequest } from "socket-function/src
|
|
|
5
5
|
import { performLocalCall } from "socket-function/src/callManager";
|
|
6
6
|
import { RequireController } from "socket-function/require/RequireController";
|
|
7
7
|
import { timeInMinute } from "socket-function/src/misc";
|
|
8
|
-
import { getCommonName,
|
|
8
|
+
import { getCommonName, getMachineId, getOwnMachineId, validateCertificate, verify } from "../../misc/https/certs";
|
|
9
9
|
import { ArchiveFileInfo, ArchivesConfig, ArchivesSyncStatus, FindConfig, SourceConfig, IMMUTABLE_CACHE_TIME } from "../IArchives";
|
|
10
10
|
import { ROUTING_FILE, getRoute, routeContains } from "./remoteConfig";
|
|
11
11
|
import {
|
|
@@ -43,6 +43,7 @@ export type AuthTokenData = {
|
|
|
43
43
|
};
|
|
44
44
|
export type AuthToken = {
|
|
45
45
|
certPem: string;
|
|
46
|
+
issuerPem: string;
|
|
46
47
|
signature: string;
|
|
47
48
|
data: AuthTokenData;
|
|
48
49
|
};
|
|
@@ -134,8 +135,11 @@ class RemoteStorageControllerBase {
|
|
|
134
135
|
return {};
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
// Secure because connections use real certificates on real domain names, so TLS itself stops a
|
|
139
|
+
// man-in-the-middle. Otherwise one would be possible: the signed token only names the server's
|
|
140
|
+
// domain, so a middleman on the path to that domain could reuse it against the real server.
|
|
137
141
|
async authenticate(token: AuthToken): Promise<{ machineId: string; ip: string }> {
|
|
138
|
-
let { domain, port } = getStorageServerConfig();
|
|
142
|
+
let { domain, port, rootDomain } = getStorageServerConfig();
|
|
139
143
|
let caller = SocketFunction.getCaller();
|
|
140
144
|
verify(token.certPem, token.signature, token.data);
|
|
141
145
|
let { purpose, time, server } = token.data;
|
|
@@ -149,10 +153,8 @@ class RemoteStorageControllerBase {
|
|
|
149
153
|
if (tokenDomain !== domain) {
|
|
150
154
|
throw new Error(`Auth token is for server ${JSON.stringify(server)}, but this server is ${JSON.stringify(`${domain}:${port}`)}`);
|
|
151
155
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
throw new Error(`Certificate common name does not match its public key: ${JSON.stringify(getCommonName(token.certPem))}`);
|
|
155
|
-
}
|
|
156
|
+
validateCertificate(rootDomain, token.certPem, token.issuerPem);
|
|
157
|
+
let machineId = getMachineId(getCommonName(token.issuerPem), rootDomain);
|
|
156
158
|
sessions.set(caller.nodeId, machineId);
|
|
157
159
|
while (sessions.size > MAX_SESSIONS) {
|
|
158
160
|
let oldest = sessions.keys().next().value;
|