@awcp/transport-sshfs 0.0.0-dev-202601300724 → 0.0.0-dev-202601301521
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/dist/cli/setup.d.ts +13 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +286 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/delegator/credential-manager.d.ts +15 -52
- package/dist/delegator/credential-manager.d.ts.map +1 -1
- package/dist/delegator/credential-manager.js +82 -106
- package/dist/delegator/credential-manager.js.map +1 -1
- package/dist/delegator/index.d.ts +1 -1
- package/dist/delegator/index.d.ts.map +1 -1
- package/dist/delegator/index.js.map +1 -1
- package/dist/executor/index.d.ts +1 -1
- package/dist/executor/index.d.ts.map +1 -1
- package/dist/executor/index.js +1 -1
- package/dist/executor/index.js.map +1 -1
- package/dist/executor/sshfs-client.d.ts +20 -23
- package/dist/executor/sshfs-client.d.ts.map +1 -1
- package/dist/executor/sshfs-client.js +60 -32
- package/dist/executor/sshfs-client.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/sshfs-transport.d.ts +24 -0
- package/dist/sshfs-transport.d.ts.map +1 -0
- package/dist/sshfs-transport.js +93 -0
- package/dist/sshfs-transport.js.map +1 -0
- package/dist/types.d.ts +114 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +6 -2
|
@@ -1,57 +1,51 @@
|
|
|
1
|
-
import { unlink, mkdir, readFile,
|
|
1
|
+
import { unlink, mkdir, readFile, readdir, access, constants } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
import { homedir } from 'node:os';
|
|
5
5
|
const DEFAULT_KEY_DIR = join(homedir(), '.awcp', 'keys');
|
|
6
|
-
/**
|
|
7
|
-
* Marker prefix for AWCP-managed keys in authorized_keys
|
|
8
|
-
*/
|
|
9
|
-
const AWCP_KEY_COMMENT_PREFIX = 'awcp-temp-key-';
|
|
10
6
|
/**
|
|
11
7
|
* SSH Credential Manager
|
|
12
8
|
*
|
|
13
|
-
* Manages temporary SSH
|
|
14
|
-
*
|
|
15
|
-
* TODO [Security]: Consider SSH certificates with built-in expiry for production.
|
|
9
|
+
* Manages temporary SSH certificates for AWCP delegations.
|
|
10
|
+
* Uses SSH certificates with built-in expiry for automatic TTL enforcement.
|
|
16
11
|
*/
|
|
17
12
|
export class CredentialManager {
|
|
18
13
|
config;
|
|
19
14
|
activeCredentials = new Map();
|
|
20
15
|
constructor(config) {
|
|
21
|
-
this.config = config
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Get the path to authorized_keys file
|
|
25
|
-
*/
|
|
26
|
-
getAuthorizedKeysPath() {
|
|
27
|
-
return this.config.authorizedKeysPath ?? join(homedir(), '.ssh', 'authorized_keys');
|
|
16
|
+
this.config = config;
|
|
28
17
|
}
|
|
29
18
|
/**
|
|
30
|
-
* Generate a temporary SSH key pair
|
|
19
|
+
* Generate a temporary SSH key pair and sign certificate with TTL
|
|
31
20
|
*/
|
|
32
|
-
async generateCredential(delegationId,
|
|
21
|
+
async generateCredential(delegationId, ttlSeconds) {
|
|
22
|
+
// Ensure CA key exists (auto-generate if needed)
|
|
23
|
+
await this.ensureCaKey();
|
|
33
24
|
const keyDir = this.config.keyDir ?? DEFAULT_KEY_DIR;
|
|
34
25
|
await mkdir(keyDir, { recursive: true, mode: 0o700 });
|
|
35
|
-
const privateKeyPath = join(keyDir,
|
|
26
|
+
const privateKeyPath = join(keyDir, delegationId);
|
|
36
27
|
const publicKeyPath = join(keyDir, `${delegationId}.pub`);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
await this.execSshKeygen(privateKeyPath,
|
|
40
|
-
//
|
|
28
|
+
const certPath = join(keyDir, `${delegationId}-cert.pub`);
|
|
29
|
+
// Generate key pair
|
|
30
|
+
await this.execSshKeygen(privateKeyPath, `awcp-${delegationId}`);
|
|
31
|
+
// Sign certificate with CA (includes TTL)
|
|
32
|
+
await this.signCertificate(publicKeyPath, ttlSeconds, delegationId);
|
|
33
|
+
// Read the private key and certificate
|
|
41
34
|
const privateKey = await readFile(privateKeyPath, 'utf-8');
|
|
42
|
-
const
|
|
43
|
-
const
|
|
35
|
+
const certificate = await readFile(certPath, 'utf-8');
|
|
36
|
+
const credentialInfo = {
|
|
44
37
|
privateKey,
|
|
45
|
-
publicKey,
|
|
46
38
|
privateKeyPath,
|
|
47
39
|
publicKeyPath,
|
|
40
|
+
certPath,
|
|
48
41
|
delegationId,
|
|
49
42
|
};
|
|
50
|
-
this.activeCredentials.set(delegationId,
|
|
51
|
-
// Add public key to authorized_keys
|
|
52
|
-
await this.addToAuthorizedKeys(publicKey);
|
|
43
|
+
this.activeCredentials.set(delegationId, credentialInfo);
|
|
53
44
|
return {
|
|
54
|
-
credential:
|
|
45
|
+
credential: {
|
|
46
|
+
privateKey,
|
|
47
|
+
certificate,
|
|
48
|
+
},
|
|
55
49
|
endpoint: {
|
|
56
50
|
host: this.config.sshHost ?? 'localhost',
|
|
57
51
|
port: this.config.sshPort ?? 22,
|
|
@@ -60,28 +54,42 @@ export class CredentialManager {
|
|
|
60
54
|
};
|
|
61
55
|
}
|
|
62
56
|
/**
|
|
63
|
-
*
|
|
57
|
+
* Ensure CA key exists, auto-generate if not present
|
|
64
58
|
*/
|
|
65
|
-
async
|
|
66
|
-
const credential = this.activeCredentials.get(delegationId);
|
|
67
|
-
if (!credential) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
// Remove from authorized_keys first
|
|
71
|
-
await this.removeFromAuthorizedKeys(delegationId);
|
|
72
|
-
// Remove key files
|
|
59
|
+
async ensureCaKey() {
|
|
73
60
|
try {
|
|
74
|
-
await
|
|
61
|
+
await access(this.config.caKeyPath, constants.R_OK);
|
|
62
|
+
return; // CA key exists
|
|
75
63
|
}
|
|
76
64
|
catch {
|
|
77
|
-
//
|
|
65
|
+
// CA key doesn't exist, generate it
|
|
78
66
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
67
|
+
console.log(`[CredentialManager] CA key not found at ${this.config.caKeyPath}, generating...`);
|
|
68
|
+
const caDir = join(this.config.caKeyPath, '..');
|
|
69
|
+
await mkdir(caDir, { recursive: true, mode: 0o700 });
|
|
70
|
+
await this.execSshKeygen(this.config.caKeyPath, 'awcp-ca');
|
|
71
|
+
console.log(`[CredentialManager] CA key pair generated at ${this.config.caKeyPath}`);
|
|
72
|
+
console.log('');
|
|
73
|
+
console.log(' ⚠️ To enable SSH certificate authentication, add to /etc/ssh/sshd_config:');
|
|
74
|
+
console.log(` TrustedUserCAKeys ${this.config.caKeyPath}.pub`);
|
|
75
|
+
console.log('');
|
|
76
|
+
console.log(' Then restart sshd:');
|
|
77
|
+
console.log(' macOS: sudo launchctl stop com.openssh.sshd');
|
|
78
|
+
console.log(' Linux: sudo systemctl restart sshd');
|
|
79
|
+
console.log('');
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Revoke a credential (delete key files, certificate expires automatically)
|
|
83
|
+
*/
|
|
84
|
+
async revokeCredential(delegationId) {
|
|
85
|
+
const credential = this.activeCredentials.get(delegationId);
|
|
86
|
+
if (!credential) {
|
|
87
|
+
return;
|
|
84
88
|
}
|
|
89
|
+
// Delete key and certificate files
|
|
90
|
+
await unlink(credential.privateKeyPath).catch(() => { });
|
|
91
|
+
await unlink(credential.publicKeyPath).catch(() => { });
|
|
92
|
+
await unlink(credential.certPath).catch(() => { });
|
|
85
93
|
this.activeCredentials.delete(delegationId);
|
|
86
94
|
}
|
|
87
95
|
/**
|
|
@@ -98,30 +106,6 @@ export class CredentialManager {
|
|
|
98
106
|
await this.revokeCredential(delegationId);
|
|
99
107
|
}
|
|
100
108
|
}
|
|
101
|
-
/**
|
|
102
|
-
* Clean up stale AWCP keys from authorized_keys (call on startup)
|
|
103
|
-
*/
|
|
104
|
-
async cleanupStaleKeys() {
|
|
105
|
-
const authorizedKeysPath = this.getAuthorizedKeysPath();
|
|
106
|
-
try {
|
|
107
|
-
const content = await readFile(authorizedKeysPath, 'utf-8');
|
|
108
|
-
const lines = content.split('\n');
|
|
109
|
-
const cleanedLines = lines.filter(line => {
|
|
110
|
-
// Keep lines that don't have AWCP marker
|
|
111
|
-
return !line.includes(AWCP_KEY_COMMENT_PREFIX);
|
|
112
|
-
});
|
|
113
|
-
const removedCount = lines.length - cleanedLines.length;
|
|
114
|
-
if (removedCount > 0) {
|
|
115
|
-
await writeFile(authorizedKeysPath, cleanedLines.join('\n'));
|
|
116
|
-
console.log(`[CredentialManager] Cleaned up ${removedCount} stale AWCP keys from authorized_keys`);
|
|
117
|
-
}
|
|
118
|
-
return removedCount;
|
|
119
|
-
}
|
|
120
|
-
catch {
|
|
121
|
-
// File doesn't exist or can't be read, nothing to clean
|
|
122
|
-
return 0;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
109
|
/**
|
|
126
110
|
* Clean up stale key files from key directory (call on startup)
|
|
127
111
|
*/
|
|
@@ -131,19 +115,14 @@ export class CredentialManager {
|
|
|
131
115
|
const files = await readdir(keyDir);
|
|
132
116
|
let removedCount = 0;
|
|
133
117
|
for (const file of files) {
|
|
134
|
-
//
|
|
135
|
-
const delegationId = file.replace(
|
|
118
|
+
// Extract delegation ID from filename
|
|
119
|
+
const delegationId = file.replace(/(-cert)?\.pub$/, '');
|
|
136
120
|
if (this.activeCredentials.has(delegationId)) {
|
|
137
121
|
continue;
|
|
138
122
|
}
|
|
139
123
|
// Remove stale key files
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
removedCount++;
|
|
143
|
-
}
|
|
144
|
-
catch {
|
|
145
|
-
// Ignore errors
|
|
146
|
-
}
|
|
124
|
+
await unlink(join(keyDir, file)).catch(() => { });
|
|
125
|
+
removedCount++;
|
|
147
126
|
}
|
|
148
127
|
if (removedCount > 0) {
|
|
149
128
|
console.log(`[CredentialManager] Cleaned up ${removedCount} stale key files`);
|
|
@@ -156,35 +135,32 @@ export class CredentialManager {
|
|
|
156
135
|
}
|
|
157
136
|
}
|
|
158
137
|
/**
|
|
159
|
-
*
|
|
138
|
+
* Sign public key with CA to create certificate with TTL
|
|
160
139
|
*/
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
catch {
|
|
186
|
-
// File doesn't exist or can't be read, nothing to remove
|
|
187
|
-
}
|
|
140
|
+
signCertificate(publicKeyPath, ttlSeconds, delegationId) {
|
|
141
|
+
return new Promise((resolve, reject) => {
|
|
142
|
+
const proc = spawn('ssh-keygen', [
|
|
143
|
+
'-s', this.config.caKeyPath,
|
|
144
|
+
'-I', `awcp-${delegationId}`,
|
|
145
|
+
'-n', this.config.sshUser ?? process.env['USER'] ?? 'awcp',
|
|
146
|
+
'-V', `+${ttlSeconds}s`,
|
|
147
|
+
'-q',
|
|
148
|
+
publicKeyPath,
|
|
149
|
+
]);
|
|
150
|
+
let stderr = '';
|
|
151
|
+
proc.stderr.on('data', (data) => {
|
|
152
|
+
stderr += data.toString();
|
|
153
|
+
});
|
|
154
|
+
proc.on('close', (code) => {
|
|
155
|
+
if (code === 0) {
|
|
156
|
+
resolve();
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
reject(new Error(`Certificate signing failed: ${stderr}`));
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
proc.on('error', reject);
|
|
163
|
+
});
|
|
188
164
|
}
|
|
189
165
|
/**
|
|
190
166
|
* Execute ssh-keygen to generate a key pair
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-manager.js","sourceRoot":"","sources":["../../src/delegator/credential-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"credential-manager.js","sourceRoot":"","sources":["../../src/delegator/credential-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAA0B;IAChC,iBAAiB,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEnE,YAAY,MAA+B;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CACtB,YAAoB,EACpB,UAAkB;QAKlB,iDAAiD;QACjD,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAEzB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,eAAe,CAAC;QACrD,MAAM,KAAK,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAEtD,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAClD,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,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Ae,EAAE,OAAe;QACpD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,EAAE;gBAC/B,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,EAAE,EAAE,gBAAgB;gBAC1B,IAAI,EAAE,OAAO;aACd,CAAC,CAAC;YAEH,IAAI,MAAM,GAAG,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBAC9B,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC5B,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;gBACxB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;oBACf,OAAO,EAAE,CAAC;gBACZ,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,KAAK,CAAC,sBAAsB,MAAM,EAAE,CAAC,CAAC,CAAC;gBACpD,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CredentialManager
|
|
1
|
+
export { CredentialManager } from './credential-manager.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/delegator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/delegator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delegator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delegator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/executor/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SshfsMountClient,
|
|
1
|
+
export { SshfsMountClient, DEFAULT_TEMP_KEY_DIR, buildSshfsArgs } from './sshfs-client.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/executor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/executor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/executor/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SshfsMountClient } from './sshfs-client.js';
|
|
1
|
+
export { SshfsMountClient, DEFAULT_TEMP_KEY_DIR, buildSshfsArgs } from './sshfs-client.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/executor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/executor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,28 +1,10 @@
|
|
|
1
|
+
import { type SshCredential } from '@awcp/core';
|
|
2
|
+
import type { SshfsMountConfig, MountParams, ActiveMount } from '../types.js';
|
|
3
|
+
export declare const DEFAULT_TEMP_KEY_DIR = "/tmp/awcp/client-keys";
|
|
1
4
|
/**
|
|
2
|
-
* SSHFS
|
|
5
|
+
* Build SSHFS command arguments
|
|
3
6
|
*/
|
|
4
|
-
export
|
|
5
|
-
/** Directory to store temporary key files */
|
|
6
|
-
tempKeyDir?: string;
|
|
7
|
-
/** Additional sshfs options */
|
|
8
|
-
defaultOptions?: Record<string, string>;
|
|
9
|
-
/** Timeout for mount operation in ms (default: 30000) */
|
|
10
|
-
mountTimeout?: number;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Mount parameters
|
|
14
|
-
*/
|
|
15
|
-
export interface MountParams {
|
|
16
|
-
endpoint: {
|
|
17
|
-
host: string;
|
|
18
|
-
port: number;
|
|
19
|
-
user: string;
|
|
20
|
-
};
|
|
21
|
-
exportLocator: string;
|
|
22
|
-
credential: string;
|
|
23
|
-
mountPoint: string;
|
|
24
|
-
options?: Record<string, string>;
|
|
25
|
-
}
|
|
7
|
+
export declare function buildSshfsArgs(params: MountParams, keyPath: string, certPath: string, defaultOptions?: Record<string, string>): string[];
|
|
26
8
|
/**
|
|
27
9
|
* SSHFS Mount Client
|
|
28
10
|
*
|
|
@@ -32,6 +14,10 @@ export declare class SshfsMountClient {
|
|
|
32
14
|
private config;
|
|
33
15
|
private activeMounts;
|
|
34
16
|
constructor(config?: SshfsMountConfig);
|
|
17
|
+
/**
|
|
18
|
+
* Get active mounts (for testing)
|
|
19
|
+
*/
|
|
20
|
+
getActiveMounts(): Map<string, ActiveMount>;
|
|
35
21
|
/**
|
|
36
22
|
* Check if sshfs is available
|
|
37
23
|
*/
|
|
@@ -40,6 +26,17 @@ export declare class SshfsMountClient {
|
|
|
40
26
|
version?: string;
|
|
41
27
|
error?: string;
|
|
42
28
|
}>;
|
|
29
|
+
/**
|
|
30
|
+
* Write credential files to disk
|
|
31
|
+
*/
|
|
32
|
+
writeCredentialFiles(tempKeyDir: string, credential: SshCredential): Promise<{
|
|
33
|
+
keyPath: string;
|
|
34
|
+
certPath: string;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Clean up credential files
|
|
38
|
+
*/
|
|
39
|
+
cleanupCredentialFiles(keyPath: string, certPath: string): Promise<void>;
|
|
43
40
|
/**
|
|
44
41
|
* Mount a remote filesystem
|
|
45
42
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sshfs-client.d.ts","sourceRoot":"","sources":["../../src/executor/sshfs-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sshfs-client.d.ts","sourceRoot":"","sources":["../../src/executor/sshfs-client.ts"],"names":[],"mappings":"AAGA,OAAO,EAA4C,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAC1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE9E,eAAO,MAAM,oBAAoB,0BAA0B,CAAC;AAG5D;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtC,MAAM,EAAE,CA4BV;AAED;;;;GAIG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,YAAY,CAAkC;gBAE1C,MAAM,CAAC,EAAE,gBAAgB;IAIrC;;OAEG;IACH,eAAe,IAAI,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC;IAI3C;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAoC1F;;OAEG;IACG,oBAAoB,CACxB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,aAAa,GACxB,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAWjD;;OAEG;IACG,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9E;;OAEG;IACG,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAmC/C;;OAEG;IACG,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgChD;;OAEG;IACG,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAUrD;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAMjC,OAAO,CAAC,SAAS;IAyDjB,OAAO,CAAC,WAAW;CAepB"}
|
|
@@ -2,8 +2,36 @@ import { spawn } from 'node:child_process';
|
|
|
2
2
|
import { writeFile, unlink, mkdir, stat } from 'node:fs/promises';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { MountFailedError, DependencyMissingError } from '@awcp/core';
|
|
5
|
-
const DEFAULT_TEMP_KEY_DIR = '/tmp/awcp/client-keys';
|
|
5
|
+
export const DEFAULT_TEMP_KEY_DIR = '/tmp/awcp/client-keys';
|
|
6
6
|
const DEFAULT_MOUNT_TIMEOUT = 30000;
|
|
7
|
+
/**
|
|
8
|
+
* Build SSHFS command arguments
|
|
9
|
+
*/
|
|
10
|
+
export function buildSshfsArgs(params, keyPath, certPath, defaultOptions) {
|
|
11
|
+
const { host, port, user } = params.endpoint;
|
|
12
|
+
const remoteSpec = `${user}@${host}:${params.exportLocator}`;
|
|
13
|
+
const options = {
|
|
14
|
+
...defaultOptions,
|
|
15
|
+
...params.options,
|
|
16
|
+
};
|
|
17
|
+
const args = [
|
|
18
|
+
remoteSpec,
|
|
19
|
+
params.mountPoint,
|
|
20
|
+
'-o', `IdentityFile=${keyPath}`,
|
|
21
|
+
'-o', `CertificateFile=${certPath}`,
|
|
22
|
+
'-o', `Port=${port}`,
|
|
23
|
+
'-o', 'StrictHostKeyChecking=no',
|
|
24
|
+
'-o', 'UserKnownHostsFile=/dev/null',
|
|
25
|
+
'-o', 'reconnect',
|
|
26
|
+
'-o', 'ServerAliveInterval=15',
|
|
27
|
+
'-o', 'ServerAliveCountMax=3',
|
|
28
|
+
'-o', 'noappledouble',
|
|
29
|
+
];
|
|
30
|
+
for (const [key, value] of Object.entries(options)) {
|
|
31
|
+
args.push('-o', `${key}=${value}`);
|
|
32
|
+
}
|
|
33
|
+
return args;
|
|
34
|
+
}
|
|
7
35
|
/**
|
|
8
36
|
* SSHFS Mount Client
|
|
9
37
|
*
|
|
@@ -15,6 +43,12 @@ export class SshfsMountClient {
|
|
|
15
43
|
constructor(config) {
|
|
16
44
|
this.config = config ?? {};
|
|
17
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Get active mounts (for testing)
|
|
48
|
+
*/
|
|
49
|
+
getActiveMounts() {
|
|
50
|
+
return this.activeMounts;
|
|
51
|
+
}
|
|
18
52
|
/**
|
|
19
53
|
* Check if sshfs is available
|
|
20
54
|
*/
|
|
@@ -51,6 +85,24 @@ export class SshfsMountClient {
|
|
|
51
85
|
});
|
|
52
86
|
});
|
|
53
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Write credential files to disk
|
|
90
|
+
*/
|
|
91
|
+
async writeCredentialFiles(tempKeyDir, credential) {
|
|
92
|
+
await mkdir(tempKeyDir, { recursive: true });
|
|
93
|
+
const keyPath = join(tempKeyDir, `mount-${Date.now()}`);
|
|
94
|
+
const certPath = `${keyPath}-cert.pub`;
|
|
95
|
+
await writeFile(keyPath, credential.privateKey, { mode: 0o600 });
|
|
96
|
+
await writeFile(certPath, credential.certificate, { mode: 0o644 });
|
|
97
|
+
return { keyPath, certPath };
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Clean up credential files
|
|
101
|
+
*/
|
|
102
|
+
async cleanupCredentialFiles(keyPath, certPath) {
|
|
103
|
+
await unlink(keyPath).catch(() => { });
|
|
104
|
+
await unlink(certPath).catch(() => { });
|
|
105
|
+
}
|
|
54
106
|
/**
|
|
55
107
|
* Mount a remote filesystem
|
|
56
108
|
*/
|
|
@@ -61,34 +113,9 @@ export class SshfsMountClient {
|
|
|
61
113
|
throw new DependencyMissingError('sshfs', 'Install sshfs: brew install macfuse && brew install sshfs (macOS) or apt install sshfs (Linux)');
|
|
62
114
|
}
|
|
63
115
|
const tempKeyDir = this.config.tempKeyDir ?? DEFAULT_TEMP_KEY_DIR;
|
|
64
|
-
await
|
|
65
|
-
// Write credential to temp file
|
|
66
|
-
const keyPath = join(tempKeyDir, `mount-${Date.now()}`);
|
|
67
|
-
await writeFile(keyPath, params.credential, { mode: 0o600 });
|
|
116
|
+
const { keyPath, certPath } = await this.writeCredentialFiles(tempKeyDir, params.credential);
|
|
68
117
|
try {
|
|
69
|
-
|
|
70
|
-
const { host, port, user } = params.endpoint;
|
|
71
|
-
const remoteSpec = `${user}@${host}:${params.exportLocator}`;
|
|
72
|
-
const options = {
|
|
73
|
-
...this.config.defaultOptions,
|
|
74
|
-
...params.options,
|
|
75
|
-
};
|
|
76
|
-
const args = [
|
|
77
|
-
remoteSpec,
|
|
78
|
-
params.mountPoint,
|
|
79
|
-
'-o', `IdentityFile=${keyPath}`,
|
|
80
|
-
'-o', `Port=${port}`,
|
|
81
|
-
'-o', 'StrictHostKeyChecking=no',
|
|
82
|
-
'-o', 'UserKnownHostsFile=/dev/null',
|
|
83
|
-
'-o', 'reconnect',
|
|
84
|
-
'-o', 'ServerAliveInterval=15',
|
|
85
|
-
'-o', 'ServerAliveCountMax=3',
|
|
86
|
-
'-o', 'noappledouble', // Prevent macOS ._* metadata files
|
|
87
|
-
];
|
|
88
|
-
// Add custom options
|
|
89
|
-
for (const [key, value] of Object.entries(options)) {
|
|
90
|
-
args.push('-o', `${key}=${value}`);
|
|
91
|
-
}
|
|
118
|
+
const args = buildSshfsArgs(params, keyPath, certPath, this.config.defaultOptions);
|
|
92
119
|
console.log(`[SSHFS] Mounting: sshfs ${args.join(' ')}`);
|
|
93
120
|
// Execute mount (SSHFS will daemonize and exit immediately on success)
|
|
94
121
|
await this.execMount(args, params.mountPoint);
|
|
@@ -96,11 +123,12 @@ export class SshfsMountClient {
|
|
|
96
123
|
this.activeMounts.set(params.mountPoint, {
|
|
97
124
|
mountPoint: params.mountPoint,
|
|
98
125
|
keyPath,
|
|
126
|
+
certPath,
|
|
99
127
|
});
|
|
100
128
|
}
|
|
101
129
|
catch (error) {
|
|
102
|
-
// Cleanup key on failure
|
|
103
|
-
await
|
|
130
|
+
// Cleanup key and cert on failure
|
|
131
|
+
await this.cleanupCredentialFiles(keyPath, certPath);
|
|
104
132
|
throw error;
|
|
105
133
|
}
|
|
106
134
|
}
|
|
@@ -129,9 +157,9 @@ export class SshfsMountClient {
|
|
|
129
157
|
if (!success) {
|
|
130
158
|
console.warn(`Failed to unmount ${mountPoint}, may need manual cleanup`);
|
|
131
159
|
}
|
|
132
|
-
// Cleanup
|
|
160
|
+
// Cleanup key and certificate files
|
|
133
161
|
if (activeMount) {
|
|
134
|
-
await
|
|
162
|
+
await this.cleanupCredentialFiles(activeMount.keyPath, activeMount.certPath);
|
|
135
163
|
this.activeMounts.delete(mountPoint);
|
|
136
164
|
}
|
|
137
165
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sshfs-client.js","sourceRoot":"","sources":["../../src/executor/sshfs-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"sshfs-client.js","sourceRoot":"","sources":["../../src/executor/sshfs-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE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S Transport implementation for AWCP data plane
|
|
5
5
|
*/
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
6
|
+
export { SshfsTransport } from './sshfs-transport.js';
|
|
7
|
+
export type { SshfsTransportConfig, SshfsDelegatorConfig, SshfsExecutorConfig, CredentialManagerConfig, GeneratedCredential, SshfsMountConfig, MountParams, ActiveMount, SshfsMountInfo, SshCredential, SshEndpoint, } from './types.js';
|
|
8
|
+
export { CredentialManager } from './delegator/index.js';
|
|
9
|
+
export { SshfsMountClient, DEFAULT_TEMP_KEY_DIR, buildSshfsArgs } from './executor/index.js';
|
|
8
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,cAAc,EACd,aAAa,EACb,WAAW,GACZ,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* SSHFS Transport implementation for AWCP data plane
|
|
5
5
|
*/
|
|
6
|
-
//
|
|
7
|
-
export {
|
|
8
|
-
//
|
|
9
|
-
export {
|
|
6
|
+
// Main transport adapter
|
|
7
|
+
export { SshfsTransport } from './sshfs-transport.js';
|
|
8
|
+
// Lower-level components (for advanced use cases)
|
|
9
|
+
export { CredentialManager } from './delegator/index.js';
|
|
10
|
+
export { SshfsMountClient, DEFAULT_TEMP_KEY_DIR, buildSshfsArgs } from './executor/index.js';
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,yBAAyB;AACzB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,yBAAyB;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAiBtD,kDAAkD;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|