Class: Shells::PfSenseSshSession
- Inherits:
-
SshSession
- Object
- ShellBase
- SshSession
- Shells::PfSenseSshSession
- Includes:
- PfSenseCommon
- Defined in:
- lib/shells/pf_sense_ssh_session.rb
Overview
Executes an SSH session with a pfSense host.
Valid options:
hostThe name or IP address of the host to connect to. Defaults to 'localhost'.
portThe port on the host to connect to. Defaults to 22.
userThe user to login with. This option is required.
passwordThe password to login with. If our public key is an authorized key on the host, the password is ignored.
silence_timeoutWhen a command is executing, this is the maximum amount of time to wait for any feedback from the shell. If set to 0 (or less) there is no timeout. Unlike
command_timeoutthis value resets every time we receive feedback. This option can be overridden by providing an alternate value to theexecmethod on a case-by-case basis.command_timeoutWhen a command is executing, this is the maximum amount of time to wait for the command to finish. If set to 0 (or less) there is no timeout. Unlike
silence_timeoutthis value does not reset when we receive feedback. This option can be overridden by providing an alternate value to theexecmethod on a case-by-case basis.connect_timeoutThis is the maximum amount of time to wait for the initial connection to the SSH shell.
Shells::PfSenseSshSession.new( host: '10.10.10.10', user: 'somebody', password: 'super-secret' ) do |shell| cfg = shell.get_config_section("aliases") cfg ||= [] cfg << { :name => "MY_NETWORK", :type => "network", :address => "192.168.1.0/24", :descr => "My home network", :details => "Created #Time.now.to_s" } shell.set_config_section("aliases", cfg, "Add home network") shell.apply_filter_config end
Constant Summary
Constants included from PfSenseCommon
Shells::PfSenseCommon::BASE_SHELL, Shells::PfSenseCommon::PF_PROMPT, Shells::PfSenseCommon::PF_SHELL
Instance Attribute Summary
Attributes included from PfSenseCommon
#pf_sense_host, #pf_sense_user, #pf_sense_version
Attributes inherited from ShellBase
Method Summary
Methods included from PfSenseCommon
#apply_filter_config, #apply_user_config, #config_parsed?, #enable_cert_auth, #exec_prompt, #exec_shell, #get_config_section, included, #line_ending, #parse_config, #pf_exec, #quit, #reboot, #set_config_section, #validate_options
Methods included from BashCommon
#read_file, #sudo_exec, #sudo_exec_for_code, #sudo_exec_ignore_code, #write_file
Methods inherited from ShellBase
add_hook, after_init, after_term, before_init, before_term, #combined_output, debug, #exec, #exec_for_code, #exec_ignore_code, hooks, #initialize, #line_ending, on_debug, on_exception, #read_file, #session_complete?, #stderr, #stdout, #write_file
Constructor Details
This class inherits a constructor from Shells::ShellBase