├── .ruby-version ├── Gemfile ├── extra ├── oxidized.runit ├── oxidized.supervisord ├── auto-reload-config.runit ├── oxidized.service ├── oxidized.upstart ├── oxidized.nginx ├── rvm.oxidized.upstart ├── oxidized.apache2 ├── nagios_check_failing_nodes.rb ├── rest_client.rb ├── oxidized.init.d ├── oxidized.init ├── oxidized-report-git-commits └── syslog.rb ├── lib ├── oxidized │ ├── version.rb │ ├── model │ │ ├── zynos.rb │ │ ├── apc_aos.rb │ │ ├── alvarion.rb │ │ ├── netonix.rb │ │ ├── netscaler.rb │ │ ├── airos.rb │ │ ├── pfsense.rb │ │ ├── corianttmos.rb │ │ ├── opengear.rb │ │ ├── edgeos.rb │ │ ├── firewareos.rb │ │ ├── saos.rb │ │ ├── vyatta.rb │ │ ├── coriant8600.rb │ │ ├── fiberdriver.rb │ │ ├── routeros.rb │ │ ├── fabricos.rb │ │ ├── vrp.rb │ │ ├── datacom.rb │ │ ├── edgeswitch.rb │ │ ├── aos.rb │ │ ├── quantaos.rb │ │ ├── outputs.rb │ │ ├── isam.rb │ │ ├── panos.rb │ │ ├── mtrlrfs.rb │ │ ├── dlink.rb │ │ ├── supermicro.rb │ │ ├── fujitsupy.rb │ │ ├── nos.rb │ │ ├── nxos.rb │ │ ├── ftos.rb │ │ ├── catos.rb │ │ ├── dnos.rb │ │ ├── xos.rb │ │ ├── mlnxos.rb │ │ ├── iosxr.rb │ │ ├── masteros.rb │ │ ├── screenos.rb │ │ ├── cx.rb │ │ ├── br6910.rb │ │ ├── eos.rb │ │ ├── casa.rb │ │ ├── gaiaos.rb │ │ ├── aireos.rb │ │ ├── junos.rb │ │ ├── c4cmts.rb │ │ ├── hatteras.rb │ │ ├── ciscosmb.rb │ │ ├── aos7.rb │ │ ├── tplink.rb │ │ ├── comware.rb │ │ ├── zhoneolt.rb │ │ ├── hpebladesystem.rb │ │ ├── fortios.rb │ │ ├── tmos.rb │ │ ├── procurve.rb │ │ ├── powerconnect.rb │ │ ├── cumulus.rb │ │ ├── asa.rb │ │ ├── ipos.rb │ │ ├── trango.rb │ │ ├── ios.rb │ │ ├── planet.rb │ │ ├── ironware.rb │ │ ├── timos.rb │ │ ├── acos.rb │ │ ├── aosw.rb │ │ └── model.rb │ ├── hook │ │ ├── noophook.rb │ │ ├── awssns.rb │ │ ├── slackdiff.rb │ │ ├── exec.rb │ │ └── githubrepo.rb │ ├── output │ │ ├── output.rb │ │ ├── file.rb │ │ ├── http.rb │ │ └── git.rb │ ├── input │ │ ├── input.rb │ │ ├── tftp.rb │ │ ├── ftp.rb │ │ ├── cli.rb │ │ ├── ssh.rb │ │ └── telnet.rb │ ├── source │ │ ├── source.rb │ │ ├── csv.rb │ │ ├── sql.rb │ │ └── http.rb │ ├── config │ │ └── vars.rb │ ├── job.rb │ ├── string.rb │ ├── node │ │ └── stats.rb │ ├── core.rb │ ├── jobs.rb │ ├── manager.rb │ ├── hook.rb │ ├── cli.rb │ ├── config.rb │ ├── worker.rb │ ├── nodes.rb │ └── node.rb └── oxidized.rb ├── .travis.yml ├── bin ├── console └── oxidized ├── spec ├── spec_helper.rb ├── cli_spec.rb ├── input │ └── ssh_spec.rb ├── nodes_spec.rb ├── node_spec.rb └── githubrepo_spec.rb ├── Gemfile.lock ├── Dockerfile ├── Rakefile ├── TODO.md ├── .gitignore ├── oxidized.gemspec └── CHANGELOG.md /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.1.8 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gemspec 3 | -------------------------------------------------------------------------------- /extra/oxidized.runit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | exec setuser root oxidized 3 | -------------------------------------------------------------------------------- /lib/oxidized/version.rb: -------------------------------------------------------------------------------- 1 | module Oxidized 2 | VERSION = '0.19.0' 3 | end 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | sudo: false 3 | cache: bundler 4 | rvm: 5 | - 2.1.6 6 | -------------------------------------------------------------------------------- /lib/oxidized/model/zynos.rb: -------------------------------------------------------------------------------- 1 | class ZyNOS < Oxidized::Model 2 | 3 | # Used in Zyxel DSLAMs, such as SAM1316 4 | 5 | comment '! ' 6 | 7 | cmd 'config-0' 8 | 9 | cfg :ftp do 10 | end 11 | 12 | end 13 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | lib = File.expand_path('../../lib', __FILE__) 4 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 5 | 6 | require 'oxidized' 7 | require 'pry' 8 | 9 | Pry.start 10 | -------------------------------------------------------------------------------- /lib/oxidized/hook/noophook.rb: -------------------------------------------------------------------------------- 1 | class NoopHook < Oxidized::Hook 2 | def validate_cfg! 3 | log "Validate config" 4 | end 5 | 6 | def run_hook ctx 7 | log "Run hook with context: #{ctx}" 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /lib/oxidized/model/apc_aos.rb: -------------------------------------------------------------------------------- 1 | class Apc_aos < Oxidized::Model 2 | 3 | cmd 'config.ini' do |cfg| 4 | cfg.gsub! /^; Configuration file\, generated on.*/, '' 5 | end 6 | 7 | cfg :ftp do 8 | end 9 | 10 | end 11 | 12 | -------------------------------------------------------------------------------- /lib/oxidized/output/output.rb: -------------------------------------------------------------------------------- 1 | module Oxidized 2 | class Output 3 | class NoConfig < OxidizedError; end 4 | 5 | def cfg_to_str cfg 6 | cfg.select{ |h| h[:type]=='cfg' }.map{ |h| h[:data] }.join 7 | end 8 | 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /lib/oxidized/model/alvarion.rb: -------------------------------------------------------------------------------- 1 | class Alvarion < Oxidized::Model 2 | 3 | # Used in Alvarion wisp equipment 4 | 5 | # Run this command as an instance of Model so we can access node 6 | pre do 7 | cmd "#{node.auth[:password]}.cfg" 8 | end 9 | 10 | 11 | cfg :tftp {} 12 | 13 | end 14 | -------------------------------------------------------------------------------- /extra/oxidized.supervisord: -------------------------------------------------------------------------------- 1 | # by @MrRJ45 at issues #45 2 | 3 | [program:oxidized] 4 | command=/usr/local/bin/oxidized 5 | autostart=true 6 | autorestart=true 7 | user=oxidized 8 | stderr_logfile=/var/log/oxidized.err.log 9 | stdout_logfile=/var/log/oxidized.out.log 10 | environment=HOME='/home/oxidized/' 11 | -------------------------------------------------------------------------------- /extra/auto-reload-config.runit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z "$CONFIG_RELOAD_INTERVAL" ]; then 4 | # Just stop and do nothing 5 | read 6 | fi 7 | 8 | while true; do 9 | sleep $CONFIG_RELOAD_INTERVAL 10 | echo "Reloading config..." 11 | curl -s http://localhost:8888/reload?format=json -O /dev/null 12 | done 13 | -------------------------------------------------------------------------------- /extra/oxidized.service: -------------------------------------------------------------------------------- 1 | #For debian 8 put it in /lib/systemd/system/ 2 | #and call it with systemctl start oxidized.service 3 | 4 | [Unit] 5 | Description=Oxidized - Network Device Configuration Backup Tool 6 | 7 | [Service] 8 | ExecStart=/usr/local/bin/oxidized 9 | User=oxidized 10 | 11 | [Install] 12 | WantedBy=multi-user.target 13 | -------------------------------------------------------------------------------- /lib/oxidized/model/netonix.rb: -------------------------------------------------------------------------------- 1 | class Netonix < Oxidized::Model 2 | prompt /^[\w\s.@_\/:-]+#/ 3 | 4 | cmd :all do |cfg| 5 | cfg.each_line.to_a[1..-2].join 6 | end 7 | 8 | cmd 'cat config.json;echo' 9 | 10 | cfg :ssh do 11 | post_login 'cmdline' 12 | pre_logout 'exit' 13 | pre_logout 'exit' 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /bin/oxidized: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | 4 | # FIX ME, killing oxidized needs -9 5 | trap("INT") { exit } # sinatra will otherwise steal this from us 6 | 7 | begin 8 | require 'oxidized/cli' 9 | Oxidized::CLI.new.run 10 | rescue => error 11 | warn "#{error}" 12 | debug = Oxidied.config.debug rescue true 13 | raise if debug 14 | end 15 | -------------------------------------------------------------------------------- /extra/oxidized.upstart: -------------------------------------------------------------------------------- 1 | # by @andrewpwade in issue #45 2 | 3 | start on started networking 4 | 5 | respawn 6 | 7 | setuid oxidized 8 | setgid oxidized 9 | 10 | chdir /home/oxidized 11 | 12 | env HOME=/home/oxidized 13 | 14 | pre-start script 15 | test -x /usr/local/bin/oxidized || { stop; exit 0; } 16 | end script 17 | 18 | exec /usr/local/bin/oxidized 19 | -------------------------------------------------------------------------------- /extra/oxidized.nginx: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | listen [::]:80; 4 | 5 | server_name oxidized.example.com; 6 | 7 | location / { 8 | proxy_pass http://127.0.0.1:8888/; 9 | } 10 | 11 | access_log /var/log/nginx/access_oxidized.log; 12 | error_log /var/log/nginx/error_oxidized.log; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /extra/rvm.oxidized.upstart: -------------------------------------------------------------------------------- 1 | start on started networking 2 | 3 | respawn 4 | 5 | setuid oxidized 6 | setgid oxidized 7 | 8 | chdir /home/oxidized 9 | 10 | env HOME=/home/oxidized 11 | 12 | pre-start script 13 | test -x /usr/local/rvm/wrappers/ruby-2.1.2/oxidized || { stop; exit 0; } 14 | end script 15 | 16 | script 17 | exec /usr/local/rvm/wrappers/ruby-2.1.2/oxidized 18 | end script -------------------------------------------------------------------------------- /extra/oxidized.apache2: -------------------------------------------------------------------------------- 1 | 2 | # Place in sites-available 3 | 4 | ServerAdmin admin@example.com 5 | ServerName oxidized.example.com 6 | ServerAlias oxidized 7 | 8 | ProxyPass / http://127.0.0.1:8888/ 9 | ProxyPassReverse / http://127.0.0.1:8888/ 10 | 11 | ErrorLog /var/log/apache2/oxidized_error.log 12 | CustomLog /var/log/apache2/oxidized_access.log combined 13 | 14 | 15 | -------------------------------------------------------------------------------- /lib/oxidized/model/netscaler.rb: -------------------------------------------------------------------------------- 1 | class NetScaler < Oxidized::Model 2 | 3 | prompt /^\>\s*$/ 4 | comment '# ' 5 | 6 | cmd :all do |cfg| 7 | cfg.each_line.to_a[1..-3].join 8 | end 9 | 10 | cmd 'show version' do |cfg| 11 | comment cfg 12 | end 13 | 14 | cmd 'show hardware' do |cfg| 15 | comment cfg 16 | end 17 | 18 | cmd 'show ns ns.conf' 19 | 20 | cfg :ssh do 21 | pre_logout 'exit' 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /lib/oxidized/model/airos.rb: -------------------------------------------------------------------------------- 1 | class Airos < Oxidized::Model 2 | # Ubiquiti AirOS circa 5.x 3 | 4 | prompt /^[^#]+# / 5 | 6 | cmd 'cat /etc/board.info' do |cfg| 7 | cfg.split("\n").map { |line| "# #{line}" }.join("\n") + "\n" 8 | end 9 | 10 | cmd 'sort /tmp/system.cfg' 11 | 12 | cmd :secret do |cfg| 13 | cfg.gsub! /^(users\.\d+\.password|snmp\.community)=.+/, "# \\1=" 14 | cfg 15 | end 16 | 17 | cfg :ssh do 18 | exec true 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/oxidized/model/pfsense.rb: -------------------------------------------------------------------------------- 1 | class PfSense < Oxidized::Model 2 | 3 | # use other use than 'admin' user, 'admin' user cannot get ssh/exec. See issue #535 4 | 5 | cmd :all do |cfg| 6 | cfg.each_line.to_a[1..-2].join 7 | end 8 | 9 | cmd 'cat /cf/conf/config.xml' do |cfg| 10 | cfg.gsub! /\s\s*.*\s*