From 5ceed9ba8613d292976adf1f9147709c7cdaeddc Mon Sep 17 00:00:00 2001 From: Nat Lasseter Date: Tue, 18 Sep 2018 15:49:45 +0100 Subject: Add support for privilege escalation on cumulus devices --- lib/oxidized/model/cumulus.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/oxidized/model') diff --git a/lib/oxidized/model/cumulus.rb b/lib/oxidized/model/cumulus.rb index c8e1707..f6f5df4 100644 --- a/lib/oxidized/model/cumulus.rb +++ b/lib/oxidized/model/cumulus.rb @@ -88,6 +88,19 @@ class Cumulus < Oxidized::Model end cfg :telnet, :ssh do + post_login do + if vars(:enable) == true then + cmd "sudo su -", /^\[sudo] password/ + cmd vars(:password) + elsif vars(:enable) + cmd "su -", /^Password:/ + cmd vars(:enable) + end + end + + pre_logout do + cmd "exit" if vars(:enable) + end pre_logout 'exit' end end -- cgit v1.2.1