@pixlcore/xyplug-ssh 1.0.0 → 1.0.2
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/README.md +1 -0
- package/index.js +12 -3
- package/package.json +1 -1
- package/xyops.json +10 -3
package/README.md
CHANGED
|
@@ -50,6 +50,7 @@ The plugin also exports a few helper variables remotely:
|
|
|
50
50
|
- `SSH Hostname`: Hostname or IP address
|
|
51
51
|
- `Username`: SSH username
|
|
52
52
|
- `Port`: SSH port
|
|
53
|
+
- `Private Key File`: Optional path to private key on disk.
|
|
53
54
|
- `Host Fingerprint`: Optional host key pin, recommended for production
|
|
54
55
|
- `Connect Timeout`: SSH connect timeout in seconds
|
|
55
56
|
- `Remote Env`: Extra key/value pairs to pass to the remote side
|
package/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// Copyright (c) 2026 PixlCore LLC
|
|
5
5
|
// MIT License
|
|
6
6
|
|
|
7
|
+
const fs = require('fs');
|
|
7
8
|
const { createHash } = require('crypto');
|
|
8
9
|
const { Client } = require('ssh2');
|
|
9
10
|
|
|
@@ -36,7 +37,7 @@ const app = {
|
|
|
36
37
|
String(this.params.username || '').trim(),
|
|
37
38
|
this.params.port
|
|
38
39
|
);
|
|
39
|
-
const auth = resolveAuth(secrets);
|
|
40
|
+
const auth = resolveAuth(this.params, secrets);
|
|
40
41
|
const remoteCommand = String(this.params.remote_command || '').trim();
|
|
41
42
|
if (!remoteCommand) fatal('params', "Required parameter 'remote_command' was not provided.");
|
|
42
43
|
|
|
@@ -226,12 +227,20 @@ function parseTarget(hostname, username, portFallback) {
|
|
|
226
227
|
return { host, port, username: user };
|
|
227
228
|
}
|
|
228
229
|
|
|
229
|
-
function resolveAuth(secrets) {
|
|
230
|
-
|
|
230
|
+
function resolveAuth(params, secrets) {
|
|
231
|
+
let privateKey = resolveNamedValue('SSH_PRIVATE_KEY', secrets);
|
|
231
232
|
const passphrase = resolveNamedValue('SSH_PASSPHRASE', secrets);
|
|
232
233
|
const password = resolveNamedValue('SSH_PASSWORD', secrets);
|
|
233
234
|
const agent = process.env.SSH_AUTH_SOCK || '';
|
|
234
235
|
|
|
236
|
+
// private key may be specified as a file path in params
|
|
237
|
+
if (params.private_key_file) {
|
|
238
|
+
try { privateKey = fs.readFileSync(params.private_key_file, 'utf8'); }
|
|
239
|
+
catch (err) {
|
|
240
|
+
fatal( 'auth', 'Failed to read private key file: ' + params.private_key_file + ": " + err );
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
235
244
|
if (!privateKey && !password && !agent) {
|
|
236
245
|
fatal(
|
|
237
246
|
'auth',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixlcore/xyplug-ssh",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "An SSH runner plugin for the xyOps workflow automation system.",
|
|
5
5
|
"author": "Joseph Huckaby <jhuckaby@pixlcore.com>",
|
|
6
6
|
"homepage": "https://github.com/pixlcore/xyplug-ssh",
|
package/xyops.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"title": "Remote SSH",
|
|
11
11
|
"enabled": true,
|
|
12
12
|
"type": "event",
|
|
13
|
-
"command": "npx -y @pixlcore/xyplug-ssh@1.0.
|
|
13
|
+
"command": "npx -y @pixlcore/xyplug-ssh@1.0.2",
|
|
14
14
|
"script": "",
|
|
15
15
|
"kill": "parent",
|
|
16
16
|
"runner": true,
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"title": "Username",
|
|
31
31
|
"type": "text",
|
|
32
32
|
"value": "",
|
|
33
|
-
"caption": "SSH username to connect with.",
|
|
33
|
+
"caption": "The SSH username to connect with.",
|
|
34
34
|
"required": true
|
|
35
35
|
},
|
|
36
36
|
{
|
|
@@ -39,7 +39,14 @@
|
|
|
39
39
|
"type": "text",
|
|
40
40
|
"variant": "number",
|
|
41
41
|
"value": 22,
|
|
42
|
-
"caption": "SSH TCP port."
|
|
42
|
+
"caption": "The SSH TCP port (usually `22`)."
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": "private_key_file",
|
|
46
|
+
"title": "Private Key File",
|
|
47
|
+
"type": "text",
|
|
48
|
+
"value": "",
|
|
49
|
+
"caption": "Optional: If your SSH private key is stored on disk, you can enter the path to it here. Otherwise, use a secret vault."
|
|
43
50
|
},
|
|
44
51
|
{
|
|
45
52
|
"id": "host_fingerprint",
|