Browse Source

issue #308 ensure ssh port is set correctly

pull/316/head
butlerx 4 years ago
parent
commit
ee106ffc5b
No known key found for this signature in database GPG Key ID: B37CA765BAA89170
  1. 26
      src/server/command/ssh.ts

26
src/server/command/ssh.ts

@ -2,17 +2,26 @@ import isUndefined from 'lodash/isUndefined.js';
import { logger } from '../../shared/logger.js';
export function sshOptions(
{ pass, path, command, host, port, auth, knownHosts, config }: Record<string, string>,
{
pass,
path,
command,
host,
port,
auth,
knownHosts,
config,
}: Record<string, string>,
key?: string,
): string[] {
const cmd = parseCommand(command, path);
const hostChecking = knownHosts !== '/dev/null' ? 'yes' : 'no';
const sshRemoteOptsBase = [
'ssh',
host,
'-t',
config !== '' ? '-F' : '',
config,
logger.info(`Authentication Type: ${auth}`);
let sshRemoteOptsBase = ['ssh', host, '-t'];
if (config !== '') {
sshRemoteOptsBase = sshRemoteOptsBase.concat(['-F', config]);
}
sshRemoteOptsBase = sshRemoteOptsBase.concat([
'-p',
port,
'-o',
@ -21,8 +30,7 @@ export function sshOptions(
`UserKnownHostsFile=${knownHosts}`,
'-o',
`StrictHostKeyChecking=${hostChecking}`,
];
logger.info(`Authentication Type: ${auth}`);
]);
if (!isUndefined(key)) {
return sshRemoteOptsBase.concat(['-i', key, cmd]);
}

Loading…
Cancel
Save