From 6fb983c3e497dcc8d8b000e9064bb43b10be29c8 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Wed, 6 Jul 2016 00:31:26 +0100 Subject: Added support for ssh_no_exec config file variable --- README.md | 11 +++++++++++ lib/oxidized/model/airos.rb | 2 +- lib/oxidized/model/fabricos.rb | 2 +- lib/oxidized/model/junos.rb | 4 ++-- lib/oxidized/model/opengear.rb | 2 +- lib/oxidized/model/routeros.rb | 2 +- lib/oxidized/model/tmos.rb | 2 +- 7 files changed, 18 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 793c0f1..6c7e381 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen 6. [Cookbook](#cookbook) * [Debugging](#debugging) * [Privileged mode](#privileged-mode) + * [Disabling SSH exec channels](#disabling-ssh-exec-channels) * [Source: CSV](#source-csv) * [Source: SQLite](#source-sqlite) * [Source: HTTP](#source-http) @@ -332,6 +333,16 @@ The above strips out snmp community strings from your saved configs. **NOTE:** Removing secrets reduces the usefulness as a full configuration backup, but it may make sharing configs easier. +### Disabling SSH exec channels + +Oxidized uses exec channels to make information extraction simpler, but there are some situations where this doesn't work well, e.g. configuring devices. This feature can be turned off by setting the ```ssh_no_exec``` +variable. + +``` +vars: + ssh_no_exec: true +``` + ### Source: CSV One line per device, colon seperated. diff --git a/lib/oxidized/model/airos.rb b/lib/oxidized/model/airos.rb index 775005f..3ccf887 100644 --- a/lib/oxidized/model/airos.rb +++ b/lib/oxidized/model/airos.rb @@ -15,6 +15,6 @@ class Airos < Oxidized::Model end cfg :ssh do - exec true + exec true unless vars :ssh_no_exec end end diff --git a/lib/oxidized/model/fabricos.rb b/lib/oxidized/model/fabricos.rb index 7ab9fd5..8ad32d9 100644 --- a/lib/oxidized/model/fabricos.rb +++ b/lib/oxidized/model/fabricos.rb @@ -15,7 +15,7 @@ class FabricOS < Oxidized::Model end cfg :ssh do - exec true # don't run shell, run each command in exec channel + exec true unless vars :ssh_no_exec # don't run shell, run each command in exec channel end end diff --git a/lib/oxidized/model/junos.rb b/lib/oxidized/model/junos.rb index bdd9bed..6392709 100644 --- a/lib/oxidized/model/junos.rb +++ b/lib/oxidized/model/junos.rb @@ -8,7 +8,7 @@ class JunOS < Oxidized::Model cmd :all do |cfg| # we don't need screen-scraping in ssh due to exec - cfg = cfg.lines.to_a[1..-2].join if telnet + cfg = cfg.lines.to_a[1..-2].join if telnet || !vars(:ssh_no_exec) cfg.lines.map { |line| line.rstrip }.join("\n") + "\n" end @@ -44,7 +44,7 @@ class JunOS < Oxidized::Model end cfg :ssh do - exec true # don't run shell, run each command in exec channel + exec true unless vars :ssh_no_exec # don't run shell, run each command in exec channel end cfg :telnet, :ssh do diff --git a/lib/oxidized/model/opengear.rb b/lib/oxidized/model/opengear.rb index 7f801f8..0e2f8d2 100644 --- a/lib/oxidized/model/opengear.rb +++ b/lib/oxidized/model/opengear.rb @@ -13,7 +13,7 @@ class OpenGear < Oxidized::Model cmd 'config -g config' cfg :ssh do - exec true # don't run shell, run each command in exec channel + exec true unless vars :ssh_no_exec # don't run shell, run each command in exec channel end end diff --git a/lib/oxidized/model/routeros.rb b/lib/oxidized/model/routeros.rb index 4822500..f7746c8 100644 --- a/lib/oxidized/model/routeros.rb +++ b/lib/oxidized/model/routeros.rb @@ -18,6 +18,6 @@ class RouterOS < Oxidized::Model end cfg :ssh do - exec true + exec true unless vars :ssh_no_exec end end diff --git a/lib/oxidized/model/tmos.rb b/lib/oxidized/model/tmos.rb index 390046d..7a1ca73 100644 --- a/lib/oxidized/model/tmos.rb +++ b/lib/oxidized/model/tmos.rb @@ -46,7 +46,7 @@ class TMOS < Oxidized::Model cmd('cat /config/partitions/*/bigip.conf') { |cfg| comment cfg } cfg :ssh do - exec true # don't run shell, run each command in exec channel + exec true unless vars :ssh_no_exec # don't run shell, run each command in exec channel end end -- cgit v1.2.1