|
@ -1,10 +1,21 @@ |
|
|
const localhost = host => |
|
|
const localhost = host => |
|
|
process.getuid() === 0 && (host === 'localhost' || host === '0.0.0.0' || host === '127.0.0.1'); |
|
|
process.getuid() === 0 && |
|
|
|
|
|
(host === 'localhost' || host === '0.0.0.0' || host === '127.0.0.1'); |
|
|
|
|
|
|
|
|
export default ({ request: { headers }, client: { conn } }, { user, host, port, auth }) => ({ |
|
|
export default ( |
|
|
|
|
|
{ request: { headers }, client: { conn } }, |
|
|
|
|
|
{ user, host, port, auth }, |
|
|
|
|
|
) => ({ |
|
|
args: localhost(host) |
|
|
args: localhost(host) |
|
|
? ['login', '-h', conn.remoteAddress.split(':')[3]] |
|
|
? ['login', '-h', conn.remoteAddress.split(':')[3]] |
|
|
: ['ssh', address(headers, user, host), '-p', port, '-o', `PreferredAuthentications=${auth}`], |
|
|
: [ |
|
|
|
|
|
'ssh', |
|
|
|
|
|
address(headers, user, host), |
|
|
|
|
|
'-p', |
|
|
|
|
|
port, |
|
|
|
|
|
'-o', |
|
|
|
|
|
`PreferredAuthentications=${auth}`, |
|
|
|
|
|
], |
|
|
user: localhost(host) || user !== '' || user.includes('@'), |
|
|
user: localhost(host) || user !== '' || user.includes('@'), |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|