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

Loading…
Cancel
Save