Merge pull request #116 from Cascade-Lab/sb-fix-host-scan-port

Use custom port for host scan
main
Dragan Filipović 2023-02-19 18:25:20 +01:00 committed by GitHub
commit d5e1f75798
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 1980 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

1979
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ const run = async () => {
const { path: privateKeyPath } = getPrivateKeyPath(deployKeyName);
// Update known hosts if ssh command is present to avoid prompt
if (scriptBefore || scriptAfter) {
updateKnownHosts(remoteHost);
updateKnownHosts(remoteHost, remotePort);
}
// Check Script before
if (scriptBefore) {

View File

@ -23,11 +23,11 @@ const addSshKey = (content, deployKeyName) => {
console.log('✅ [SSH] key added to `.ssh` dir ', dir, filename);
};
const updateKnownHosts = (host) => {
const updateKnownHosts = (host, remotePort) => {
const { knownHostsPath } = getPrivateKeyPath();
console.log('[SSH] Adding host to `known_hosts` ....', host, knownHostsPath);
try {
execSync(`ssh-keyscan -H ${host} >> ${knownHostsPath}`, {
execSync(`ssh-keyscan -p ${(remotePort || 22)} -H ${host} >> ${knownHostsPath}`, {
stdio: 'inherit'
});
} catch (error) {