Class: Shells::SshPfSenseShell
- Inherits:
-
SshBashShell
- Object
- ShellBase
- SshShell
- SshBashShell
- Shells::SshPfSenseShell
- Includes:
- PfSenseCommon
- Defined in:
- lib/shells/ssh_pf_sense_shell.rb
Overview
Executes an SSH session with a pfSense host.
Valid options:
host-
The name or IP address of the host to connect to. Defaults to ‘localhost’.
port-
The port on the host to connect to. Defaults to 22.
user-
The user to login with. This option is required.
password-
The password to login with. If our public key is an authorized key on the host, the password is ignored.
silence_timeout-
When 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_timeout-
When 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_timeout-
This is the maximum amount of time to wait for the initial connection to the SSH shell.
Shells::SshPfSenseShell.new(
host: '10.10.10.10',
user: 'somebody',
password: 'super-secret'
) do |shell|
shell.pf_shell do |shell|
cfg = shell.get_config_section("aliases")
cfg["alias"] ||= []
cfg["alias"] << {
: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
end
Constant Summary
Constants included from PfSenseCommon
PfSenseCommon::BASE_SHELL, PfSenseCommon::MENU_PROMPT
Instance Attribute Summary
Attributes included from PfSenseCommon
#pf_sense_host, #pf_sense_user, #pf_sense_version
Attributes inherited from ShellBase
#last_exit_code, #options, #output, #stderr, #stdout
Method Summary
Methods included from PfSenseCommon
included, #line_ending, #pf_shell, #setup_prompt, #teardown, #validate_options
Methods included from BashCommon
#read_file, #sudo_exec, #sudo_exec_for_code, #sudo_exec_ignore_code, #write_file
Methods inherited from ShellBase
#change_quit, #exec, #exec_for_code, #exec_ignore_code, #initialize, #inspect, #line_ending, on_debug, #read_file, #run, #running?, #write_file
Constructor Details
This class inherits a constructor from Shells::ShellBase