summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Lasseter <Nat Lasseter nathan@bytemark.co.uk>2018-09-18 15:49:45 +0100
committerNat Lasseter <Nat Lasseter nathan@bytemark.co.uk>2018-09-18 15:49:45 +0100
commit5ceed9ba8613d292976adf1f9147709c7cdaeddc (patch)
treea478e5199a5c4b7b91b218dc98c7ce1a9795bdab
parent5414cb61972c9c2957a5d69c0ad1fbc92ce1e260 (diff)
Add support for privilege escalation on cumulus devices
-rw-r--r--lib/oxidized/model/cumulus.rb13
1 files changed, 13 insertions, 0 deletions
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