From 1aca290d70b5f2dec16bc313111cca4155b80a23 Mon Sep 17 00:00:00 2001 From: Christoffer Stokbaek Date: Thu, 4 Aug 2016 16:30:18 +0200 Subject: Added support for pfSense --- lib/oxidized/pfsense.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 lib/oxidized/pfsense.rb (limited to 'lib/oxidized/pfsense.rb') diff --git a/lib/oxidized/pfsense.rb b/lib/oxidized/pfsense.rb new file mode 100644 index 0000000..67a1a49 --- /dev/null +++ b/lib/oxidized/pfsense.rb @@ -0,0 +1,34 @@ +class PfSense < Oxidized::Model + + prompt /^\e\[0;1;33m\[\S*\e\[0;1;33m\]\e\[0;1;33m\e\[\S*\e\[0;1;31m@\S*\e\[0;1;33m\]\S*\e\[0;1;31m:\e\[0;0;0m\s$/ + comment '# ' + + + #add a comment in the final conf + def add_comment comment + "\n###### #{comment} ######\n" + end + + cmd :all do |cfg| + cfg.each_line.to_a[1..-2].join + end + + #show the persistent configuration + pre do + cfg = add_comment 'Configuration' + cfg += cmd 'cat /cf/conf/config.xml' + end + + + cfg :telnet do + username /^Username:/ + password /^Password:/ + end + + cfg :telnet, :ssh do + pre_logout 'exit' + end + + +end + -- cgit v1.2.1 From b8988ecf7edfbcb414fc93baa54e702f95ed80fe Mon Sep 17 00:00:00 2001 From: Christoffer Stokbaek Date: Fri, 5 Aug 2016 10:20:07 +0200 Subject: Switched from prompt grap to ssh exec --- lib/oxidized/pfsense.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/oxidized/pfsense.rb') diff --git a/lib/oxidized/pfsense.rb b/lib/oxidized/pfsense.rb index 67a1a49..078c2a4 100644 --- a/lib/oxidized/pfsense.rb +++ b/lib/oxidized/pfsense.rb @@ -1,6 +1,5 @@ class PfSense < Oxidized::Model - prompt /^\e\[0;1;33m\[\S*\e\[0;1;33m\]\e\[0;1;33m\e\[\S*\e\[0;1;31m@\S*\e\[0;1;33m\]\S*\e\[0;1;31m:\e\[0;0;0m\s$/ comment '# ' @@ -20,6 +19,10 @@ class PfSense < Oxidized::Model end + cfg :ssh do + exec true + end + cfg :telnet do username /^Username:/ password /^Password:/ -- cgit v1.2.1 From aad3637ba0ee88778468bd1b8cd36f26e1393b98 Mon Sep 17 00:00:00 2001 From: Christoffer Stokbaek Date: Fri, 5 Aug 2016 11:29:28 +0200 Subject: Removed telnet from config --- lib/oxidized/pfsense.rb | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'lib/oxidized/pfsense.rb') diff --git a/lib/oxidized/pfsense.rb b/lib/oxidized/pfsense.rb index 078c2a4..cd6885c 100644 --- a/lib/oxidized/pfsense.rb +++ b/lib/oxidized/pfsense.rb @@ -2,7 +2,6 @@ class PfSense < Oxidized::Model comment '# ' - #add a comment in the final conf def add_comment comment "\n###### #{comment} ######\n" @@ -18,20 +17,9 @@ class PfSense < Oxidized::Model cfg += cmd 'cat /cf/conf/config.xml' end - cfg :ssh do exec true - end - - cfg :telnet do - username /^Username:/ - password /^Password:/ - end - - cfg :telnet, :ssh do pre_logout 'exit' end - end - -- cgit v1.2.1