diff options
50 files changed, 1606 insertions, 673 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 34b192c..0e03883 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,243 +1,324 @@ -# 0.20.0 -- FEATURE: gpg support for CSV source (@elmobp) -- FEATURE: slackdiff (@natm) -- FEATURE: gitcrypt output model (@clement-parisot) -- FEATURE: model specific credentials (@davromaniak) -- FEATURE: hierarchical json in http source model -- FEATURE: next-adds-job config toggle (to add new job when ever /next is called) -- FEATURE: netgear model (@aschaber1) -- FEATURE: zhone model (@rfdrake) -- FEATURE: tplink model (@mediumo) -- FEATURE: oneos model (@crami) -- FEATURE: cisco NGA model (@udhos) -- FEATURE: voltaire model (@clement-parisot) -- FEATURE: siklu model (@bdg-robert) -- FEATURE: voss model (@ospfbgp) -- BUGFIX: ios, cumulus, ironware, nxos, fiberdiver, aosw, fortios, comware, procurve, opengear, timos, routeros, junos, asa, aireos, mlnxos, pfsense, saos, powerconnect, firewareos, quantaos - -# 0.19.0 -- FEATURE: allow setting ssh_keys (not relying on openssh config) (@denvera) -- FEATURE: fujitsupy model (@stokbaek) -- FEATURE: fiberdriver model (@emjemj) -- FEATURE: hpbladesystems model (@flokli) -- FEATURE: planetsgs model (@flokli) -- FEATURE: trango model (@rfdrake) -- FEATURE: casa model (@rfdrake) -- FEATURE: dlink model (@rfdrake) -- FEATURE: hatteras model (@rfdrake) -- FEATURE: ability to ignore SSL certs in http (@laf) -- FEATURE: awsns hooks, publish messages to AWS SNS topics (@natm) -- BUGFIX: pfsense, dnos, powerconnect, ciscosmb, eos, aosw - -# 0.18.0 -- FEATURE: APC model (by @davromaniak ) -- BUGFIX: ironware, aosw -- BUGFIX: interpolate nil, false, true for node vars too - -# 0 17.0 -- FEATURE: "nil", "false" and "true" in source (e.g. router.db) are interpeted as nil, false, true. Empty is now always considered empty string, instead of in some cases nil and some cases empty string. -- FEATURE: support tftp as input model (@MajesticFalcon) -- FEATURE: add alvarion model (@MajesticFalcon) -- FEATURE: detect if ssh wants password terminal/CLI prompt or not -- FEATURE: node (group, model, username, password) resolution refactoring, supports wider range of use-cases -- BUGFIX: fetch for file output (@danilopopeye) -- BUGFIX: net-ssh version specification -- BUGFIX: routeros, catos, pfsense - -# 0.16.3 -- FEATURE: pfsense support (by @stokbaek) -- BUGFIX: cumulus prompt not working with default switch configs (by @nertwork) -- BUGFIX: disconnect ssh when prompt wasn't found (by @andir) -- BUGFIX: saos, asa, acos, timos updates, cumulus - -# 0.16.2 -- BUGFIX: when not using git (by @danilopopeye) -- BUGFIX: screenos update - -# 0.16.1 -- BUGFIX: unnecessary puts statement removed from git.rb - -# 0.16.0 -- FEATURE: support Gaia OS devices (by @totosh) -- BUGFIX: #fetch, #version fixes in nodes.rb (by @danilopopeye) -- BUGFIX: procurve - -# 0.15.0 -- FEATURE: disable periodic collection, only on demand (by Adam Winberg) -- FEATURE: allow disabling ssh exec mode always (mainly for oxidized-script) (by @nickhilliard) -- FEATURE: support mellanox devices (by @ham5ter) -- FEATURE: support firewireos devices (by @alexandre-io) -- FEATURE: support quanta devices (by @f0o) -- FEATURE: support tellabs coriant8800, coriant8600 (by @udhos) -- FEATURE: support brocade6910 (by @cardboardpig) -- BUGFIX: debugging, tests (by @ElvinEfendi) -- BUGFIX: nos, panos, acos, procurve, eos, edgeswitch, aosw, fortios updates - -# 0.14.3 -- BUGFIX: fix git when using multiple groups without single_repo - -# 0.14.2 -- BUGFIX: git expand path for all groups -- BUGFIX: git get_version, teletubbies do it again -- BUGFIX: comware, acos, procurve models - -# 0.14.1 -- BUGFIX: git get_version when groups and single_repo are used - -# 0.14.0 -- FEATURE: support supermicro swithes (by @funzoneq) -- FEATURE: support catos switches -- BUGFIX: git+groups+singlerepo (by @PANZERBARON) -- BUGFIX: asa, tmos, ironware, ios-xr -- BUGFIX: mandate net-ssh 3.0.x, don't accept 3.1 (numerous issues) - -# 0.13.1 -- BUGFIX: file permissions (Sigh...) - -# 0.13.0 -- FEATURE: http post for configs (by @jgroom33) -- FEATURE: support ericsson redbacks (by @roedie) -- FEATURE: support motorola wireless controllers (by @roadie) -- FEATURE: support citrix netscaler (by @roadie) -- FEATURE: support datacom devices (by @danilopopeye) -- FEATURE: support netonix devices -- FEATURE: support specifying ssh cipher and kex (by @roadie) -- FEATURE: rename proxy to ssh_proxy (by @roadie) -- FEATURE: support ssh keys on ssh_proxy (by @awix) -- BUGFIX: various (by @danilopopeye) -- BUGFIX: Node#repo with groups (by @danilopopeye) -- BUGFIX: githubrepohoook (by @danilopopeye) -- BUGFIX: fortios, airos, junos, xos, edgeswitch, nos, tmos, procurve, ipos models - -# 0.12.2 -- BUGFIX: more MRV model fixes (by @natm) - -# 0.12.1 -- BUGFIX: set term to vty100 -- BUGFIX: MRV model fixes (by @natm) - -# 0.12.0 -- FEATURE: enhance AOSW (by @mikebryant) -- FEATURE: F5 TMOS support (by @mikebryant) -- FEATURE: Opengear support (by @mikebryant) -- FEATURE: EdgeSwitch support (by @doogieconsulting) -- BUGFIX: rename input debug log files -- BUGFIX: powerconnect model fixes (by @Madpilot0) -- BUGFIX: fortigate model fixes (by @ElvinEfendi) -- BUGFIX: various (by @mikebryant) -- BUGFIX: write SSH debug to file without buffering -- BUGFIX: fix IOS XR prompt handling - -# 0.11.0 -- FEATURE: ssh proxycommand (by @ElvinEfendi) -- FEATURE: basic auth in HTTP source (by @laf) -- BUGFIX: do not inject string to output before model gets it -- BUGFIX: store pidfile in oxidized root - -# 0.10.0 -- FEATURE: Various refactoring (by @ElvinEfendi) -- FEATURE: Ciena SOAS support (by @jgroom33) -- FEATURE: support group variables (by @supertylerc) -- BUGFIX: various ((orly)) (by @marnovdm, @danbaugher, @MrRJ45, @asynet, @nickhilliard) - -# 0.9.0 -- FEATURE: input log now uses devices name as file, instead of string from config (by @skoef) -- FEATURE: Dell Networkign OS (dnos) support (by @erefre) -- BUGFIX: CiscoSMB, powerconnect, comware, xos, ironware, nos fixes - -# 0.8.1 -- BUGFIX: restore ruby 1.9.3 compatibility - -# 0.8.0 -- FEATURE: hooks (by @aakso) -- FEATURE: MRV MasterOS support (by @kwibbly) -- FEATURE: EdgeOS support (by @laf) -- FEATURE: FTP input and Zyxel ZynOS support (by @ytti) -- FEATURE: version and diffs API For oxidized-web (by @FlorianDoublet) -- BUGFIX: aosw, ironware, routeros, xos models -- BUGFIX: crash with 0 nodes -- BUGFIX: ssh auth fail without keyboard-interactive -- Full changelog https://github.com/ytti/oxidized/compare/0.7.1...HEAD - -# 0.7.0 -- FEATURE: support http source (by @laf) -- FEATURE: support Palo Alto PANOS (by @rixxxx) -- BUGFIX: screenos fixes (by @rixxxx) -- BUGFIX: allow 'none' auth in ssh (spotted by @SaldoorMike, needed by ciscosmb+aireos) - -# 0.6.0 -- FEATURE: support cumulus linux (by @FlorianDoublet) -- FEATURE: support HP Comware SMB siwtches (by @sid3windr) -- FEATURE: remove secret additions (by @rodecker) -- FEATURE: option to put all groups in single repo (by @ytti) -- FEATURE: expand path in source: csv: (so that ~/foo/bar works) (by @ytti) -- BUGFIX: screenos fixes (by @rixxxx) -- BUGFIX: ironware fixes (by @FlorianDoublet) -- BUGFIX: powerconnect fixes (by @sid3windr) -- BUGFIX: don't ask interactive password in new net/ssh (by @ytti) - -# 0.5.0 -- FEATURE: Mikrotik RouterOS model (by @emjemj) -- FEATURE: add support for Cisco VSS (by @MrRJ45) -- BUGFIX: general fixes to powerconnect model (by @MrRJ45) -- BUGFIX: fix initial commit issues with rugged (by @MrRJ45) -- BUGFIX: pager error for old dell powerconnect switches (by @emjemj) -- BUGFIX: logout error for old dell powerconnect switches (by @emjemj) - -# 0.4.1 -- BUGFIX: handle missing output file (by @brandt) -- BUGFIX: fix passwordless enable on Arista EOS model (by @brandt) - -# 0.4.0 -- FEATURE: allow setting IP address in addition to name in source (SQL/CSV) -- FEATURE: approximate how long it takes to get node from larger view than 1 -- FEATURE: unconditionally start new job if too long has passed since previous start -- FEATURE: add enable to Arista EOS model -- FEATURE: add rugged dependency in gemspec -- FEATURE: log prompt detection failures -- BUGFIX: xos while using telnet (by @fhibler) -- BUGFIX: ironware logout on some models (by @fhibler) -- BUGFIX: allow node to be removed while it is being collected -- BUGFIX: if model returns non string value, return empty string -- BUGFIX: better prompt for Arista EOS model (by @rodecker) -- BUGFIX: improved configuration handling for Arista EOS model (by @rodecker) - -# 0.3.0 -- FEATURE: *FIXME* bunch of stuff I did for richih, docs needed -- FEATURE: ComWare model (by erJasp) -- FEATURE: Add comment support for router.db file -- FEATURE: Add input debugging and related configuration options -- BUGFIX: Fix ASA model prompt -- BUGFIX: Fix Aruba model display -- BUGFIX: Fix changing output in PowerConnect model - -# 0.2.4 -- FEATURE: Cisco SMB (Nikola series VxWorks) model by @thetamind -- FEATURE: Extreme Networks XOS model (access by sjm) -- FEATURE: Brocade NOS (Network Operating System) (access by sjm) -- BUGFIX: Match exactly to node[:name] if node[name] is an ip address. - -# 0.2.3 -- BUGFIX: rescue @ssh.close when far end closes disgracefully (ALU ISAM) -- BUGFIX: bugfixes to models -- FEATURE: Alcatel-Lucent ISAM 7302/7330 model added by @jalmargyyk -- FEATURE: Huawei VRP model added by @jalmargyyk -- FEATURE: Ubiquiti AirOS added by @willglyn -- FEATURE: Support 'input' debug in config, ssh/telnet use it to write session log - -# 0.2.2 -- BUGFIX: mark node as failure if unknown error is raised - -# 0.2.1 -- BUGFIX: vars variable resolving for main level vars - -# 0.2.0 -- FEATURE: Force10 model added by @lysiszegerman -- FEATURE: ScreenOS model added by @lysiszegerman -- FEATURE: FabricOS model added by @thakala -- FEATURE: ASA model added by @thakala -- FEATURE: Vyattamodel added by @thakala -- BUGFIX: Oxidized::String convenience methods for models fixed - -# 0.1.1 -- BUGFIX: vars needs to return value of r, not value of evaluation +# Changelog + +## 0.21.0 + +* FEATURE: routeros include system history (@InsaneSplash) +* FEATURE: vrp added support for removing secrets (@bheum) +* FEATURE: hirschmann model (@OCangrand) +* FEATURE: asa added multiple context support (@marnovdm) +* FEATURE: procurve added additional output (@davama) +* FEATURE: Updated git commits to bare repo + drop need for temp dir during clone (@asenci) +* FEATURE: asyncos model (@cd67-usrt) +* FEATURE: ciscosma model (@cd67-usrt) +* FEATURE: procurve added transceiver info (@davama) +* FEATURE: routeros added remove_secret option (@spinza) +* FEATURE: Updated net-ssh version (@Fauli83) +* FEATURE: audiocodes model (@Fauli83) +* FEATURE: Added docs for Huawei VRP devices (@tuxis-ie) +* FEATURE: ciscosmb added radius key detection (@davama) +* FEATURE: radware model (@sfini) +* FEATURE: enterasys model (@koenvdheuvel) +* FEATURE: weos model (@ignaqui) +* FEATURE: hpemsa model (@aschaber1) +* FEATURE: Added nodes_done hook (@danilopopeye) +* FEATURE: ucs model (@WiXZlo) +* FEATURE: acsw model (@sfini) +* FEATURE: aen model (@ZacharyPuls) +* FEATURE: coriantgroove model (@nickhilliard) +* FEATURE: sgos model (@seekerOK) +* FEATURE: powerconnect support password removal (@tobbez) +* FEATURE: Added haproxy example for Ubuntu (@denvera) +* BUGFIX: fiberdriver remove configuration generated on from diff (@emjemj) +* BUGFIX: Fix email pass through (@ZacharyPuls) +* BUGFIX: iosxr suppress timestamp (@ja-frog) +* BUGFIX: ios allow lowercase user/pass prompt (@deepseth) +* BUGFIX: Use git show instead of git diff (@asenci) +* BUGFIX: netgear fixed sending enable password and exit/quit (@candlerb) +* BUGFIX: ironware removed space requirement from password prompt (@crami) +* BUGFIX: dlink removed uptime from diff (@rfdrake) +* BUGFIX: planet removed temp from diff (@flokli) +* BUGFIX: ironware removed fan, temp and flash from diff (@Punicaa) +* BUGFIX: panos changed exit to quit (@goebelmeier) +* BUGFIX: fortios remove FDS address from diffs (@bheum) +* BUGFIX: fortios remove additional secrets from diffs (@brunobritocarvalho) +* BUGFIX: fortios remove IPS URL DB (@brunobritocarvalho) +* BUGFIX: voss remove temperature, power and uptime from diff (@ospfbgp) + +## 0.20.0 + +* FEATURE: gpg support for CSV source (@elmobp) +* FEATURE: slackdiff (@natm) +* FEATURE: gitcrypt output model (@clement-parisot) +* FEATURE: model specific credentials (@davromaniak) +* FEATURE: hierarchical json in http source model +* FEATURE: next-adds-job config toggle (to add new job when ever /next is called) +* FEATURE: netgear model (@aschaber1) +* FEATURE: zhone model (@rfdrake) +* FEATURE: tplink model (@mediumo) +* FEATURE: oneos model (@crami) +* FEATURE: cisco NGA model (@udhos) +* FEATURE: voltaire model (@clement-parisot) +* FEATURE: siklu model (@bdg-robert) +* FEATURE: voss model (@ospfbgp) +* BUGFIX: ios, cumulus, ironware, nxos, fiberdiver, aosw, fortios, comware, procurve, opengear, timos, routeros, junos, asa, aireos, mlnxos, pfsense, saos, powerconnect, firewareos, quantaos + +## 0.19.0 + +* FEATURE: allow setting ssh_keys (not relying on openssh config) (@denvera) +* FEATURE: fujitsupy model (@stokbaek) +* FEATURE: fiberdriver model (@emjemj) +* FEATURE: hpbladesystems model (@flokli) +* FEATURE: planetsgs model (@flokli) +* FEATURE: trango model (@rfdrake) +* FEATURE: casa model (@rfdrake) +* FEATURE: dlink model (@rfdrake) +* FEATURE: hatteras model (@rfdrake) +* FEATURE: ability to ignore SSL certs in http (@laf) +* FEATURE: awsns hooks, publish messages to AWS SNS topics (@natm) +* BUGFIX: pfsense, dnos, powerconnect, ciscosmb, eos, aosw + +## 0.18.0 + +* FEATURE: APC model (by @davromaniak ) +* BUGFIX: ironware, aosw +* BUGFIX: interpolate nil, false, true for node vars too + +## 0 17.0 + +* FEATURE: "nil", "false" and "true" in source (e.g. router.db) are interpeted as nil, false, true. Empty is now always considered empty string, instead of in some cases nil and some cases empty string. +* FEATURE: support tftp as input model (@MajesticFalcon) +* FEATURE: add alvarion model (@MajesticFalcon) +* FEATURE: detect if ssh wants password terminal/CLI prompt or not +* FEATURE: node (group, model, username, password) resolution refactoring, supports wider range of use-cases +* BUGFIX: fetch for file output (@danilopopeye) +* BUGFIX: net-ssh version specification +* BUGFIX: routeros, catos, pfsense + +## 0.16.3 + +* FEATURE: pfsense support (by @stokbaek) +* BUGFIX: cumulus prompt not working with default switch configs (by @nertwork) +* BUGFIX: disconnect ssh when prompt wasn't found (by @andir) +* BUGFIX: saos, asa, acos, timos updates, cumulus + +## 0.16.2 + +* BUGFIX: when not using git (by @danilopopeye) +* BUGFIX: screenos update + +## 0.16.1 + +* BUGFIX: unnecessary puts statement removed from git.rb + +## 0.16.0 + +* FEATURE: support Gaia OS devices (by @totosh) +* BUGFIX: #fetch, #version fixes in nodes.rb (by @danilopopeye) +* BUGFIX: procurve + +## 0.15.0 + +* FEATURE: disable periodic collection, only on demand (by Adam Winberg) +* FEATURE: allow disabling ssh exec mode always (mainly for oxidized-script) (by @nickhilliard) +* FEATURE: support mellanox devices (by @ham5ter) +* FEATURE: support firewireos devices (by @alexandre-io) +* FEATURE: support quanta devices (by @f0o) +* FEATURE: support tellabs coriant8800, coriant8600 (by @udhos) +* FEATURE: support brocade6910 (by @cardboardpig) +* BUGFIX: debugging, tests (by @ElvinEfendi) +* BUGFIX: nos, panos, acos, procurve, eos, edgeswitch, aosw, fortios updates + +## 0.14.3 + +* BUGFIX: fix git when using multiple groups without single_repo + +## 0.14.2 + +* BUGFIX: git expand path for all groups +* BUGFIX: git get_version, teletubbies do it again +* BUGFIX: comware, acos, procurve models + +## 0.14.1 + +* BUGFIX: git get_version when groups and single_repo are used + +## 0.14.0 + +* FEATURE: support supermicro swithes (by @funzoneq) +* FEATURE: support catos switches +* BUGFIX: git+groups+singlerepo (by @PANZERBARON) +* BUGFIX: asa, tmos, ironware, ios-xr +* BUGFIX: mandate net-ssh 3.0.x, don't accept 3.1 (numerous issues) + +## 0.13.1 + +* BUGFIX: file permissions (Sigh...) + +## 0.13.0 + +* FEATURE: http post for configs (by @jgroom33) +* FEATURE: support ericsson redbacks (by @roedie) +* FEATURE: support motorola wireless controllers (by @roadie) +* FEATURE: support citrix netscaler (by @roadie) +* FEATURE: support datacom devices (by @danilopopeye) +* FEATURE: support netonix devices +* FEATURE: support specifying ssh cipher and kex (by @roadie) +* FEATURE: rename proxy to ssh_proxy (by @roadie) +* FEATURE: support ssh keys on ssh_proxy (by @awix) +* BUGFIX: various (by @danilopopeye) +* BUGFIX: Node#repo with groups (by @danilopopeye) +* BUGFIX: githubrepohoook (by @danilopopeye) +* BUGFIX: fortios, airos, junos, xos, edgeswitch, nos, tmos, procurve, ipos models + +## 0.12.2 + +* BUGFIX: more MRV model fixes (by @natm) + +## 0.12.1 + +* BUGFIX: set term to vty100 +* BUGFIX: MRV model fixes (by @natm) + +## 0.12.0 + +* FEATURE: enhance AOSW (by @mikebryant) +* FEATURE: F5 TMOS support (by @mikebryant) +* FEATURE: Opengear support (by @mikebryant) +* FEATURE: EdgeSwitch support (by @doogieconsulting) +* BUGFIX: rename input debug log files +* BUGFIX: powerconnect model fixes (by @Madpilot0) +* BUGFIX: fortigate model fixes (by @ElvinEfendi) +* BUGFIX: various (by @mikebryant) +* BUGFIX: write SSH debug to file without buffering +* BUGFIX: fix IOS XR prompt handling + +## 0.11.0 + +* FEATURE: ssh proxycommand (by @ElvinEfendi) +* FEATURE: basic auth in HTTP source (by @laf) +* BUGFIX: do not inject string to output before model gets it +* BUGFIX: store pidfile in oxidized root + +## 0.10.0 + +* FEATURE: Various refactoring (by @ElvinEfendi) +* FEATURE: Ciena SOAS support (by @jgroom33) +* FEATURE: support group variables (by @supertylerc) +* BUGFIX: various ((orly)) (by @marnovdm, @danbaugher, @MrRJ45, @asynet, @nickhilliard) + +## 0.9.0 + +* FEATURE: input log now uses devices name as file, instead of string from config (by @skoef) +* FEATURE: Dell Networkign OS (dnos) support (by @erefre) +* BUGFIX: CiscoSMB, powerconnect, comware, xos, ironware, nos fixes + +## 0.8.1 + +* BUGFIX: restore ruby 1.9.3 compatibility + +## 0.8.0 + +* FEATURE: hooks (by @aakso) +* FEATURE: MRV MasterOS support (by @kwibbly) +* FEATURE: EdgeOS support (by @laf) +* FEATURE: FTP input and Zyxel ZynOS support (by @ytti) +* FEATURE: version and diffs API For oxidized-web (by @FlorianDoublet) +* BUGFIX: aosw, ironware, routeros, xos models +* BUGFIX: crash with 0 nodes +* BUGFIX: ssh auth fail without keyboard-interactive +* Full changelog https://github.com/ytti/oxidized/compare/0.7.1...HEAD + +## 0.7.0 + +* FEATURE: support http source (by @laf) +* FEATURE: support Palo Alto PANOS (by @rixxxx) +* BUGFIX: screenos fixes (by @rixxxx) +* BUGFIX: allow 'none' auth in ssh (spotted by @SaldoorMike, needed by ciscosmb+aireos) + +## 0.6.0 + +* FEATURE: support cumulus linux (by @FlorianDoublet) +* FEATURE: support HP Comware SMB siwtches (by @sid3windr) +* FEATURE: remove secret additions (by @rodecker) +* FEATURE: option to put all groups in single repo (by @ytti) +* FEATURE: expand path in source: csv: (so that ~/foo/bar works) (by @ytti) +* BUGFIX: screenos fixes (by @rixxxx) +* BUGFIX: ironware fixes (by @FlorianDoublet) +* BUGFIX: powerconnect fixes (by @sid3windr) +* BUGFIX: don't ask interactive password in new net/ssh (by @ytti) + +## 0.5.0 + +* FEATURE: Mikrotik RouterOS model (by @emjemj) +* FEATURE: add support for Cisco VSS (by @MrRJ45) +* BUGFIX: general fixes to powerconnect model (by @MrRJ45) +* BUGFIX: fix initial commit issues with rugged (by @MrRJ45) +* BUGFIX: pager error for old dell powerconnect switches (by @emjemj) +* BUGFIX: logout error for old dell powerconnect switches (by @emjemj) + +## 0.4.1 + +* BUGFIX: handle missing output file (by @brandt) +* BUGFIX: fix passwordless enable on Arista EOS model (by @brandt) + +## 0.4.0 + +* FEATURE: allow setting IP address in addition to name in source (SQL/CSV) +* FEATURE: approximate how long it takes to get node from larger view than 1 +* FEATURE: unconditionally start new job if too long has passed since previous start +* FEATURE: add enable to Arista EOS model +* FEATURE: add rugged dependency in gemspec +* FEATURE: log prompt detection failures +* BUGFIX: xos while using telnet (by @fhibler) +* BUGFIX: ironware logout on some models (by @fhibler) +* BUGFIX: allow node to be removed while it is being collected +* BUGFIX: if model returns non string value, return empty string +* BUGFIX: better prompt for Arista EOS model (by @rodecker) +* BUGFIX: improved configuration handling for Arista EOS model (by @rodecker) + +## 0.3.0 + +* FEATURE: *FIXME* bunch of stuff I did for richih, docs needed +* FEATURE: ComWare model (by erJasp) +* FEATURE: Add comment support for router.db file +* FEATURE: Add input debugging and related configuration options +* BUGFIX: Fix ASA model prompt +* BUGFIX: Fix Aruba model display +* BUGFIX: Fix changing output in PowerConnect model + +## 0.2.4 + +* FEATURE: Cisco SMB (Nikola series VxWorks) model by @thetamind +* FEATURE: Extreme Networks XOS model (access by sjm) +* FEATURE: Brocade NOS (Network Operating System) (access by sjm) +* BUGFIX: Match exactly to node[:name] if node[name] is an ip address. + +## 0.2.3 + +* BUGFIX: rescue @ssh.close when far end closes disgracefully (ALU ISAM) +* BUGFIX: bugfixes to models +* FEATURE: Alcatel-Lucent ISAM 7302/7330 model added by @jalmargyyk +* FEATURE: Huawei VRP model added by @jalmargyyk +* FEATURE: Ubiquiti AirOS added by @willglyn +* FEATURE: Support 'input' debug in config, ssh/telnet use it to write session log + +## 0.2.2 + +* BUGFIX: mark node as failure if unknown error is raised + +## 0.2.1 + +* BUGFIX: vars variable resolving for main level vars + +## 0.2.0 + +* FEATURE: Force10 model added by @lysiszegerman +* FEATURE: ScreenOS model added by @lysiszegerman +* FEATURE: FabricOS model added by @thakala +* FEATURE: ASA model added by @thakala +* FEATURE: Vyattamodel added by @thakala +* BUGFIX: Oxidized::String convenience methods for models fixed + +## 0.1.1 + +* BUGFIX: vars needs to return value of r, not value of evaluation @@ -1,11 +1,38 @@ -FROM phusion/baseimage:0.9.18 -MAINTAINER Samer Abdel-Hafez <sam@arahant.net> - -RUN add-apt-repository ppa:brightbox/ruby-ng && \ - apt-get update && \ - apt-get install -y ruby2.3 ruby2.3-dev libsqlite3-dev libssl-dev pkg-config make cmake libssh2-1-dev git g++ - -RUN mkdir -p /tmp/oxidized +# -- stage 1: backport libssh2 1.7.0 from zesty for xenial, as githubrepo hook requires it +FROM ubuntu:xenial as libssh2-backport + +# set up dependencies for the build process +RUN apt-get -yq update && \ + apt-get -yq install build-essential chrpath debhelper dh-autoreconf libgcrypt20-dev zlib1g-dev + +# build libssh2 1.7.0 +WORKDIR /tmp/libssh2-build +ADD https://launchpad.net/ubuntu/+archive/primary/+files/libssh2_1.7.0-1ubuntu1.debian.tar.xz . +ADD https://launchpad.net/ubuntu/+archive/primary/+files/libssh2_1.7.0.orig.tar.gz . +RUN tar xvf libssh2_1.7.0.orig.tar.gz +WORKDIR /tmp/libssh2-build/libssh2-1.7.0 +RUN tar xvf ../libssh2_1.7.0-1ubuntu1.debian.tar.xz + +WORKDIR /tmp/libssh2-build/libssh2-1.7.0 +ENV DEB_BUILD_OPTIONS nocheck +RUN dpkg-buildpackage -b + +# -- stage 2: build the actual oxidized container +FROM phusion/baseimage:0.10.0 +LABEL maintainer="Samer Abdel-Hafez <sam@arahant.net>" + +# set up dependencies for the build process +RUN apt-get -yq update && \ + apt-get -yq install ruby2.3 ruby2.3-dev libsqlite3-dev libssl-dev pkg-config make cmake libssh2-1-dev git g++ libffi-dev + +# upgrade libssh2 to self-built backport from stage 1 +COPY --from=libssh2-backport \ + /tmp/libssh2-build/libssh2-1_1.7.0-1ubuntu1_amd64.deb \ + /tmp/libssh2-build/libssh2-1-dev_1.7.0-1ubuntu1_amd64.deb \ + /tmp/ +RUN dpkg -i /tmp/*.deb + +# build and install oxidized COPY . /tmp/oxidized/ WORKDIR /tmp/oxidized @@ -16,15 +43,15 @@ RUN gem install oxidized-*.gem RUN gem install oxidized-web --no-ri --no-rdoc # dependencies for hooks -RUN gem install aws-sdk -RUN gem install slack-api +RUN gem install aws-sdk slack-api xmpp4r +# clean up +WORKDIR / RUN rm -rf /tmp/oxidized +RUN rm /tmp/*.deb +RUN apt-get -yq --purge autoremove ruby-dev pkg-config make cmake -RUN apt-get remove -y ruby-dev pkg-config make cmake - -RUN apt-get -y autoremove - +# add runit services ADD extra/oxidized.runit /etc/service/oxidized/run ADD extra/auto-reload-config.runit /etc/service/auto-reload-config/run ADD extra/update-ca-certificates.runit /etc/service/update-ca-certificates/run diff --git a/Gemfile.lock b/Gemfile.lock index 229a55c..6ee594f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - oxidized (0.20.0) + oxidized (0.21.0) asetus (~> 0.1) net-ssh (~> 3.0.2) net-telnet (~> 0) @@ -1,24 +1,29 @@ # Oxidized [![Build Status](https://travis-ci.org/Shopify/oxidized.svg)](https://travis-ci.org/Shopify/oxidized) [![Gem Version](https://badge.fury.io/rb/oxidized.svg)](http://badge.fury.io/rb/oxidized) [![Join the chat at https://gitter.im/oxidized/Lobby](https://badges.gitter.im/oxidized/Lobby.svg)](https://gitter.im/oxidized/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -> Is your company using Oxidized and has Ruby developers on staff? I'd love help from an extra maintainer! +Oxidized is a network device configuration backup tool. It's a RANCID replacement! -[WANTED: MAINTAINER](#help-needed) +Light and extensible, Oxidized supports over 90 operating system types. -Oxidized is a network device configuration backup tool. It's a RANCID replacement! +Feature highlights: * Automatically adds/removes threads to meet configured retrieval interval -* Restful API to move node immediately to head-of-queue (GET/POST /node/next/[NODE]) -* Syslog udp+file example to catch config change event (ios/junos) and trigger config fetch - * Will signal ios/junos user who made change, which output modules can use (via POST) - * The git output module uses this info - 'git blame' will for each line show who made the change and when +* Restful API to a move node immediately to head-of-queue (GET/POST /node/next/[NODE]) +* Syslog udp+file example to catch config change events (IOS/JunOS) and trigger a config fetch + * Will signal which IOS/JunOS user made the change, can then be used by output modules (via POST) + * The `git` output module uses this info - 'git blame' will show who changed each line, and when * Restful API to reload list of nodes (GET /reload) * Restful API to fetch configurations (/node/fetch/[NODE] or /node/fetch/group/[NODE]) * Restful API to show list of nodes (GET /nodes) * Restful API to show list of version for a node (/node/version[NODE]) and diffs -[Youtube Video: Oxidized TREX 2014 presentation](http://youtu.be/kBQ_CTUuqeU#t=3h) +Check out the [Oxidized TREX 2014 presentation](http://youtu.be/kBQ_CTUuqeU#t=3h) video on YouTube! + +> :warning: [Maintainer Wanted!](#help-needed) :warning: +> +> Is your company using Oxidized and has Ruby developers on staff? I'd love help from an extra maintainer! + +## Index -#### Index 1. [Supported OS Types](docs/Supported-OS-Types.md) 2. [Installation](#installation) * [Debian](#debian) @@ -47,15 +52,18 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen * [Advanced Configuration](docs/Configuration.md#advanced-configuration) * [Advanced Group Configuration](docs/Configuration.md#advanced-group-configuration) * [Hooks](docs/Hooks.md) -5. [Ruby API](docs/Ruby-API.md#ruby-api) +5. [Creating and Extending Models](docs/Creating-Models.md) +6. [Help](#help) +7. [Ruby API](docs/Ruby-API.md#ruby-api) * [Input](docs/Ruby-API.md#input) * [Output](docs/Ruby-API.md#output) * [Source](docs/Ruby-API.md#source) * [Model](docs/Ruby-API.md#model) -# Installation +## Installation + +### Debian -## Debian Install all required packages and gems. ```shell @@ -64,7 +72,8 @@ gem install oxidized gem install oxidized-script oxidized-web # if you don't install oxidized-web, make sure you remove "rest" from your config ``` -## CentOS, Oracle Linux, Red Hat Linux +### CentOS, Oracle Linux, Red Hat Linux + On CentOS 6 / RHEL 6, install Ruby greater than 1.9.3 (for Ruby 2.1.2 installation instructions see [Installing Ruby 2.1.2 using RVM](#installing-ruby-212-using-rvm)), then install Oxidized dependencies ```shell @@ -84,7 +93,8 @@ gem install oxidized gem install oxidized-script oxidized-web ``` -## FreeBSD +### FreeBSD + [Use RVM to install Ruby v2.1.2](#installing-ruby-2.1.2-using-rvm) Install all required packages and gems. @@ -95,7 +105,8 @@ gem install oxidized gem install oxidized-script oxidized-web ``` -## Build from Git +### Build from Git + ```shell git clone https://github.com/ytti/oxidized.git cd oxidized/ @@ -103,38 +114,44 @@ gem build *.gemspec gem install pkg/*.gem ``` -# Running with Docker +### Running with Docker -clone git repo: +Currently, Docker Hub automatically builds the master branch as [oxidized/oxidized](https://hub.docker.com/r/oxidized/oxidized/), you can make use of this container or build your own. -``` +To build your own, clone git repo: + +```shell git clone https://github.com/ytti/oxidized ``` -build container locally: +Then, build the container locally (requires docker 17.05.0-ce or higher): -``` +```shell docker build -q -t oxidized/oxidized:latest oxidized/ ``` -create config directory in main system: +Once you've built the container (or chosen to make use of the automatically built container in Docker Hub, which will be downloaded for you by docker on the first `run` command had you not built it), proceed as follows: -``` +Create a configuration directory in the host system: + +```shell mkdir /etc/oxidized ``` -run container the first time: -_Note: this step in only needed for creating Oxidized's configuration file and can be skipped if you already have it +Run the container for the first time to initialize the config: -``` +_Note: this step in only required for creating the Oxidized configuration file and can be skipped if you already have one._ + +```shell docker run --rm -v /etc/oxidized:/root/.config/oxidized -p 8888:8888/tcp -t oxidized/oxidized:latest oxidized ``` + If the RESTful API and Web Interface are enabled, on the docker host running the container -edit /etc/oxidized/config and modify 'rest: 127.0.0.1:8888' by 'rest: 0.0.0.0:8888' -this will bind port 8888 to all interfaces then expose port out. [Issue #445](https://github.com/ytti/oxidized/issues/445) +edit `/etc/oxidized/config` and modify `rest: 127.0.0.1:8888` to `rest: 0.0.0.0:8888`. This will bind port 8888 to all interfaces, and expose the port so that it could be accessed externally. [(Issue #445)](https://github.com/ytti/oxidized/issues/445) -You can also use docker-compose to launch oxidized container: -``` +Alternatively, you can use docker-compose to launch the oxidized container: + +```yaml # docker-compose.yml # docker-compose file example for oxidized that will start along with docker daemon oxidized: @@ -148,15 +165,15 @@ oxidized: - /etc/oxidized:/root/.config/oxidized ``` -create the `/etc/oxidized/router.db` [See CSV Source for further info](docs/Configuration.md#source-csv) +Create the `/etc/oxidized/router.db` (see [CSV Source](docs/Sources.md#source-csv) for further info): -``` +```shell vim /etc/oxidized/router.db ``` -run container again: +Run container again to start oxidized with your configuration: -``` +```shell docker run -v /etc/oxidized:/root/.config/oxidized -p 8888:8888/tcp -t oxidized/oxidized:latest oxidized[1]: Oxidized starting, running as pid 1 oxidized[1]: Loaded 1 nodes @@ -166,45 +183,49 @@ Puma 2.13.4 starting... * Listening on tcp://0.0.0.0:8888 ``` -If you want to have the config automatically reloaded (e.g. when using a http source that changes) +If you want to have the config automatically reloaded (e.g. when using a http source that changes): -``` +```shell docker run -v /etc/oxidized:/root/.config/oxidized -p 8888:8888/tcp -e CONFIG_RELOAD_INTERVAL=3600 -t oxidized/oxidized:latest ``` -If you need to use an internal CA (e.g. to connect to an private github instance) +If you need to use an internal CA (e.g. to connect to an private github instance): -``` +```shell docker run -v /etc/oxidized:/root/.config/oxidized -v /path/to/MY-CA.crt:/usr/local/share/ca-certificates/MY-CA.crt -p 8888:8888/tcp -e UPDATE_CA_CERTIFICATES=true -t oxidized/oxidized:latest ``` -# Installing Ruby 2.1.2 using RVM +### Installing Ruby 2.1.2 using RVM Install Ruby 2.1.2 build dependencies -``` + +```shell yum install curl gcc-c++ patch readline readline-devel zlib zlib-devel yum install libyaml-devel libffi-devel openssl-devel make cmake yum install bzip2 autoconf automake libtool bison iconv-devel libssh2-devel ``` Install RVM -``` + +```shell curl -L get.rvm.io | bash -s stable ``` Setup RVM environment and compile and install Ruby 2.1.2 and set it as default -``` + +```shell source /etc/profile.d/rvm.sh rvm install 2.1.2 rvm use --default 2.1.2 ``` -# Configuration +## Configuration + Oxidized configuration is in YAML format. Configuration files are subsequently sourced from `/etc/oxidized/config` then `~/.config/oxidized/config`. The hashes will be merged, this might be useful for storing source information in a system wide file and user specific configuration in the home directory (to only include a staff specific username and password). Eg. if many users are using `oxs`, see [Oxidized::Script](https://github.com/ytti/oxidized-script). It is recommended practice to run Oxidized using its own username. This username can be added using standard command-line tools: -``` +```shell useradd oxidized ``` @@ -214,7 +235,7 @@ To initialize a default configuration in your home directory `~/.config/oxidized You can set the env variable `OXIDIZED_HOME` to change its home directory. -``` +```shell OXIDIZED_HOME=/etc/oxidized $ tree -L 1 /etc/oxidized @@ -233,27 +254,25 @@ Oxidized supports [CSV](docs/Configuration.md#source-csv), [SQLite](docs/Config ## Outputs -Possible outputs are either [File](docs/Configuration.md#output-file), [GIT](docs/Configuration.md#output-git), [GIT-Crypt](docs/Configuration.md#output-git-crypt) and [HTT](docs/Configuration.md#output-http). The file backend takes a destination directory as argument and will keep a file per device, with most recent running version of a device. The GIT backend (recommended) will initialize an empty GIT repository in the specified path and create a new commit on every configuration change. The GIT-Crypt backend will also initialize a GIT repository but every configuration push to it will be encrypted on the fly by using `git-crypt` tool. Take a look at the [Configuration](docs/Configuration.md) for more details. +Possible outputs are either [File](docs/Configuration.md#output-file), [GIT](docs/Configuration.md#output-git), [GIT-Crypt](docs/Configuration.md#output-git-crypt) and [HTTP](docs/Configuration.md#output-http). The file backend takes a destination directory as argument and will keep a file per device, with most recent running version of a device. The GIT backend (recommended) will initialize an empty GIT repository in the specified path and create a new commit on every configuration change. The GIT-Crypt backend will also initialize a GIT repository but every configuration push to it will be encrypted on the fly by using `git-crypt` tool. Take a look at the [Configuration](docs/Configuration.md) for more details. Maps define how to map a model's fields to model [model fields](https://github.com/ytti/oxidized/tree/master/lib/oxidized/model). Most of the settings should be self explanatory, log is ignored if `use_syslog`(requires Ruby >= 2.0) is set to `true`. First create the directory where the CSV `output` is going to store device configs and start Oxidized once. -``` + +```shell mkdir -p ~/.config/oxidized/configs oxidized ``` Now tell Oxidized where it finds a list of network devices to backup configuration from. You can either use CSV or SQLite as source. To create a CSV source add the following snippet: -Note: If gpg is set to anything other than false it will attempt to decrypt the file contents -``` +```yaml source: default: csv csv: file: ~/.config/oxidized/router.db delimiter: !ruby/regexp /:/ - gpg: false - gpg_password: 'password' map: name: 0 model: 1 @@ -261,7 +280,7 @@ source: Now lets create a file based device database (you might want to switch to SQLite later on). Put your routers in `~/.config/oxidized/router.db` (file format is compatible with rancid). Simply add an item per line: -``` +```text router01.example.com:ios switch01.example.com:procurve router02.example.com:ios @@ -269,13 +288,13 @@ router02.example.com:ios Run `oxidized` again to take the first backups. -# Extra +## Extra -## Ubuntu SystemV init setup +### Ubuntu SystemV init setup The init script assumes that you have a used named 'oxidized' and that oxidized is in one of the following paths: -``` +```text /sbin /bin /usr/sbin @@ -286,18 +305,26 @@ The init script assumes that you have a used named 'oxidized' and that oxidized 1. Copy init script from extra/ folder to /etc/init.d/oxidized 2. Setup /var/run/ -``` +```shell mkdir /var/run/oxidized chown oxidized:oxidized /var/run/oxidized ``` 3. Make oxidized start on boot -``` +```shell update-rc.d oxidized defaults ``` -# Help Needed +## Help + +If you need help with Oxidized then we have a few methods you can use to get in touch. + +* [Gitter](https://gitter.im/oxidized/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - You can join the Lobby on gitter to chat to other Oxidized users. +* [GitHub](https://github.com/ytti/oxidized/) - For help and requests for code changes / updates. +* [Forum](https://community.librenms.org/c/help/oxidized) - A user forum run by [LibreNMS](https://github.com/librenms/librenms) where you can ask for help and support. + +## Help Needed As things stand right now, `oxidized` is maintained by a single person. A great many [contributors](https://github.com/ytti/oxidized/graphs/contributors) have @@ -332,13 +359,12 @@ Brian Anderson (from Rust fame) wrote an [excellent post](http://brson.github.io/2017/04/05/minimally-nice-maintainer) on what it means to be a maintainer. -# License and Copyright +## License and Copyright Copyright 2013-2015 Saku Ytti <saku@ytti.fi> 2013-2015 Samer Abdel-Hafez <sam@arahant.net> - Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -1,23 +1,29 @@ -# refactor core - * move state from memory to disk, sqlite probably - * allows us to retain stats etc over restart - * simplifies code - * keep only running nodes in memory - * negligible I/O cost, as majority is I/O wait getting config - -# separate login to owon package - * oxidized-script is not only use-case - * it would be good to have minimal package used to login to routers - * oxidized just one consumer of that functionality - * what to do with models, we need model to know how to login. Should models be separated to another package? oxidized-core, oxidized-models and oxidized-login? - * how can we allow interactive login in oxidized-login? With functional VTY etc? REPL loop in input/ssh and input/telnet? - -# thread number - * think about algo - * if job ended later than now-iteration have rand(node.size) == 0 to add thread - * if now is less than job_ended+iteration same chance to remove thread? - * should we try to avoid max threads from being hit? (like maybe non-success thread is pulling average?) - -# docs, testing - * yard docs - * minitest tests +# To Do + +## refactor core + +* move state from memory to disk, sqlite probably +* allows us to retain stats etc over restart +* simplifies code +* keep only running nodes in memory +* negligible I/O cost, as majority is I/O wait getting config + +## separate login to own package + +* oxidized-script is not only use-case +* it would be good to have minimal package used to login to routers +* oxidized just one consumer of that functionality +* what to do with models, we need model to know how to login. Should models be separated to another package? oxidized-core, oxidized-models and oxidized-login? +* how can we allow interactive login in oxidized-login? With functional VTY etc? REPL loop in input/ssh and input/telnet? + +## thread number + +* think about algo +* if job ended later than now-iteration have rand(node.size) == 0 to add thread +* if now is less than job_ended+iteration same chance to remove thread? +* should we try to avoid max threads from being hit? (like maybe non-success thread is pulling average?) + +## docs, testing + +* yard docs +* minitest tests diff --git a/docs/Configuration.md b/docs/Configuration.md index df0caa4..6bbbb61 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -1,10 +1,12 @@ -## Configuration -### Debugging +# Configuration + +## Debugging + In case a model plugin doesn't work correctly (ios, procurve, etc.), you can enable live debugging of SSH/Telnet sessions. Just add a `debug` option containing the value true to the `input` section. The log files will be created depending on the parent directory of the logfile option. The following example will log an active ssh/telnet session `/home/oxidized/.config/oxidized/log/<IP-Adress>-<PROTOCOL>`. The file will be truncated on each consecutive ssh/telnet session, so you need to put a `tailf` or `tail -f` on that file! -``` +```yaml log: /home/oxidized/.config/oxidized/log ... @@ -16,20 +18,20 @@ input: secure: false ``` -### Privileged mode +## Privileged mode To start privileged mode before pulling the configuration, Oxidized needs to send the enable command. You can globally enable this, by adding the following snippet to the global section of the configuration file. -``` +```yaml vars: enable: S3cre7 ``` -### Removing secrets +## Removing secrets To strip out secrets from configurations before storing them, Oxidized needs the the remove_secrets flag. You can globally enable this by adding the following snippet to the global sections of the configuration file. -``` +```yaml vars: remove_secret: true ``` @@ -38,32 +40,33 @@ Device models can contain substitution filters to remove potentially sensitive d As a partial example from ios.rb: -``` +```yaml cmd :secret do |cfg| cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>' (...) cfg end ``` + 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 +## 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` +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. -``` +```yaml vars: ssh_no_exec: true ``` -### SSH Proxy Command +## SSH Proxy Command Oxidized can `ssh` through a proxy as well. To do so we just need to set `ssh_proxy` variable. -``` +```yaml ... map: name: 0 @@ -74,16 +77,26 @@ vars_map: ... ``` -### Advanced Configuration +## FTP Passive Mode -Below is an advanced example configuration. You will be able to (optionally) override options per device. The router.db format used is `hostname:model:username:password:enable_password`. Hostname and model will be the only required options, all others override the global configuration sections. +Oxidized uses ftp passive mode by default. Some devices require passive mode to be disabled. To do so, we can set `input.ftp.passive` to false +```yaml +input: + ftp: + passive: false ``` + +## Advanced Configuration + +Below is an advanced example configuration. You will be able to (optionally) override options per device. The router.db format used is `hostname:model:username:password:enable_password`. Hostname and model will be the only required options, all others override the global configuration sections. + +```yaml --- username: oxidized password: S3cr3tx model: junos -interval: 3600 +interval: 3600 #interval in seconds log: ~/.config/oxidized/log debug: false threads: 30 @@ -121,14 +134,13 @@ source: model_map: cisco: ios juniper: junos - ``` -### Advanced Group Configuration +## Advanced Group Configuration For group specific credentials -``` +```yaml groups: mikrotik: username: admin @@ -137,16 +149,19 @@ groups: username: ubnt password: ubnt ``` + and add group mapping -``` + +```yaml map: model: 0 name: 1 group: 2 ``` + For model specific credentials -``` +```yaml models: junos: username: admin @@ -161,26 +176,26 @@ models: password: password ``` -### RESTful API and Web Interface +## RESTful API and Web Interface The RESTful API and Web Interface is enabled by configuring the `rest:` parameter in the config file. This parameter can optionally contain a relative URI. -``` +```yaml # Listen on http://127.0.0.1:8888/ rest: 127.0.0.1:8888 ``` -``` +```yaml # Listen on http://10.0.0.1:8000/oxidized/ rest: 10.0.0.1:8000/oxidized ``` -### Triggered backups +## Triggered backups A node can be moved to head-of-queue via the REST API `GET/POST /node/next/[NODE]`. In the default configuration this node will be processed when the next job worker becomes available, it could take some time if existing backups are in progress. To execute moved jobs immediately a new job can be added: -``` +```yaml next_adds_job: true ``` diff --git a/docs/Creating-Models.md b/docs/Creating-Models.md new file mode 100644 index 0000000..d7a8155 --- /dev/null +++ b/docs/Creating-Models.md @@ -0,0 +1,73 @@ +# Creating and Extending Models + +Oxidized supports a growing list of [operating system types](Supported-OS-Types.md). Out of the box, most model implementations collect configuration data. Some implementations also include a conservative set of additional commands that collect basic device information (device make and model, software version, licensing information, ...) which are appended to the configuration as comments. + +A user may wish to extend an existing model to collect the output of additional commands. Oxidized offers smart loading of models in order to facilitate this with ease, without the need to introduce changes to the upstream source code. + +## Extending an existing model with a new command + +The example below can be used to extend the `JunOS` model to collect the output of `show interfaces diagnostics optics` and append the output to the configuration file as a comment. This command retrieves DOM information on pluggable optics present in a `JunOS`-powered chassis. + +Create the file `~/.config/oxidized/model/junos.rb` with the following contents: + +```ruby +require 'oxidized/model/junos.rb' + + +class JunOS + + + cmd 'show interfaces diagnostics optics' do |cfg| + comment cfg + end + + +end +``` + +Due to smart loading, the user-supplied `~/.config/oxidized/model/junos.rb` file will take precedence over the model with the same name included in Oxidized. The code then uses `require` to load the included model, and extends the class defined therein with an additional command. + +Intuitively, it is also possible to: + +* Completely re-define an existing model by creating a file in `~/.config/oxidized/model/` with the same name as an existing model, but not `require`-ing the upstream model file. +* Create a named variation of an existing model, by creating a file with a new name (such as `~/.config/oxidized/model/junos-extra.rb`), Then `require` the original model and extend its base class as in the above example. The named variation can then be specified as an OS type for some devices but not others when defining sources. +* Create a completely new model, with a new name, for a new operating system type. + +## Advanced features + +The loosely-coupled architecture of Oxidized allows for easy extensibility in more advanced use cases as well. + +The example below extends the functionality of the `JunOS` model further to collect `display set` formatted configuration from the device, and utilizes the multi-output functionality of the `git` output to place the returned configuration in a separate file within a git repository. + +It is possible to configure the `git` output to create new subdirectories under an existing repository instead of creating new repositories for each new defined output type (the default) by including the following configuration in the `~/.config/oxidized/config` file: + +```yaml +output: + git: + type_as_directory: true +``` + +Then, `~/.config/oxidized/model/junos.rb` is adapted as following: + +```ruby +require 'oxidized/model/junos.rb' + + +class JunOS + + + cmd 'show interface diagnostic optics' do |cfg| + comment cfg + end + + cmd 'show configuration | display set' do |cfg| + cfg.type = "junos-set" + cfg.name = "set" + cfg + end + + +end +``` + +The output of the `show configuration | display set` command is marked with a new arbitrary alternative output type, `junos-set`. The `git` output will use the output type to create a new subdirectory by the same name. In this subdirectory, the `git` output will create files with the name `<devicename>--set` that will contain the output of this command for each device.
\ No newline at end of file diff --git a/docs/Hooks.md b/docs/Hooks.md index 12e3ab7..8a0a8b9 100644 --- a/docs/Hooks.md +++ b/docs/Hooks.md @@ -1,31 +1,37 @@ # Hooks + You can define arbitrary number of hooks that subscribe different events. The hook system is modular and different kind of hook types can be enabled. ## Configuration + Following configuration keys need to be defined for all hooks: - * `events`: which events to subscribe. Needs to be an array. See below for the list of available events. - * `type`: what hook class to use. See below for the list of available hook types. +* `events`: which events to subscribe. Needs to be an array. See below for the list of available events. +* `type`: what hook class to use. See below for the list of available hook types. ### Events - * `node_success`: triggered when configuration is succesfully pulled from a node and right before storing the configuration. - * `node_fail`: triggered after `retries` amount of failed node pulls. - * `post_store`: triggered after node configuration is stored (this is executed only when the configuration has changed). - * `nodes_done`: triggered after finished fetching all nodes. + +* `node_success`: triggered when configuration is successfully pulled from a node and right before storing the configuration. +* `node_fail`: triggered after `retries` amount of failed node pulls. +* `post_store`: triggered after node configuration is stored (this is executed only when the configuration has changed). +* `nodes_done`: triggered after finished fetching all nodes. ## Hook type: exec + The `exec` hook type allows users to run an arbitrary shell command or a binary when triggered. The command is executed on a separate child process either in synchronous or asynchronous fashion. Non-zero exit values cause errors to be logged. STDOUT and STDERR are currently not collected. Command is executed with the following environment: -``` + +```text OX_EVENT OX_NODE_NAME OX_NODE_IP OX_NODE_FROM OX_NODE_MSG OX_NODE_GROUP +OX_NODE_MODEL OX_JOB_STATUS OX_JOB_TIME OX_REPO_COMMITREF @@ -34,13 +40,13 @@ OX_REPO_NAME Exec hook recognizes following configuration keys: - * `timeout`: hard timeout for the command execution. SIGTERM will be sent to the child process after the timeout has elapsed. Default: 60 - * `async`: influences whether main thread will wait for the command execution. Set this true for long running commands so node pull is not blocked. Default: false - * `cmd`: command to run. +* `timeout`: hard timeout for the command execution. SIGTERM will be sent to the child process after the timeout has elapsed. Default: 60 +* `async`: influences whether main thread will wait for the command execution. Set this true for long running commands so node pull is not blocked. Default: false +* `cmd`: command to run. +## exec hook configuration example -## Hook configuration example -``` +```yaml hooks: name_for_example_hook1: type: exec @@ -54,21 +60,23 @@ hooks: timeout: 120 ``` -### githubrepo +### Hook type: githubrepo -This hook configures the repository `remote` and _push_ the code when the specified event is triggerd. If the `username` and `password` are not provided, the `Rugged::Credentials::SshKeyFromAgent` will be used. +This hook configures the repository `remote` and _push_ the code when the specified event is triggered. If the `username` and `password` are not provided, the `Rugged::Credentials::SshKeyFromAgent` will be used. `githubrepo` hook recognizes following configuration keys: - * `remote_repo`: the remote repository to be pushed to. - * `username`: username for repository auth. - * `password`: password for repository auth. - * `publickey`: publickey for repository auth. - * `privatekey`: privatekey for repository auth. +* `remote_repo`: the remote repository to be pushed to. +* `username`: username for repository auth. +* `password`: password for repository auth. +* `publickey`: publickey for repository auth. +* `privatekey`: privatekey for repository auth. + +It is also possible to set the environment variable `OXIDIZED_SSH_PASSPHRASE` to a passphrase if your keypair requires it. When using groups repositories, each group must have its own `remote` in the `remote_repo` config. -``` yaml +```yaml hooks: push_to_remote: remote_repo: @@ -77,10 +85,9 @@ hooks: firewalls: git@git.intranet:oxidized/firewalls.git ``` +## githubrepo hook configuration example -## Hook configuration example - -``` yaml +```yaml hooks: push_to_remote: type: githubrepo @@ -96,14 +103,14 @@ The `awssns` hook publishes messages to AWS SNS topics. This allows you to notif Fields sent in the message: - * `event`: Event type (e.g. `node_success`) - * `group`: Group name - * `model`: Model name (e.g. `eos`) - * `node`: Device hostname +* `event`: Event type (e.g. `node_success`) +* `group`: Group name +* `model`: Model name (e.g. `eos`) +* `node`: Device hostname -Configuration example: +## awssns hook configuration example -``` yaml +```yaml hooks: hook_script: type: awssns @@ -114,8 +121,8 @@ hooks: AWS SNS hook requires the following configuration keys: - * `region`: AWS Region name - * `topic_arn`: ASN Topic reference +* `region`: AWS Region name +* `topic_arn`: ASN Topic reference Your AWS credentials should be stored in `~/.aws/credentials`. @@ -125,13 +132,13 @@ The `slackdiff` hook posts colorized config diffs to a [Slack](http://www.slack. You will need to manually install the `slack-api` gem on your system: -``` +```shell gem install slack-api ``` -Configuration example: +## slackdiff hook configuration example -``` yaml +```yaml hooks: slack: type: slackdiff @@ -140,4 +147,42 @@ hooks: channel: "#network-changes" ``` +Optionally you can disable snippets and post a formatted message, for instance linking to a commit in a git repo. Named parameters `%{node}`, `%{group}`, `%{model}` and `%{commitref}` are available. + +```yaml +hooks: + slack: + type: slackdiff + events: [post_store] + token: SLACK_BOT_TOKEN + channel: "#network-changes" + diff: false + message: "%{node} %{group} %{model} updated https://git.intranet/network-changes/commit/%{commitref}" +``` + +Note the channel name must be in quotes. + +## Hook type: xmppdiff + +The `xmppdiff` hook posts config diffs to a [XMPP](https://en.wikipedia.org/wiki/XMPP) chatroom of your choice. It only triggers for `post_store` events. + +You will need to manually install the `xmpp4r` gem on your system: + +```shell +gem install xmpp4r +``` + +## xmppdiff hook configuration example + +```yaml +hooks: + xmpp: + type: xmppdiff + events: [post_store] + jid: "user@server.tld/resource" + password: "password" + channel: "room@server.tld" + nick: "nickname" +``` + Note the channel name must be in quotes. diff --git a/docs/Model-Notes/AireOS.md b/docs/Model-Notes/AireOS.md new file mode 100644 index 0000000..5674ae2 --- /dev/null +++ b/docs/Model-Notes/AireOS.md @@ -0,0 +1,12 @@ +Cisco WLC Configuration +======================= + +Create a user with read-write privilege: + +```text +mgmtuser add oxidized **** read-write +``` + +Oxidized needs read-write privilege in order to execute 'config paging disable'. + +Back to [Model-Notes](README.md) diff --git a/docs/Model-Notes/ArbOS.md b/docs/Model-Notes/ArbOS.md new file mode 100644 index 0000000..f68467f --- /dev/null +++ b/docs/Model-Notes/ArbOS.md @@ -0,0 +1,10 @@ +Arbor Networks ArbOS notes +========================== + +If you are running ArbOS version 7 or lower then you may need to update the model to remove `exec true`: + +```ruby + cfg :ssh do + pre_logout 'exit' + end +``` diff --git a/docs/Model-Notes/Comware.md b/docs/Model-Notes/Comware.md new file mode 100644 index 0000000..e7a2198 --- /dev/null +++ b/docs/Model-Notes/Comware.md @@ -0,0 +1,12 @@ +Comware Configuration +===================== + +If you find 3Com Comware devices aren't being backed up this may be due to prompt detection not matching because a previous login message is disabled after the first prompt. + +You can disable this on the devices themselves by running this command: + +```text +info-center source default channel 1 log state off debug state off +``` + +[Reference](https://github.com/ytti/oxidized/issues/1171) diff --git a/docs/Model-Notes/JunOS.md b/docs/Model-Notes/JunOS.md new file mode 100644 index 0000000..8093df0 --- /dev/null +++ b/docs/Model-Notes/JunOS.md @@ -0,0 +1,34 @@ +JunOS Configuration +=================== + +Create login class cfg-view + +```text +set system login class cfg-view permissions view-configuration +set system login class cfg-view allow-commands "(show)|(set cli screen-length)|(set cli screen-width)" +set system login class cfg-view deny-commands "(clear)|(file)|(file show)|(help)|(load)|(monitor)|(op)|(request)|(save)|(set)|(start)|(test)" +set system login class cfg-view deny-configuration all +``` + +Create a user with cfg-view class + +```text +set system login user oxidized class cfg-view +set system login user oxidized authentication plain-text-password "verysecret" +``` + +The commands Oxidized executes are: + +1. set cli screen-length 0 +2. set cli screen-width 0 +3. show configuration +4. show version +5. show chassis hardware +6. show system license +7. show system license keys (ex22|ex33|ex4|ex8|qfx only) +8. show virtual-chassis (MX960 only) +9. show chassis fabric reachability + +Oxidized can now retrieve your configuration! + +Back to [Model-Notes](README.md) diff --git a/docs/Model-Notes/README.md b/docs/Model-Notes/README.md new file mode 100644 index 0000000..c4b0ed1 --- /dev/null +++ b/docs/Model-Notes/README.md @@ -0,0 +1,17 @@ +Model Notes +=========== + +This directory contains implementation notes and caveats to assist you in your oxidized deployment. + +Use the table below for more information on the Vendor/Model caveats. + +Vendor | Model |Updated +----------------|-----------------|---------------- +3COM|[Comware](Comware.md)|15 Feb 2018 +AireOS|[AireOS](AireOS.md)|29 Nov 2017 +Arbor Networks|[ArbOS](ArbOS.md)|27 Feb 2018 +Huawei|[VRP](VRP-Huawei.md)|17 Nov 2017 +Juniper|[MX/QFX/EX/SRX/J Series](JunOS.md)|18 Jan 2018 +Zyxel|[XGS4600 Series](XGS4600-Zyxel.md)|23 Jan 2018 + +If you discover additional caveats or problems please make sure to consult the [GitHub issues for oxidized](https://github.com/ytti/oxidized/issues) known issues. diff --git a/docs/VRP-Huawei.md b/docs/Model-Notes/VRP-Huawei.md index 9e97b7d..ff5426e 100644 --- a/docs/VRP-Huawei.md +++ b/docs/Model-Notes/VRP-Huawei.md @@ -3,12 +3,14 @@ Huawei VRP Configuration Create a user with no privileges +```text <HUAWEI> system-view [~HUAWEI] aaa [~HUAWEI-aaa] local-user oxidized password irreversible-cipher verysecret [*HUAWEI-aaa] local-user oxidized level 1 [*HUAWEI-aaa] local-user oxidized service-type terminal ssh [*HUAWEI-aaa] commit +``` The commands Oxidized executes are: @@ -17,11 +19,17 @@ The commands Oxidized executes are: 3. display device 4. display current-configuration all -Command 2 and 3 can be executed without issues, but 1 and 4 are only available for higher level users. Instead of making Oxidized a read/write user on your device, lower the priviledge-level for commands 1 and 4: +Command 2 and 3 can be executed without issues, but 1 and 4 are only available for higher level users. Instead of making Oxidized a read/write user on your device, lower the privilege-level for commands 1 and 4: +```text <HUAWEI> system-view [~HUAWEI] command-privilege level 1 view global display current-configuration all [*HUAWEI] command-privilege level 1 view shell screen-length [*HUAWEI] commit +``` -Oxidized can now retrieve your configuration!
\ No newline at end of file +Oxidized can now retrieve your configuration! + +Caveat: Some versions of VRP default to appending a timestamp prior to the output of each `display` command, which will lead to superfluous updates. The configuration statement `timestamp disable` can be used to disable this functionality. (Issue #1218) + +Back to [Model-Notes](README.md) diff --git a/docs/Model-Notes/XGS4600-Zyxel.md b/docs/Model-Notes/XGS4600-Zyxel.md new file mode 100644 index 0000000..17cb2b5 --- /dev/null +++ b/docs/Model-Notes/XGS4600-Zyxel.md @@ -0,0 +1,25 @@ +ZynOS Configuration +=================== + +## FTP + +FTP access is only possible as admin, other users can login but cannot pull the files. +For the XGS4600 series the config file is _config_ and not _config-0_ + +The following line in _oxidized/lib/oxidized/model/zynos.rb_ will need changing + +```text + cmd 'config-0' +``` + +The inclusion of an extra ftp option is also require. Within _input_ add the following + +```yaml +input: + ftp: + passive: false +``` + +Oxidized can now retrieve your configuration! + +Back to [Model-Notes](README.md) diff --git a/docs/Outputs.md b/docs/Outputs.md index e3bd42d..92c672c 100644 --- a/docs/Outputs.md +++ b/docs/Outputs.md @@ -1,23 +1,22 @@ +# Outputs -## Output - -### Output: File +## Output: File Parent directory needs to be created manually, one file per device, with most recent running config. -``` +```yaml output: file: directory: /var/lib/oxidized/configs ``` -### Output: Git +## Output: Git This uses the rugged/libgit2 interface. So you should remember that normal Git hooks will not be executed. For a single repositories for all devices: -``` yaml +```yaml output: default: git git: @@ -28,7 +27,7 @@ output: And for groups repositories: -``` yaml +```yaml output: default: git git: @@ -40,14 +39,14 @@ output: Oxidized will create a repository for each group in the same directory as the `default.git`. For example: -``` csv +```csv host1:ios:first host2:nxos:second ``` This will generate the following repositories: -``` bash +```bash $ ls /var/lib/oxidized/git-repos default.git first.git second.git @@ -55,7 +54,7 @@ default.git first.git second.git If you would like to use groups and a single repository, you can force this with the `single_repo` config. -``` yaml +```yaml output: default: git git: @@ -64,15 +63,14 @@ output: ``` -### Output: Git-Crypt +## Output: Git-Crypt This uses the gem git and system git-crypt interfaces. Have a look at [GIT-Crypt](https://www.agwa.name/projects/git-crypt/) documentation to know how to install it. Additionally to user and email informations, you have to provide the users ID that can be a key ID, a full fingerprint, an email address, or anything else that uniquely identifies a public key to GPG (see "HOW TO SPECIFY A USER ID" in the gpg man page). - For a single repositories for all devices: -``` yaml +```yaml output: default: gitcrypt gitcrypt: @@ -86,7 +84,7 @@ output: And for groups repositories: -``` yaml +```yaml output: default: gitcrypt gitcrypt: @@ -101,14 +99,14 @@ output: Oxidized will create a repository for each group in the same directory as the `default`. For example: -``` csv +```csv host1:ios:first host2:nxos:second ``` This will generate the following repositories: -``` bash +```bash $ ls /var/lib/oxidized/git-repos default.git first.git second.git @@ -116,7 +114,7 @@ default.git first.git second.git If you would like to use groups and a single repository, you can force this with the `single_repo` config. -``` yaml +```yaml output: default: gitcrypt gitcrypt: @@ -130,11 +128,11 @@ output: Please note that user list is only updated once at creation. -### Output: Http +## Output: Http POST a config to the specified URL -``` +```yaml output: default: http http: @@ -143,13 +141,13 @@ output: url: "http://192.168.162.50:8080/db/coll" ``` -### Output types +## Output types If you prefer to have different outputs in different files and/or directories, you can easily do this by modifying the corresponding model. To change the behaviour for IOS, you would edit `lib/oxidized/model/ios.rb` (run `gem contents oxidized` to find out the full file path). For example, let's say you want to split out `show version` and `show inventory` into separate files in a directory called `nodiff` which your tools will not send automated diffstats for. You can apply a patch along the lines of -``` +```text - cmd 'show version' do |cfg| - comment cfg.lines.first + cmd 'show version' do |state| @@ -183,7 +181,7 @@ For example, let's say you want to split out `show version` and `show inventory` which will result in the following layout -``` +```text diff/$FQDN--show_running_config nodiff/$FQDN--show_version nodiff/$FQDN--show_inventory diff --git a/docs/Ruby-API.md b/docs/Ruby-API.md index 2dbc10e..8621870 100644 --- a/docs/Ruby-API.md +++ b/docs/Ruby-API.md @@ -3,33 +3,39 @@ The following objects exist in Oxidized. ## Input - * gets config from nodes - * must implement 'connect', 'get', 'cmd' - * 'ssh', 'telnet, ftp, and tftp' implemented + +* gets config from nodes +* must implement 'connect', 'get', 'cmd' +* 'ssh', 'telnet, ftp, and tftp' implemented ## Output - * stores config - * must implement 'store' (may implement 'fetch') - * 'git' and 'file' (store as flat ascii) implemented + +* stores config +* must implement 'store' (may implement 'fetch') +* 'git' and 'file' (store as flat ascii) implemented ## Source - * gets list of nodes to poll - * must implement 'load' - * source can have 'name', 'model', 'group', 'username', 'password', 'input', 'output', 'prompt' - * name - name of the devices - * model - model to use ios/junos/xyz, model is loaded dynamically when needed (Also default in config file) - * input - method to acquire config, loaded dynamically as needed (Also default in config file) - * output - method to store config, loaded dynamically as needed (Also default in config file) - * prompt - prompt used for node (Also default in config file, can be specified in model too) - * 'sql', 'csv' and 'http' (supports any format with single entry per line, like router.db) + +* gets list of nodes to poll +* must implement 'load' +* source can have 'name', 'model', 'group', 'username', 'password', 'input', 'output', 'prompt' + * name - name of the devices + * model - model to use ios/junos/xyz, model is loaded dynamically when needed (Also default in config file) + * input - method to acquire config, loaded dynamically as needed (Also default in config file) + * output - method to store config, loaded dynamically as needed (Also default in config file) + * prompt - prompt used for node (Also default in config file, can be specified in model too) +* 'sql', 'csv' and 'http' (supports any format with single entry per line, like router.db) ## Model + ### At the top level + A model may use several methods at the top level in the class. `cfg` is executed in input/output/source context. `cmd` is executed within an instance of the model. #### `cfg` + `cfg` may be called with a list of methods (`:ssh`, `:telnet`) and a block with zero parameters. Calling `cfg` registers the given access methods and calling it at least once is required for a model to work. @@ -38,6 +44,7 @@ The block may contain commands to change some behaviour for the given methods (e.g. calling `post_login` to disable the pager). #### `cmd` + Is used to specify commands that should be executed on a model in order to gather its configuration. It can be called with: @@ -69,18 +76,21 @@ Execution order is `:all`, `:secret`, and lastly the command specific block, if given. #### `comment` + Called with a single string containing the string to prepend for comments in emitted configuration for this model. If not specified the default of `'# '` will be used (note the trailing space). #### `prompt` + Is called with a regular expression that is used to detect when command output ends after a command has been executed. If not specified, a default of `/^([\w.@-]+[#>]\s?)$/` is used. #### `expect` + Called with a regular expression and a block. The block takes two parameters: the regular expression, and the data containing the match. @@ -90,26 +100,32 @@ The passed data is replaced by the return value of the block. it's further processed. ### At the second level + The following methods are available: #### `comment` + Used inside `cmd` invocations. Comments out every line in the passed string and returns the result. #### `password` + Used inside `cfg` invocations to specify the regular expression used to detect the password prompt. If not specified, the default of `/^Password/` is used. #### `post_login` + Used inside `cfg` invocations to specify commands to run once Oxidized has logged in to the switch. Takes one argument that is either a block (taking zero parameters) or a string containing a command to execute. #### `pre_logout` + Used to specify commands to run before Oxidized closes the connection to the switch. Takes one argument that is either a block (taking zero parameters) or a string containing a command to execute. #### `send` + Usually used inside `expect` or blocks passed to `post_login`/`pre_logout`. Takes a single parameter: a string to be sent to the switch. diff --git a/docs/Sources.md b/docs/Sources.md index 4121c89..6d8e19e 100644 --- a/docs/Sources.md +++ b/docs/Sources.md @@ -1,10 +1,10 @@ -## Source +# Sources -### Source: CSV +## Source: CSV -One line per device, colon seperated. If `ip` isn't present, a DNS lookup will be done against `name`. For large installations, setting `ip` will dramatically reduce startup time. +One line per device, colon separated. If `ip` isn't present, a DNS lookup will be done against `name`. For large installations, setting `ip` will dramatically reduce startup time. -``` +```yaml source: default: csv csv: @@ -22,19 +22,50 @@ source: Example csv `/var/lib/oxidized/router.db`: +```text +rtr01.local:192.168.1.1:ios:oxidized:5uP3R53cR3T:T0p53cR3t ``` -rtr01.local,192.168.1.1,ios,oxidized,5uP3R53cR3T,T0p53cR3t + +If you would like to use a GPG encrypted file as the source then you can use the following example: + +```yaml +source: + default: csv + csv: + file: ~/.config/oxidized/router.db + delimiter: !ruby/regexp /:/ + gpg: true + gpg_password: 'password' + map: + name: 0 + model: 1 ``` -### Source: SQL +Please note, if you are running GPG v2 then you will be prompted for your gpg password on start up, if you use GPG >= 2.1 then you can add the following config to stop that behaviour: + +Within `~/.gnupg/gpg-agent.conf` + +```text +allow-loopback-pinentry +``` + +and within: `~/.gnupg/gpg.conf` + +```text +pinentry-mode loopback +``` + +## Source: SQL + Oxidized uses the `sequel` ruby gem. You can use a variety of databases that aren't explicitly listed. For more information visit https://github.com/jeremyevans/sequel Make sure you have the correct adapter! -### Source: MYSQL + +## Source: MYSQL `sudo apt-get install libmysqlclient-dev` The values correspond to your fields in the DB such that ip, model, etc are field names in the DB -``` +```yaml source: default: sql sql: @@ -52,17 +83,17 @@ source: enable: enable ``` -### Source: SQLite +## Source: SQLite One row per device, filtered by hostname. -``` +```yaml source: default: sql sql: adapter: sqlite - database: "/var/lib/oxidized/devices.db" - table: devices + database: "/var/lib/oxidized/nodes.db" + table: nodes map: name: fqdn model: model @@ -72,13 +103,41 @@ source: enable: enable ``` -### Source: HTTP +## Custom SQL Query Support + +You may also implement a custom SQL query to retrieve the nodelist using SQL syntax with the `query:` configuration parameter under the `sql:` stanza. + +### Custom SQL Query Examples + +You may have a table named `nodes` which contains a boolean to indicate if the nodes should be enabled (fetched via oxidized). This can be used in the custom SQL query to avoid fetching from known impacted nodes. + +In your configuration, you would add the `query:` parameter and specify the SQL query. Make sure to put this within the `sql:` configuration section. + +```sql +query: "SELECT * FROM nodes WHERE enabled = True" +``` + +Since this is an SQL query, you can also provide a more advanced query to assist in more complicated oxidized deployments. The exact deployment is up to you on how you design your database and oxidized fetchers. + +In this example we limit the nodes to two "POPs" of `mypop1` and `mypop2`. We also require the nodes to have the `enabled` boolean set to `True`. + +```sql +query: "SELECT * FROM nodes WHERE pop IN ('mypop1','mypop2') AND enabled = True" +``` + +The order of the nodes returned will influence the order that nodes are fetched by oxidized. You can use standard SQL `ORDER BY` clauses to influence the node order. + +You should always test your SQL query before using it in the oxidized configuration as there is no syntax or error checking performed before sending it to the database engine. + +Consult your database documentation for more information on query language and table optimization. + +## Source: HTTP One object per device. HTTP Supports basic auth, configure the user and pass you want to use under the http: section. -``` +```yaml source: default: http http: @@ -100,11 +159,11 @@ source: You can also pass `secure: false` if you want to disable ssl certificate verification: -``` +```yaml source: default: http http: url: https://url/api scheme: https secure: false -```
\ No newline at end of file +``` diff --git a/docs/Supported-OS-Types.md b/docs/Supported-OS-Types.md index e600040..1717284 100644 --- a/docs/Supported-OS-Types.md +++ b/docs/Supported-OS-Types.md @@ -1,149 +1,163 @@ # Supported OS types - * Vendor - * OS model - * A10 Networks - * [ACOS](lib/oxidized/model/acos.rb) - * Accedian Performance Elements (NIDs) - * [AEN](lib/oxidized/model/aen.rb) - * Alcatel-Lucent - * [AOS](lib/oxidized/model/aos.rb) - * [AOS7](lib/oxidized/model/aos7.rb) - * [ISAM](lib/oxidized/model/isam.rb) - * [SR OS (Formerly TiMOS)](lib/oxidized/model/timos.rb) - * Wireless - * Alvarion - * [BreezeACCESS](lib/oxidized/model/alvarion.rb) - * APC - * [AOS](lib/oxidized/model/apc_aos.rb) - * Arista - * [EOS](lib/oxidized/model/eos.rb) - * Arris - * [C4CMTS](lib/oxidized/model/c4cmts.rb) - * Aruba - * [AOSW](lib/oxidized/model/aosw.rb) - * AudioCodes - * [AudioCodes](lib/oxdized/model/audiocodes.rb) - * Avaya - * [VOSS (VSP Operating System Software)](lib/oxidized/model/voss.rb) - * [BOSS (Baystack Operating System Software)](lib/oxidized/model/boss.rb) - * Brocade - * [FabricOS](lib/oxidized/model/fabricos.rb) - * [Ironware](lib/oxidized/model/ironware.rb) - * [NOS (Network Operating System)](lib/oxidized/model/nos.rb) - * [Vyatta](lib/oxidized/model/vyatta.rb) - * [6910](lib/oxidized/model/br6910.rb) - * Casa - * [Casa](lib/oxidized/model/casa.rb) - * Check Point - * [GaiaOS](lib/oxidized/model/gaiaos.rb) - * Ciena - * [SAOS](lib/oxidized/model/saos.rb) - * Cisco - * [ACSW](lib/oxidized/model/acsw.rb) - * [AireOS](lib/oxidized/model/aireos.rb) - * [ASA](lib/oxidized/model/asa.rb) - * [AsyncOS](lib/oxidized/model/asyncos.rb) - * [CatOS](lib/oxidized/model/catos.rb) - * [IOS](lib/oxidized/model/ios.rb) - * [IOSXR](lib/oxidized/model/iosxr.rb) - * [NGA](lib/oxidized/model/cisconga.rb) - * [NXOS](lib/oxidized/model/nxos.rb) - * [SMA](lib/oxidized/model/ciscosma.rb) - * [SMB (Nikola series)](lib/oxidized/model/ciscosmb.rb) - * [UCS](lib/oxidized/model/ucs.rb) - * Citrix - * [NetScaler (Virtual Applicance)](lib/oxidized/model/netscaler.rb) - * Coriant (former Tellabs) - * [TMOS (8800)](lib/oxidized/model/corianttmos.rb) - * [8600](lib/oxidized/model/coriant8600.rb) - * [Groove](lib/oxidized/model/coriantgroove.rb) - * Cumulus - * [Linux](lib/oxidized/model/cumulus.rb) - * DataCom - * [DmSwitch 3000](lib/oxidized/model/datacom.rb) - * DCN - * [DCN](lib/oxidized/model/ios.rb) - Map this to ios. - * DELL - * [PowerConnect](lib/oxidized/model/powerconnect.rb) - * [AOSW](lib/oxidized/model/aosw.rb) - * D-Link - * [D-Link](lib/oxidized/model/dlink.rb) - * Ericsson/Redback - * [IPOS (former SEOS)](lib/oxidized/model/ipos.rb) - * Extreme Networks - * [Enterasys](/lib/oxidized/model/enterasys.rb) - * [WM](lib/oxidized/model/mtrlrfs.rb) - * [XOS](lib/oxidized/model/xos.rb) - * F5 - * [TMOS](lib/oxidized/model/tmos.rb) - * Force10 - * [DNOS](lib/oxidized/model/dnos.rb) - * [FTOS](lib/oxidized/model/ftos.rb) - * FortiGate - * [FortiOS](lib/oxidized/model/fortios.rb) - * Fujitsu - * [PRIMERGY Blade switch 1/10Gbe](lib/oxidized/model/fujitsupy.rb) - * Hatteras - * [Hatteras](lib/oxidized/model/hatteras.rb) - * Hirschmann - * [HiOS](lib/oxidized/model/hirschmann.rb) - * HP - * [Comware (HP A-series, H3C, 3Com)](lib/oxidized/model/comware.rb) - * [Procurve](lib/oxidized/model/procurve.rb) - * [BladeSystem (Onboard Administrator)](lib/oxidized/model/hpebladesystem.rb) - * [MSA](lib/oxidized/model/hpemsa.rb) - * Huawei - * [VRP](lib/oxidized/model/vrp.rb) - * Juniper - * [JunOS](lib/oxidized/model/junos.rb) - * [ScreenOS (Netscreen)](lib/oxidized/model/screenos.rb) - * Mellanox - * [MLNX-OS](lib/oxidized/model/mlnxos.rb) - * [Voltaire](lib/oxidized/model/voltaire.rb) - * Mikrotik - * [RouterOS](lib/oxidized/model/routeros.rb) - * Motorola - * [RFS](lib/oxidized/model/mtrlrfs.rb) - * MRV - * [MasterOS](lib/oxidized/model/masteros.rb) - * [FiberDriver](lib/oxidized/model/fiberdriver.rb) - * Netgear - * [Netgear](lib/oxidized/model/netgear.rb) - * Netonix - * [WISP Switch (As Netonix)](lib/oxidized/model/netonix.rb) - * Nokia (formerly TiMetra, Alcatel, Alcatel-Lucent) - * [SR OS (TiMOS)](lib/oxidized/model/timos.rb) - * OneAccess - * [OneOS](lib/oxidized/model/oneos.rb) - * Opengear - * [Opengear](lib/oxidized/model/opengear.rb) - * Palo Alto - * [PANOS](lib/oxidized/model/panos.rb) - * [PLANET SG/SGS Switches](lib/oxidized/model/planet.rb) - * [pfSense](lib/oxidized/model/pfsense.rb) - * Radware - * [AlteonOS](lib/oxidized/model/alteonos.rb) - * Quanta - * [Quanta / VxWorks 6.6 (1.1.0.8)](lib/oxidized/model/quantaos.rb) - * Siklu - * [EtherHaul](lib/oxidized/model/siklu.rb) - * Supermicro - * [Supermicro](lib/oxidized/model/supermicro.rb) - * Symantec - * [Blue Coat ProxySG / Security Gateway OS (SGOS)](lib/oxidized/model/sgos.rb) - * Trango Systems - * [Trango](lib/oxidized/model/trango.rb) - * TPLink - * [TPLink](lib/oxidized/model/tplink.rb) - * Ubiquiti - * [AirOS](lib/oxidized/model/airos.rb) - * [Edgeos](lib/oxidized/model/edgeos.rb) - * [EdgeSwitch](lib/oxidized/model/edgeswitch.rb) - * Watchguard - * [Fireware OS](lib/oxidized/model/firewareos.rb) - * Westell - * [Westell 8178G, Westell 8266G](lib/oxidized/model/weos.rb) - * Zhone - * [Zhone (OLT and MX)](lib/oxidized/model/zhoneolt.rb) - * Zyxel - * [ZyNOS](lib/oxidized/model/zynos.rb) + +* Vendor + * OS model +* A10 Networks + * [ACOS](/lib/oxidized/model/acos.rb) +* Accedian Performance Elements (NIDs) + * [AEN](/lib/oxidized/model/aen.rb) +* Alcatel-Lucent + * [AOS](/lib/oxidized/model/aos.rb) + * [AOS7](/lib/oxidized/model/aos7.rb) + * [ISAM](/lib/oxidized/model/isam.rb) + * [SR OS (Formerly TiMOS)](/lib/oxidized/model/timos.rb) + * Wireless +* Allied Telesis + * [Alliedware Plus](/lib/oxidized/model/awplus.rb) +* Alvarion + * [BreezeACCESS](/lib/oxidized/model/alvarion.rb) +* APC + * [AOS](/lib/oxidized/model/apc_aos.rb) +* Arbor Networks + * [ArbOS](/lib/oxidized/model/arbos.rb) +* Arista + * [EOS](/lib/oxidized/model/eos.rb) +* Arris + * [C4CMTS](/lib/oxidized/model/c4cmts.rb) +* Aruba + * [AOSW](/lib/oxidized/model/aosw.rb) +* AudioCodes + * [AudioCodes](/lib/oxdized/model/audiocodes.rb) +* Avaya + * [VOSS (VSP Operating System Software)](/lib/oxidized/model/voss.rb) + * [BOSS (Baystack Operating System Software)](/lib/oxidized/model/boss.rb) +* Brocade + * [FabricOS](lib/oxidized/model/fabricos.rb) + * [Ironware](lib/oxidized/model/ironware.rb) + * [NOS (Network Operating System)](lib/oxidized/model/nos.rb) + * [Vyatta](lib/oxidized/model/vyatta.rb) + * [6910](lib/oxidized/model/br6910.rb) + * [SLX-OS](lib/oxidized/model/slxos.rb) +* Casa + * [Casa](/lib/oxidized/model/casa.rb) +* Check Point + * [GaiaOS](/lib/oxidized/model/gaiaos.rb) +* Ciena + * [SAOS](/lib/oxidized/model/saos.rb) +* Cisco + * [ACSW](/lib/oxidized/model/acsw.rb) + * [AireOS](/lib/oxidized/model/aireos.rb) + * [ASA](/lib/oxidized/model/asa.rb) + * [AsyncOS](/lib/oxidized/model/asyncos.rb) + * [CatOS](/lib/oxidized/model/catos.rb) + * [IOS](/lib/oxidized/model/ios.rb) + * [IOSXR](/lib/oxidized/model/iosxr.rb) + * [NGA](/lib/oxidized/model/cisconga.rb) + * [NXOS](/lib/oxidized/model/nxos.rb) + * [SMA](/lib/oxidized/model/ciscosma.rb) + * [SMB (Nikola series)](/lib/oxidized/model/ciscosmb.rb) + * [UCS](/lib/oxidized/model/ucs.rb) +* Citrix + * [NetScaler (Virtual Applicance)](/lib/oxidized/model/netscaler.rb) +* Coriant (former Tellabs) + * [TMOS (8800)](/lib/oxidized/model/corianttmos.rb) + * [8600](/lib/oxidized/model/coriant8600.rb) + * [Groove](/lib/oxidized/model/coriantgroove.rb) +* Cumulus + * [Linux](/lib/oxidized/model/cumulus.rb) +* DataCom + * [DmSwitch 3000](/lib/oxidized/model/datacom.rb) +* DCN + * [DCN](/lib/oxidized/model/ios.rb) - Map this to ios. +* DELL + * [PowerConnect](/lib/oxidized/model/powerconnect.rb) + * [AOSW](/lib/oxidized/model/aosw.rb) +* D-Link + * [D-Link](/lib/oxidized/model/dlink.rb) +* Ericsson/Redback + * [IPOS (former SEOS)](/lib/oxidized/model/ipos.rb) +* Extreme Networks + * [Enterasys](/lib/oxidized/model/enterasys.rb) + * [WM](/lib/oxidized/model/mtrlrfs.rb) + * [XOS](/lib/oxidized/model/xos.rb) +* F5 + * [TMOS](/lib/oxidized/model/tmos.rb) +* Fiberstore + * [S3800](/lib/oxidized/model/gcombnps.rb) +* Force10 + * [DNOS](/lib/oxidized/model/dnos.rb) + * [FTOS](/lib/oxidized/model/ftos.rb) +* FortiGate + * [FortiOS](/lib/oxidized/model/fortios.rb) +* Fujitsu + * [PRIMERGY Blade switch 1/10Gbe](/lib/oxidized/model/fujitsupy.rb) +* GCOM Technologies + * [Broadband Network Platform Software](/lib/oxidized/model/gcombnps.rb) +* Hatteras + * [Hatteras](/lib/oxidized/model/hatteras.rb) +* Hirschmann + * [HiOS](/lib/oxidized/model/hirschmann.rb) +* HP + * [Comware (HP A-series, H3C, 3Com)](/lib/oxidized/model/comware.rb) + * [Procurve](/lib/oxidized/model/procurve.rb) + * [BladeSystem (Onboard Administrator)](/lib/oxidized/model/hpebladesystem.rb) + * [MSA](/lib/oxidized/model/hpemsa.rb) +* Huawei + * [VRP](/lib/oxidized/model/vrp.rb) +* Juniper + * [JunOS](/lib/oxidized/model/junos.rb) + * [ScreenOS (Netscreen)](/lib/oxidized/model/screenos.rb) +* Mellanox + * [MLNX-OS](/lib/oxidized/model/mlnxos.rb) + * [Voltaire](/lib/oxidized/model/voltaire.rb) +* Mikrotik + * [RouterOS](/lib/oxidized/model/routeros.rb) +* Motorola + * [RFS](/lib/oxidized/model/mtrlrfs.rb) +* MRV + * [MasterOS](/lib/oxidized/model/masteros.rb) + * [FiberDriver](/lib/oxidized/model/fiberdriver.rb) +* Netgear + * [Netgear](/lib/oxidized/model/netgear.rb) +* Netonix + * [WISP Switch (As Netonix)](/lib/oxidized/model/netonix.rb) +* Nokia (formerly TiMetra, Alcatel, Alcatel-Lucent) + * [SR OS (TiMOS)](/lib/oxidized/model/timos.rb) +* OneAccess + * [OneOS](/lib/oxidized/model/oneos.rb) +* Opengear + * [Opengear](/lib/oxidized/model/opengear.rb) +* [OPNsense](/lib/oxidized/model/opnsense.rb) +* Palo Alto + * [PANOS](/lib/oxidized/model/panos.rb) +* [PLANET SG/SGS Switches](/lib/oxidized/model/planet.rb) +* [pfSense](/lib/oxidized/model/pfsense.rb) +* Radware + * [AlteonOS](/lib/oxidized/model/alteonos.rb) +* Quanta + * [Quanta / VxWorks 6.6 (1.1.0.8)](/lib/oxidized/model/quantaos.rb) +* Siklu + * [EtherHaul](/lib/oxidized/model/siklu.rb) +* Supermicro + * [SSE-G2252, G2252P](/lib/oxidized/model/edgecos.rb) + * [SSE-G48-TG4, G24-TG4](/lib/oxidized/model/aricentiss.rb) + * [SSE-X24S, X24SR, X3348S, X3348SR, X3348T, X3348TR](/lib/oxidized/model/aricentiss.rb) + * [SBM-GEM-X2C, GEM-X2C+, GEM-X3S+, XEM-X10SM](/lib/oxidized/model/aricentiss.rb) +* Symantec + * [Blue Coat ProxySG / Security Gateway OS (SGOS)](/lib/oxidized/model/sgos.rb) +* Trango Systems + * [Trango](/lib/oxidized/model/trango.rb) +* TPLink + * [TPLink](/lib/oxidized/model/tplink.rb) +* Ubiquiti + * [AirOS](/lib/oxidized/model/airos.rb) + * [Edgeos](/lib/oxidized/model/edgeos.rb) + * [EdgeSwitch](/lib/oxidized/model/edgeswitch.rb) +* Watchguard + * [Fireware OS](/lib/oxidized/model/firewareos.rb) +* Westell + * [Westell 8178G, Westell 8266G](/lib/oxidized/model/weos.rb) +* Zhone + * [Zhone (OLT and MX)](/lib/oxidized/model/zhoneolt.rb) +* Zyxel + * [ZyNOS](/lib/oxidized/model/zynos.rb) diff --git a/extra/oxidized.service b/extra/oxidized.service index e474608..ce1b1a3 100644 --- a/extra/oxidized.service +++ b/extra/oxidized.service @@ -10,7 +10,7 @@ Wants=network-online.target [Service] ExecStart=/usr/local/bin/oxidized User=oxidized -KillSignal=SIGINT +KillSignal=SIGKILL [Install] WantedBy=multi-user.target diff --git a/lib/oxidized/config.rb b/lib/oxidized/config.rb index 23af9c2..47544fb 100644 --- a/lib/oxidized/config.rb +++ b/lib/oxidized/config.rb @@ -37,6 +37,7 @@ module Oxidized asetus.default.input.default = 'ssh, telnet' asetus.default.input.debug = false # or String for session log file asetus.default.input.ssh.secure = false # complain about changed certs + asetus.default.input.ftp.passive= true # ftp passive mode asetus.default.output.default = 'file' # file, git asetus.default.source.default = 'csv' # csv, sql diff --git a/lib/oxidized/hook/exec.rb b/lib/oxidized/hook/exec.rb index a9a5950..3f984c2 100644 --- a/lib/oxidized/hook/exec.rb +++ b/lib/oxidized/hook/exec.rb @@ -71,6 +71,7 @@ class Exec < Oxidized::Hook "OX_NODE_FROM" => ctx.node.from.to_s, "OX_NODE_MSG" => ctx.node.msg.to_s, "OX_NODE_GROUP" => ctx.node.group.to_s, + "OX_NODE_MODEL" => ctx.node.model.class.name, "OX_REPO_COMMITREF" => ctx.commitref.to_s, "OX_REPO_NAME" => ctx.node.repo.to_s, ) diff --git a/lib/oxidized/hook/githubrepo.rb b/lib/oxidized/hook/githubrepo.rb index d33e54e..f74b22a 100644 --- a/lib/oxidized/hook/githubrepo.rb +++ b/lib/oxidized/hook/githubrepo.rb @@ -51,7 +51,7 @@ class GithubRepo < Oxidized::Hook else if cfg.has_key?('publickey') && cfg.has_key?('privatekey') log "Using ssh auth with key", :debug - Rugged::Credentials::SshKey.new(username: 'git', publickey: File.expand_path(cfg.publickey), privatekey: File.expand_path(cfg.privatekey)) + Rugged::Credentials::SshKey.new(username: 'git', publickey: File.expand_path(cfg.publickey), privatekey: File.expand_path(cfg.privatekey), passphrase: ENV["OXIDIZED_SSH_PASSPHRASE"]) else log "Using ssh auth with agentforwarding", :debug Rugged::Credentials::SshKeyFromAgent.new(username: 'git') diff --git a/lib/oxidized/hook/slackdiff.rb b/lib/oxidized/hook/slackdiff.rb index 61f1743..7cd4465 100644 --- a/lib/oxidized/hook/slackdiff.rb +++ b/lib/oxidized/hook/slackdiff.rb @@ -1,5 +1,8 @@ require 'slack' +# defaults to posting a diff, if messageformat is supplied them a message will be posted too +# diffenable defaults to true + class SlackDiff < Oxidized::Hook def validate_cfg! raise KeyError, 'hook.token is required' unless cfg.has_key?('token') @@ -17,16 +20,35 @@ class SlackDiff < Oxidized::Hook client = Slack::Client.new client.auth_test log "Connected" - gitoutput = ctx.node.output.new - diff = gitoutput.get_diff ctx.node, ctx.node.group, ctx.commitref, nil - title = "#{ctx.node.name.to_s} #{ctx.node.group.to_s} #{ctx.node.model.class.name.to_s.downcase}" - log "Posting diff as snippet to #{cfg.channel}" - client.files_upload(channels: cfg.channel, as_user: true, - content: diff[:patch].lines.to_a[4..-1].join, - filetype: "diff", - title: title, - filename: "change" - ) + # diff snippet - default + diffenable = true + if cfg.has_key?('diff') == true + if cfg.diff == false + diffenable = false + end + end + if diffenable == true + gitoutput = ctx.node.output.new + diff = gitoutput.get_diff ctx.node, ctx.node.group, ctx.commitref, nil + unless diff == "no diffs" + title = "#{ctx.node.name.to_s} #{ctx.node.group.to_s} #{ctx.node.model.class.name.to_s.downcase}" + log "Posting diff as snippet to #{cfg.channel}" + client.files_upload(channels: cfg.channel, as_user: true, + content: diff[:patch].lines.to_a[4..-1].join, + filetype: "diff", + title: title, + filename: "change" + ) + end + end + # message custom formatted - optional + if cfg.has_key?('message') == true + log cfg.message + msg = cfg.message % {:node => ctx.node.name.to_s, :group => ctx.node.group.to_s, :commitref => ctx.commitref, :model => ctx.node.model.class.name.to_s.downcase} + log msg + log "Posting message to #{cfg.channel}" + client.chat_postMessage(channel: cfg.channel, text: msg, as_user: true) + end log "Finished" end end diff --git a/lib/oxidized/hook/xmppdiff.rb b/lib/oxidized/hook/xmppdiff.rb new file mode 100644 index 0000000..396d1b3 --- /dev/null +++ b/lib/oxidized/hook/xmppdiff.rb @@ -0,0 +1,60 @@ +require 'xmpp4r' +require 'xmpp4r/muc/helper/simplemucclient' + +class XMPPDiff < Oxidized::Hook + def validate_cfg! + raise KeyError, 'hook.jid is required' unless cfg.has_key?('jid') + raise KeyError, 'hook.password is required' unless cfg.has_key?('password') + raise KeyError, 'hook.channel is required' unless cfg.has_key?('channel') + raise KeyError, 'hook.nick is required' unless cfg.has_key?('nick') + end + + def run_hook(ctx) + if ctx.node + if ctx.event.to_s == "post_store" + begin + Timeout::timeout(15) do + gitoutput = ctx.node.output.new + diff = gitoutput.get_diff ctx.node, ctx.node.group, ctx.commitref, nil + + interesting = diff[:patch].lines.to_a[4..-1].any? { |line| + ["+", "-"].include?(line[0]) and not ["#", "!"].include?(line[1]) + } + interesting &&= diff[:patch].lines.to_a[5..-1].any? { |line| line[0] == '-' } + interesting &&= diff[:patch].lines.to_a[5..-1].any? { |line| line[0] == '+' } + + if interesting + log "Connecting to XMPP" + client = Jabber::Client.new(Jabber::JID.new(cfg.jid)) + client.connect + sleep 1 + client.auth(cfg.password) + sleep 1 + + log "Connected" + + m = Jabber::MUC::SimpleMUCClient.new(client) + m.join(cfg.channel + "/" + cfg.nick) + + log "Joined" + + title = "#{ctx.node.name.to_s} #{ctx.node.group.to_s} #{ctx.node.model.class.name.to_s.downcase}" + log "Posting diff as snippet to #{cfg.channel}" + + m.say(title + "\n\n" + diff[:patch].lines.to_a[4..-1].join) + + sleep 1 + + client.close + + log "Finished" + + end + end + rescue Timeout::Error + log "timed out" + end + end + end + end +end diff --git a/lib/oxidized/input/ftp.rb b/lib/oxidized/input/ftp.rb index 80de257..cdf3688 100644 --- a/lib/oxidized/input/ftp.rb +++ b/lib/oxidized/input/ftp.rb @@ -19,7 +19,9 @@ module Oxidized @node = node @node.model.cfg['ftp'].each { |cb| instance_exec(&cb) } @log = File.open(Oxidized::Config::Log + "/#{@node.ip}-ftp", 'w') if Oxidized.config.input.debug? - @ftp = Net::FTP.new @node.ip, @node.auth[:username], @node.auth[:password] + @ftp = Net::FTP.new(@node.ip) + @ftp.passive = Oxidized.config.input.ftp.passive + @ftp.login @node.auth[:username], @node.auth[:password] connected? end diff --git a/lib/oxidized/model/aosw.rb b/lib/oxidized/model/aosw.rb index a85ead7..71fde2e 100644 --- a/lib/oxidized/model/aosw.rb +++ b/lib/oxidized/model/aosw.rb @@ -11,7 +11,7 @@ class AOSW < Oxidized::Model # All IAPs connected to a Instant Controller will have the same config output. Only the controller needs to be monitored. comment '# ' - prompt /^\(?.+\)?\s?[#>]/ + prompt /^\(?.+\)?\s[#>]/ cmd :all do |cfg| cfg.each_line.to_a[1..-2].join diff --git a/lib/oxidized/model/arbos.rb b/lib/oxidized/model/arbos.rb new file mode 100644 index 0000000..389f3f6 --- /dev/null +++ b/lib/oxidized/model/arbos.rb @@ -0,0 +1,27 @@ +class ARBOS < Oxidized::Model + + # Arbor OS model # + + prompt /^[\S\s]+\n([\w.@-]+[:\/#>]+)\s?$/ + comment '# ' + + cmd 'system hardware' do |cfg| + cfg.gsub! /^Boot\ time\:\s.+/, '' # Remove boot timer + cfg.gsub! /^Load\ averages\:\s.+/, '' # Remove CPU load info + cfg = cfg.each_line.to_a[2..-1].join + comment cfg + end + + cmd 'system version' do |cfg| + comment cfg + end + + cmd 'config show' do |cfg| + cfg + end + + cfg :ssh do + exec true + pre_logout 'exit' + end +end diff --git a/lib/oxidized/model/aricentiss.rb b/lib/oxidized/model/aricentiss.rb new file mode 100644 index 0000000..80735c7 --- /dev/null +++ b/lib/oxidized/model/aricentiss.rb @@ -0,0 +1,50 @@ +# Developed against: +# #show version +# Switch ID Hardware Version Firmware Version +# 0 SSE-G48-TG4 (P2-01) 1.0.16-9 + +class AricentISS < Oxidized::Model + + prompt (/^(\e\[27m)?[ \r]*\w+# ?$/) + + cfg :ssh do + post_login 'no cli pagination' + pre_logout 'exit' + end + + cmd :all do |cfg| + # * Drop first line that contains the command, and the last line that + # contains a prompt + # * Strip carriage returns + cfg.delete("\r").each_line.to_a[1..-2].join + end + + cmd :secret do |cfg| + cfg.gsub(/^(snmp community) .*/, '\1 <hidden>') + end + + cmd 'show system information' do |cfg| + cfg.sub! /^Device Up Time.*\n/, '' + cfg.delete! "\r" + comment(cfg).gsub(/ +$/, '') + end + + cmd 'show running-config' do |cfg| + comment_next = 0 + cfg.each_line.map { |l| + next '' if l.match /^Building configuration/ + + if l.match /^Switch ID.*Hardware Version.*Firmware Version/ then + comment_next = 2 + end + + if comment_next > 0 then + comment_next -= 1 + next comment(l) + end + + l + }.join.gsub(/ +$/, '') + end + +end diff --git a/lib/oxidized/model/awplus.rb b/lib/oxidized/model/awplus.rb new file mode 100644 index 0000000..1d8fbcd --- /dev/null +++ b/lib/oxidized/model/awplus.rb @@ -0,0 +1,85 @@ +class AWPlus < Oxidized::Model + + #Allied Telesis Alliedware Plus Model# + #https://www.alliedtelesis.com/products/software/AlliedWare-Plus + + prompt /^(\r?[\w.@:\/-]+[#>]\s?)$/ + comment '! ' + + #Avoids needing "term length 0" to display full config file. + expect /--More--/ do |data, re| + send ' ' + data.sub re, '' + end + + #Removes gibberish pager output e.g. VT100 escape codes + cmd :all do |cfg| + cfg.gsub! /\e\[K/, '' # example how to handle pager - cleareol EL0 + cfg.gsub! /\e\[7m\e\[m/, '' # example how to handle pager - Reverse SGR7 + cfg.gsub! /\r/, '' # Filters rogue ^M - see issue #415 + cfg.each_line.to_a[1..-2].join + end + + #Remove passwords from config file. + #Add vars "remove_secret: true" to global oxidized config file to enable. + + cmd :secret do |cfg| + cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>' + cfg.gsub! /^(username \S+ privilege \d+) (\S+).*/, '\\1 <secret hidden>' + cfg.gsub! /^(username \S+ password \d) (\S+)/, '\\1 <secret hidden>' + cfg.gsub! /^(username \S+ secret \d) (\S+)/, '\\1 <secret hidden>' + cfg.gsub! /^(enable (password|secret) \d) (\S+)/, '\\1 <secret hidden>' + cfg.gsub! /^(\s+(?:password|secret)) (?:\d )?\S+/, '\\1 <secret hidden>' + cfg.gsub! /^(tacacs-server key \d) (\S+)/, '\\1 <secret hidden>' + cfg + end + + #Adds "Show system" output to start of config. + + cmd 'Show System' do |cfg| + comment cfg.insert(0,"--------------------------------------------------------------------------------! \n") + #Unhash below to write a comment in the config file. + cfg.insert(0,"Starting: Show system cmd \n") + cfg << "\n \nEnding: show system cmd" + comment cfg << "\n--------------------------------------------------------------------------------! \n \n" + #Removes the following lines from "show system" in output file. This ensures oxidized diffs are meaningful. + comment cfg.each_line.reject { |line| + line.match /^$\n/ or #Remove blank lines in "sh sys" + line.match /System Status\s*.*/ or + line.match /RAM\s*:.*/ or + line.match /Uptime\s*:.*/ or + line.match /Flash\s*:.*/ or + line.match /Current software\s*:.*/ or + line.match /Software version\s*:.*/ or + line.match /Build date\s*:.*/ }.join + end + + #Actually get the devices running config# + cmd 'show running-config' do |cfg| + cfg + end + + #Config required for telnet to detect username prompt + cfg :telnet do + username /login:\s/ + end + + #Main login config + cfg :telnet, :ssh do + post_login do + if vars :enable + send "enable\n" + expect /^Password:\s/ + cmd vars(:enable) + "\r\n" + else + cmd 'enable' # Required for Priv-Exec users without enable PW to be put into "enable mode". + end +# cmd 'terminal length 0' #set so the entire config is output without intervention. + end + pre_logout do +# cmd 'terminal no length' #Sets term length back to default on exit. + send "exit\r\n" + end + end + +end diff --git a/lib/oxidized/model/br6910.rb b/lib/oxidized/model/br6910.rb index b5c9bcf..df93793 100644 --- a/lib/oxidized/model/br6910.rb +++ b/lib/oxidized/model/br6910.rb @@ -1,7 +1,7 @@ class BR6910 < Oxidized::Model
- prompt /^Vty-[0-9]\#$/
+ prompt /^([\w.@()-]+[#>]\s?)$/
comment '! '
# not possible to disable paging prior to show running-config
diff --git a/lib/oxidized/model/ciscosmb.rb b/lib/oxidized/model/ciscosmb.rb index 9453059..deb4768 100644 --- a/lib/oxidized/model/ciscosmb.rb +++ b/lib/oxidized/model/ciscosmb.rb @@ -17,6 +17,7 @@ class CiscoSMB < Oxidized::Model cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>' cfg.gsub! /username (\S+) privilege (\d+) (\S+).*/, '<secret hidden>' cfg.gsub! /^(encrypted radius-server key).*/, '\\1 <configuration removed>' + cfg.gsub! /System Up Time.*/, '' cfg end @@ -24,6 +25,10 @@ class CiscoSMB < Oxidized::Model comment cfg end + cmd 'show system' do |cfg| + comment cfg + end + cmd 'show bootvar' do |cfg| comment cfg end diff --git a/lib/oxidized/model/comware.rb b/lib/oxidized/model/comware.rb index d926854..a5b7190 100644 --- a/lib/oxidized/model/comware.rb +++ b/lib/oxidized/model/comware.rb @@ -1,8 +1,8 @@ class Comware < Oxidized::Model # HP (A-series)/H3C/3Com Comware - # sometimes the prompt might have a leading nul - prompt /^\0*(<[\w.-]+>)$/ + # sometimes the prompt might have a leading nul or trailing ASCII Bell (^G) + prompt /^\0*(<[\w.-]+>).?$/ comment '# ' # example how to handle pager diff --git a/lib/oxidized/model/edgecos.rb b/lib/oxidized/model/edgecos.rb new file mode 100644 index 0000000..bc205f5 --- /dev/null +++ b/lib/oxidized/model/edgecos.rb @@ -0,0 +1,47 @@ +class EdgeCOS < Oxidized::Model + + comment '! ' + + cmd :secret do |cfg| + cfg.gsub!(/password \d+ (\S+).*/, '<secret removed>') + cfg.gsub!(/community (\S+)/, 'community <hidden>') + cfg + end + + cmd :all do |cfg| + cfg.each_line.to_a[2..-2].join + end + + cmd 'show running-config' + + cmd 'show access-list tcam-utilization' do |cfg| + comment cfg + end + + cmd 'show memory' do |cfg| + comment cfg + end + + cmd 'show system' do |cfg| + comment cfg + end + + cmd 'show version' do |cfg| + comment cfg + end + + cmd 'show watchdog' do |cfg| + comment cfg + end + + cfg :telnet do + username /^Username:/ + password /^Password:/ + end + + cfg :telnet, :ssh do + post_login 'terminal length 0' + pre_logout 'exit' + end + +end diff --git a/lib/oxidized/model/edgeos.rb b/lib/oxidized/model/edgeos.rb index 2a8d663..aa7a197 100644 --- a/lib/oxidized/model/edgeos.rb +++ b/lib/oxidized/model/edgeos.rb @@ -9,11 +9,15 @@ class Edgeos < Oxidized::Model end cmd :secret do |cfg| + cfg.gsub! /encrypted-password (\S+).*/, 'encrypted-password <secret removed>' + cfg.gsub! /plaintext-password (\S+).*/, 'plaintext-password <secret removed>' + cfg.gsub! /password (\S+).*/, 'password <secret removed>' + cfg.gsub! /pre-shared-secret (\S+).*/, 'pre-shared-secret <secret removed>' cfg.gsub! /community (\S+) {/, 'community <hidden> {' cfg end - cmd 'show configuration | no-more' + cmd 'show configuration commands | no-more' cfg :telnet do username /login:\s/ diff --git a/lib/oxidized/model/fiberdriver.rb b/lib/oxidized/model/fiberdriver.rb index abe8f68..7cfa847 100644 --- a/lib/oxidized/model/fiberdriver.rb +++ b/lib/oxidized/model/fiberdriver.rb @@ -13,7 +13,7 @@ class FiberDriver < Oxidized::Model cfg.each_line.to_a[3..-1].join cfg.gsub! /^Building configuration.*$/, '' cfg.gsub! /^Current configuration:.*$$/, '' - cfg.gsub! /^! Configuration saved on .*$/, '' + cfg.gsub! /^! Configuration (saved|generated) on .*$/, '' cfg end diff --git a/lib/oxidized/model/fortios.rb b/lib/oxidized/model/fortios.rb index 605a596..23370c4 100644 --- a/lib/oxidized/model/fortios.rb +++ b/lib/oxidized/model/fortios.rb @@ -15,9 +15,12 @@ class FortiOS < Oxidized::Model end cmd :secret do |cfg| - cfg.gsub! /(set (?:passwd|password|secondary-secret|rsso-secret|psksecret|secret|key ENC)).*/, '\\1 <configuration removed>' + cfg.gsub! /(set (?:passwd|password|psksecret|secret|key|group-password|secondary-secret|tertiary-secret|auth-password-l1|auth-password-l2|rsso|history0|history1|inter-controller-key ENC|passphrase ENC|login-passwd ENC)).*/, '\\1 <configuration removed>' cfg.gsub! /(set private-key).*-+END ENCRYPTED PRIVATE KEY-*"$/m , '\\1 <configuration removed>' - cfg.gsub! /(IPS Malicious URL Database).*/, '\\1 <configuration removed>' + cfg.gsub! /(set ca ).*-+END CERTIFICATE-*"$/m , '\\1 <configuration removed>' + cfg.gsub! /(set csr ).*-+END CERTIFICATE REQUEST-*"$/m , '\\1 <configuration removed>' + cfg.gsub! /(Virus-DB|Extended DB|IPS-DB|IPS-ETDB|APP-DB|INDUSTRIAL-DB|Botnet DB|IPS Malicious URL Database).*/, '\\1 <configuration removed>' + cfg.gsub! /(Cluster uptime:).*/, '\\1 <configuration removed>' cfg end @@ -46,7 +49,7 @@ class FortiOS < Oxidized::Model cfg << cmd('end') if @vdom_enabled - cfg << cmd('show') + cfg << cmd('show full-configuration') cfg.join "\n" end @@ -60,4 +63,3 @@ cfg << cmd('end') if @vdom_enabled end end - diff --git a/lib/oxidized/model/gcombnps.rb b/lib/oxidized/model/gcombnps.rb new file mode 100644 index 0000000..4a97162 --- /dev/null +++ b/lib/oxidized/model/gcombnps.rb @@ -0,0 +1,85 @@ +class GcomBNPS < Oxidized::Model + # For switches from GCOM Technologies Co.,Ltd. running the "Broadband Network Platform Software" + # Author: Frederik Kriewitz <frederik@kriewitz.eu> + # + # tested with: + # - S5330 (aka Fiberstore S3800) + + prompt /^\r?([\w.@()-]+?(\(1-16 chars\))?[#>:]\s?)$/ # also match SSH password promt (post_login commands are sent after the first prompt) + comment '! ' + +# alternative to handle the SSH login, but this breaks telnet +# expect /^Password\(1-16 chars\):/ do |data| +# send @node.auth[:password] + "\n" +# '' +# end + + # handle pager (can't be disabled?) + expect /^\.\.\.\.press ENTER to next line, CTRL_C to quit, other key to next page\.\.\.\.$/ do |data, re| + send ' ' + data.sub re, '' + end + + cmd :all do |cfg| + cfg = cfg.gsub " \e[73D\e[K", '' # remove garbage remaining from the pager + cfg.each_line.to_a[1..-2].join + end + + cmd :secret do |cfg| + cfg.gsub! /^(snmp-server community)\s+[^\s]+\s+(.*)/, '\\1 <community hidden> \\2' + cfg + end + + cmd 'show running-config' do |cfg| + cfg + end + + cmd 'show interface sfp' do |cfg| + out = [] + cfg.each_line do |line| + next if line.match /^ Temperature/ + next if line.match /^ Voltage\(V\)/ + next if line.match /^ Bias Current\(mA\)/ + next if line.match /^ RX Power\(dBM\)/ + next if line.match /^ TX Power\(dBM\)/ + out << line + end + + comment out.join + end + + + cmd 'show version' do |cfg| + comment cfg + end + + cmd 'show system' do |cfg| + out = [] + cfg.each_line do |line| + next if line.match /^system run time :/ + next if line.match /^switch temperature :/ + out << line + end + + comment out.join + end + + cfg :telnet do + username /^Username\(1-32 chars\):/ + password /^Password\(1-16 chars\):/ + end + + cfg :ssh do + # the switch blindy accepts the SSH connection without password validation and then spawns a telnet login prompt + # first thing we've to send is the password + post_login do + send @node.auth[:password] + "\n" + end + end + + cfg :telnet, :ssh do + pre_logout 'exit' + end + +end + diff --git a/lib/oxidized/model/ios.rb b/lib/oxidized/model/ios.rb index 0cb2f3a..4e7d223 100644 --- a/lib/oxidized/model/ios.rb +++ b/lib/oxidized/model/ios.rb @@ -26,6 +26,7 @@ class IOS < Oxidized::Model cmd :secret do |cfg| cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>' + cfg.gsub! /^(snmp-server host \S+( vrf \S+)?( version (1|2c|3))?)\s+\S+((\s+\S*)*)\s*/, '\\1 <secret hidden> \\5' cfg.gsub! /^(username \S+ privilege \d+) (\S+).*/, '\\1 <secret hidden>' cfg.gsub! /^(username \S+ password \d) (\S+)/, '\\1 <secret hidden>' cfg.gsub! /^(username \S+ secret \d) (\S+)/, '\\1 <secret hidden>' diff --git a/lib/oxidized/model/junos.rb b/lib/oxidized/model/junos.rb index 2f59414..2ea0179 100644 --- a/lib/oxidized/model/junos.rb +++ b/lib/oxidized/model/junos.rb @@ -13,7 +13,10 @@ class JunOS < Oxidized::Model end cmd :secret do |cfg| - cfg.gsub!(/encrypted-password (\S+).*/, '<secret removed>') + cfg.gsub!(/encrypted-password (\S+).*/, 'encrypted-password <secret removed>') + cfg.gsub!(/pre-shared-key ascii-text (\S+).*/, 'pre-shared-key ascii-text <secret removed>') + cfg.gsub!(/pre-shared-key hexadecimal (\S+).*/, 'pre-shared-key hexadecimal <secret removed>') + cfg.gsub!(/authentication-key (\S+).*/, 'authentication-key <secret removed>') cfg.gsub!(/community (\S+) {/, 'community <hidden> {') cfg end diff --git a/lib/oxidized/model/netgear.rb b/lib/oxidized/model/netgear.rb index 38aaca7..0ab1349 100644 --- a/lib/oxidized/model/netgear.rb +++ b/lib/oxidized/model/netgear.rb @@ -1,7 +1,7 @@ class Netgear < Oxidized::Model comment '!' - prompt /^(\([\w-]+\)\s[#>])$/ + prompt /^(\([\w\-.]+\)\s[#>])$/ cmd :secret do |cfg| cfg.gsub!(/password (\S+)/, 'password <hidden>') diff --git a/lib/oxidized/model/opnsense.rb b/lib/oxidized/model/opnsense.rb new file mode 100644 index 0000000..b874fca --- /dev/null +++ b/lib/oxidized/model/opnsense.rb @@ -0,0 +1,21 @@ +class OpnSense < Oxidized::Model + + # minimum required permissions: "System: Shell account access" + # must enable SSH and password-based SSH access + + cmd :all do |cfg| + cfg.each_line.to_a[1..-1].join + end + + cmd 'cat /conf/config.xml' do |cfg| + cfg.gsub! /\s<revision>\s*<time>\d*<\/time>\s*.*\s*.*\s*<\/revision>/, '' + cfg.gsub! /\s<last_rule_upd_time>\d*<\/last_rule_upd_time>/, '' + cfg + end + + cfg :ssh do + exec true + pre_logout 'exit' + end + +end diff --git a/lib/oxidized/model/powerconnect.rb b/lib/oxidized/model/powerconnect.rb index 61e1cf2..f602a36 100644 --- a/lib/oxidized/model/powerconnect.rb +++ b/lib/oxidized/model/powerconnect.rb @@ -14,7 +14,7 @@ class PowerConnect < Oxidized::Model end cmd :secret do |cfg| - cfg.gsub! /^username (\S+) password \S+ (.*)/, 'username \1 password <hidden> \2' + cfg.gsub! /^(username \S+ password (?:encrypted )?)\S+(.*)/, '\1<hidden>\2' cfg end diff --git a/lib/oxidized/model/procurve.rb b/lib/oxidized/model/procurve.rb index 180b703..444fb5b 100644 --- a/lib/oxidized/model/procurve.rb +++ b/lib/oxidized/model/procurve.rb @@ -21,6 +21,11 @@ class Procurve < Oxidized::Model "" end + expect /Enter switch number/ do + send "\n" + "" + end + cmd :all do |cfg| cfg = cfg.each_line.to_a[1..-2].join cfg = cfg.gsub /^\r/, '' @@ -42,6 +47,10 @@ class Procurve < Oxidized::Model comment cfg end + cmd 'show system power-supply' do |cfg| + comment cfg + end + cmd 'show interfaces transceiver' do |cfg| comment cfg end diff --git a/lib/oxidized/model/routeros.rb b/lib/oxidized/model/routeros.rb index f391fb9..6717446 100644 --- a/lib/oxidized/model/routeros.rb +++ b/lib/oxidized/model/routeros.rb @@ -19,6 +19,7 @@ class RouterOS < Oxidized::Model cmd run_cmd do |cfg| cfg.gsub! /\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]/, '' # strip ANSI colours cfg.gsub! /\\\r\n\s+/, '' # strip new line + cfg.gsub! /# inactive time\r\n/, '' # Remove time based system comment cfg = cfg.split("\n").select { |line| not line[/^\#\s\w{3}\/\d{2}\/\d{4}.*$/] } cfg.join("\n") + "\n" end diff --git a/lib/oxidized/model/slxos.rb b/lib/oxidized/model/slxos.rb new file mode 100644 index 0000000..934da5b --- /dev/null +++ b/lib/oxidized/model/slxos.rb @@ -0,0 +1,61 @@ +class SLXOS < Oxidized::Model + + prompt /^.*[>#]\s?$/i + comment '! ' + + cmd 'show version' do |cfg| + cfg.gsub! /(^((.*)[Ss]ystem [Uu]ptime(.*))$)/, '' #remove unwanted line system uptime + cfg.gsub! /[Uu]p\s?[Tt]ime is .*/,'' + + comment cfg + end + + cmd 'show chassis' do |cfg| + cfg.encode!("UTF-8", :invalid => :replace, :undef => :replace) #sometimes ironware returns broken encoding + cfg.gsub! /.*Power Usage.*/, '' #remove unwanted lines power usage + cfg.gsub! /Time A(live|wake).*/, '' #remove unwanted lines time alive/awake + cfg.gsub! /([\[]*)1([\]]*)<->([\[]*)2([\]]*)(<->([\[]*)3([\]]*))*/, '' + + comment cfg + end + + cmd 'show system' do |cfg| + cfg.gsub! /Up Time.*/, '' #removes uptime line + cfg.gsub! /Current Time.*/, '' #remove current time line + cfg.gsub! /.*speed is.*/, '' #removes fan speed lines + + comment cfg + end + + cmd 'show slots' do |cfg| + cfg.gsub! /^-*^$/, '' # some slx devices are fixed config + cfg.gsub! /syntax error: element does not exist/, '' # same as above + + comment cfg + end + + cmd 'show running-config' do |cfg| + arr = cfg.each_line.to_a + arr[2..-1].join unless arr.length < 2 + end + + cfg :telnet do + # match expected prompts + username /^(Please Enter Login Name|Username):/ + password /^(Please Enter Password ?|Password):/ + end + + #handle pager with enable + cfg :telnet, :ssh do + if vars :enable + post_login do + send "enable\n" + cmd vars(:enable) + end + end + post_login '' + post_login 'terminal length 0' + pre_logout 'exit' + end + +end diff --git a/lib/oxidized/model/supermicro.rb b/lib/oxidized/model/supermicro.rb index 361244c..518ae41 100644 --- a/lib/oxidized/model/supermicro.rb +++ b/lib/oxidized/model/supermicro.rb @@ -1,45 +1,9 @@ -class Supermicro < Oxidized::Model - comment '! ' +# Backward compatibility shim for deprecated model `supermicro`. +# Migrate your source from `supermicro` to `edgecos`. - cmd :secret do |cfg| - cfg.gsub!(/password \d+ (\S+).*/, '<secret removed>') - cfg.gsub!(/community (\S+)/, 'community <hidden>') - cfg - end +require_relative 'edgecos.rb' - cmd :all do |cfg| - cfg.each_line.to_a[2..-2].join - end +Supermicro = EdgeCOS - cmd 'show running-config' +Oxidized.logger.warn "Using deprecated model supermicro, use edgecos instead." - cmd 'show access-list tcam-utilization' do |cfg| - comment cfg - end - - cmd 'show memory' do |cfg| - comment cfg - end - - cmd 'show system' do |cfg| - comment cfg - end - - cmd 'show version' do |cfg| - comment cfg - end - - cmd 'show watchdog' do |cfg| - comment cfg - end - - cfg :telnet do - username /^Username:/ - password /^Password:/ - end - - cfg :telnet, :ssh do - post_login 'terminal length 0' - pre_logout 'exit' - end -end
\ No newline at end of file diff --git a/lib/oxidized/model/vyatta.rb b/lib/oxidized/model/vyatta.rb index 8d977aa..57ec9d3 100644 --- a/lib/oxidized/model/vyatta.rb +++ b/lib/oxidized/model/vyatta.rb @@ -9,11 +9,15 @@ class Vyatta < Oxidized::Model end cmd :secret do |cfg| + cfg.gsub! /encrypted-password (\S+).*/, 'encrypted-password <secret removed>' + cfg.gsub! /plaintext-password (\S+).*/, 'plaintext-password <secret removed>' + cfg.gsub! /password (\S+).*/, 'password <secret removed>' + cfg.gsub! /pre-shared-secret (\S+).*/, 'pre-shared-secret <secret removed>' cfg.gsub! /community (\S+) {/, 'community <hidden> {' cfg end - cmd 'show configuration | no-more' + cmd 'show configuration commands | no-more' cfg :telnet do username /login:\s/ diff --git a/lib/oxidized/source/csv.rb b/lib/oxidized/source/csv.rb index c1e310a..4814bd7 100644 --- a/lib/oxidized/source/csv.rb +++ b/lib/oxidized/source/csv.rb @@ -23,7 +23,7 @@ class CSV < Source file = File.expand_path(@cfg.file) file = if @cfg.gpg? crypto = GPGME::Crypto.new password: @cfg.gpg_password - crypto.decrypt(file).to_s + file = crypto.decrypt(File.open(file)).to_s else open(file) end diff --git a/lib/oxidized/version.rb b/lib/oxidized/version.rb index 221cffa..9a92133 100644 --- a/lib/oxidized/version.rb +++ b/lib/oxidized/version.rb @@ -1,3 +1,3 @@ module Oxidized - VERSION = '0.20.0' + VERSION = '0.21.0' end |