|
|
@ -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]); |
|
|
|
} |
|
|
|