la-haute-societe / ssh-deploy-release

Deploy releases over SSH with rsync, archive ZIP / TAR, symlinks, SCP ...
https://www.npmjs.com/package/ssh-deploy-release
MIT License
36 stars 10 forks source link

Pass onKeyboardInteractive callback to ssh2 #27

Closed Sibyx closed 2 years ago

Sibyx commented 3 years ago

Hello, if you want to use tryKeyboard == true, you have to provide keyboard-interactive function to SSH2, but there was no such possibility. I have just added support for passing keyboard-interactive to ssh2 using options object.

Here is working example:

const Deployer = require('ssh-deploy-release');

const options = {
  localPath: 'build',
  host: process.env.REMOTE_HOST,
  username: process.env.REMOTE_USER,
  password: process.env.REMOTE_PASSWORD,
  deployPath: process.env.REMOTE_PATH,
  currentReleaseLink: 'current',
  archiveType: 'zip',
  tryKeyboard: true,
  onKeyboardInteractive: function (name, descr, lang, prompts, finish) {
    return finish([this.config.password]);
  }
};

const deployer = new Deployer(options);
deployer.deployRelease(() => {
  console.log('Deployed!')
});

I have to admit I am not a JS developer, so I hope my implementation is not that bad. Our servers support keyboard-interactive authentication only (it's kinda default behavior on majority of production servers).

Sibyx commented 3 years ago

Any updates?

nstCactus commented 2 years ago

Thank you, and sorry for the long wait. I'll try to publish a release including this in the next few days.

nstCactus commented 2 years ago

@Sibyx Version 4.0.0 is out with that change.