class Proxy::RemoteExecution::Ssh::Runners::AuthenticationMethod

Attributes

name[R]

Public Class Methods

new(name, prompt: nil, password: nil) click to toggle source
# File lib/smart_proxy_remote_execution_ssh/multiplexed_ssh_connection.rb, line 25
def initialize(name, prompt: nil, password: nil)
  @name = name
  @prompt = prompt
  @password = password
end

Public Instance Methods

ssh_command_prefix() click to toggle source
# File lib/smart_proxy_remote_execution_ssh/multiplexed_ssh_connection.rb, line 31
def ssh_command_prefix
  return [] unless @password

  prompt = ['-P', @prompt] if @prompt
  [{'SSHPASS' => SensitiveString.new(@password)}, 'sshpass', '-e', prompt].compact
end
ssh_options() click to toggle source
# File lib/smart_proxy_remote_execution_ssh/multiplexed_ssh_connection.rb, line 38
def ssh_options
  ["-o PreferredAuthentications=#{name}",
   "-o NumberOfPasswordPrompts=#{@password ? 1 : 0}"]
end