@miraj181/ipingyou 2.0.12 → 2.0.13
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/package.json +1 -1
- package/src/lib/ssh.js +1 -4
- package/src/modes/host.js +11 -4
package/package.json
CHANGED
package/src/lib/ssh.js
CHANGED
|
@@ -21,10 +21,7 @@ export function formatRemoteCd(remotePath) {
|
|
|
21
21
|
export function formatScpRemotePath(remotePath) {
|
|
22
22
|
const trimmed = String(remotePath || '').trim();
|
|
23
23
|
if (!trimmed || trimmed === '~') return trimmed || '~';
|
|
24
|
-
|
|
25
|
-
return `~/${quoteRemoteShell(trimmed.slice(2))}`;
|
|
26
|
-
}
|
|
27
|
-
return quoteRemoteShell(trimmed);
|
|
24
|
+
return trimmed;
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
export function getSshControlOptions(hostname) {
|
package/src/modes/host.js
CHANGED
|
@@ -146,7 +146,10 @@ async function ensureTmuxInstalled() {
|
|
|
146
146
|
|
|
147
147
|
// ─── Ephemeral SSH Key Management ────────────────────────────
|
|
148
148
|
async function generateEphemeralKey() {
|
|
149
|
-
const tmpDir = os.tmpdir();
|
|
149
|
+
const tmpDir = os.tmpdir() || process.env.TMPDIR || process.env.TEMP || process.env.TMP;
|
|
150
|
+
if (!tmpDir) {
|
|
151
|
+
throw new Error('Could not resolve a temporary directory for SSH key generation');
|
|
152
|
+
}
|
|
150
153
|
const keyPath = path.join(tmpDir, `ipingyou_${Date.now()}`);
|
|
151
154
|
|
|
152
155
|
await execa('ssh-keygen', ['-t', 'ed25519', '-C', 'ipingyou-ephemeral', '-f', keyPath, '-N', '']);
|
|
@@ -158,8 +161,12 @@ async function generateEphemeralKey() {
|
|
|
158
161
|
}
|
|
159
162
|
|
|
160
163
|
async function injectPublicKey(pubKey) {
|
|
161
|
-
const
|
|
162
|
-
|
|
164
|
+
const homedir = os.homedir();
|
|
165
|
+
if (!homedir) {
|
|
166
|
+
throw new Error('Could not resolve the current user home directory for authorized_keys');
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const sshDir = path.join(homedir, '.ssh');
|
|
163
170
|
|
|
164
171
|
if (!fs.existsSync(sshDir)) {
|
|
165
172
|
await fs.promises.mkdir(sshDir, { mode: 0o700, recursive: true });
|
|
@@ -537,7 +544,7 @@ export async function startHostMode() {
|
|
|
537
544
|
});
|
|
538
545
|
console.log(chalk.green(' ✓ Ephemeral key injected. Client will connect without system password!'));
|
|
539
546
|
} catch (err) {
|
|
540
|
-
console.log(chalk.yellow(` ⚠️ Could not
|
|
547
|
+
console.log(chalk.yellow(` ⚠️ Could not prepare ephemeral SSH key: ${err.message}`));
|
|
541
548
|
console.log(chalk.dim(' Client will need to use standard OS password.'));
|
|
542
549
|
}
|
|
543
550
|
} else {
|