Module: TrainPlugins::Juniper::SshAskpass

Included in:
BastionProxy
Defined in:
lib/train-juniper/connection/ssh_askpass.rb

Overview

SSH_ASKPASS script management for automated password authentication

Instance Method Summary collapse

Instance Method Details

#create_ssh_askpass_script(password) ⇒ String

Create temporary SSH_ASKPASS script for automated password authentication

Parameters:

  • password (String)

    The password to use

Returns:

  • (String)

    Path to the created script



23
24
25
26
27
28
29
# File 'lib/train-juniper/connection/ssh_askpass.rb', line 23

def create_ssh_askpass_script(password)
  if Gem.win_platform?
    create_windows_askpass_script(password)
  else
    create_unix_askpass_script(password)
  end
end

#setup_bastion_password_authObject

Set up SSH_ASKPASS for bastion password authentication



10
11
12
13
14
15
16
17
18
# File 'lib/train-juniper/connection/ssh_askpass.rb', line 10

def setup_bastion_password_auth
  bastion_password = @options[:bastion_password] || @options[:password]
  return unless bastion_password

  @ssh_askpass_script = create_ssh_askpass_script(bastion_password)
  ENV['SSH_ASKPASS'] = @ssh_askpass_script
  ENV['SSH_ASKPASS_REQUIRE'] = 'force'
  @logger.debug('Configured SSH_ASKPASS for automated bastion authentication')
end