Module: TrainPlugins::Juniper::BastionProxy

Includes:
SshAskpass, WindowsProxy
Included in:
Connection
Defined in:
lib/train-juniper/connection/bastion_proxy.rb

Overview

Handles bastion host proxy configuration and authentication

Instance Method Summary collapse

Methods included from SshAskpass

#create_ssh_askpass_script, #setup_bastion_password_auth

Methods included from WindowsProxy

#build_plink_proxy_command, #plink_available?

Instance Method Details

#configure_bastion_proxy(ssh_options) ⇒ Object

Configure bastion proxy for SSH connection

Parameters:

  • ssh_options (Hash)

    SSH options to modify



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/train-juniper/connection/bastion_proxy.rb', line 16

def configure_bastion_proxy(ssh_options)
  bastion_user = @options[:bastion_user] || @options[:user]
  bastion_port = @options[:bastion_port]
  bastion_password = @options[:bastion_password] || @options[:password]

  # On Windows with password auth, use plink.exe if available
  if Gem.win_platform? && bastion_password && plink_available?
    configure_plink_proxy(ssh_options, bastion_user, bastion_port, bastion_password)
  else
    configure_standard_proxy(ssh_options, bastion_user, bastion_port)
  end
end