oxidized 0.30.1 → 0.31.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +2 -2
  3. data/.github/workflows/stale.yml +4 -2
  4. data/.rubocop.yml +18 -2
  5. data/.rubocop_todo.yml +5 -12
  6. data/CHANGELOG.md +61 -1
  7. data/CONTRIBUTING.md +5 -0
  8. data/Dockerfile +82 -21
  9. data/README.md +5 -21
  10. data/Rakefile +3 -2
  11. data/docs/Configuration.md +36 -12
  12. data/docs/Creating-Models.md +45 -4
  13. data/docs/Hooks.md +34 -0
  14. data/docs/Issues.md +91 -0
  15. data/docs/Model-Notes/Cumulus.md +5 -0
  16. data/docs/Model-Notes/FSOS.md +5 -0
  17. data/docs/Model-Notes/FortiOS.md +21 -5
  18. data/docs/Model-Notes/HPEAruba.md +31 -0
  19. data/docs/Model-Notes/OS6.md +10 -0
  20. data/docs/Model-Notes/RouterOS.md +15 -0
  21. data/docs/Model-Notes/SikluMHTG.md +7 -0
  22. data/docs/Outputs.md +2 -0
  23. data/docs/Release.md +18 -15
  24. data/docs/Sources.md +21 -0
  25. data/docs/Supported-OS-Types.md +11 -5
  26. data/docs/Troubleshooting.md +35 -0
  27. data/examples/device-simulation/README.md +173 -0
  28. data/examples/device-simulation/cmdsets/aoscx +9 -0
  29. data/examples/device-simulation/cmdsets/arubainstant +5 -0
  30. data/examples/device-simulation/cmdsets/asa +7 -0
  31. data/examples/device-simulation/cmdsets/ios +7 -0
  32. data/examples/device-simulation/cmdsets/nxos +5 -0
  33. data/examples/device-simulation/cmdsets/routeros +5 -0
  34. data/examples/device-simulation/cmdsets/srosmd +11 -0
  35. data/examples/device-simulation/device2yaml.rb +225 -0
  36. data/examples/device-simulation/yaml/aoscx_R0X25A-6410_FL.10.10.1100.yaml +2281 -0
  37. data/examples/device-simulation/yaml/aoscx_R8N85A-C6000-48G-CL4_PL.10.08.1010.yaml +451 -0
  38. data/examples/device-simulation/yaml/arubainstant_IAP515_8.10.0.6_VWLC.yaml +213 -0
  39. data/examples/device-simulation/yaml/asa_5512_9.12-4-67_single-context.yaml +531 -0
  40. data/examples/device-simulation/yaml/asr920_16.8.1b.yaml +1122 -0
  41. data/examples/device-simulation/yaml/garderos_R7709_003_006_068.yaml +101 -0
  42. data/examples/device-simulation/yaml/iosxe_C9200L-24P-4G_17.09.04a.yaml +514 -0
  43. data/examples/device-simulation/yaml/iosxe_C9800-L-F-K9_17.06.05.yaml +417 -0
  44. data/examples/device-simulation/yaml/riverbed_915.yaml +123 -0
  45. data/examples/device-simulation/yaml/routeros_CHR_7.10.1.yaml +145 -0
  46. data/examples/device-simulation/yaml/routeros_CHR_7.16.yaml +79 -0
  47. data/examples/device-simulation/yaml/routeros_L009UiGS_7.15.2.yaml +353 -0
  48. data/examples/podman-compose/Makefile +60 -17
  49. data/examples/podman-compose/README.md +63 -27
  50. data/examples/podman-compose/docker-compose.yml +11 -2
  51. data/examples/podman-compose/gitserver/.gitignore +1 -0
  52. data/examples/podman-compose/gitserver/Dockerfile +14 -0
  53. data/examples/podman-compose/model-simulation/Dockerfile-model +1 -1
  54. data/examples/podman-compose/model-simulation/asternos.sh +2 -0
  55. data/examples/podman-compose/oxidized-config/.gitignore +2 -0
  56. data/examples/podman-compose/oxidized-config/config +1 -1
  57. data/examples/podman-compose/oxidized-config/config_csv-file +46 -0
  58. data/examples/podman-compose/oxidized-config/config_csv-gitserver +56 -0
  59. data/examples/podman-compose/oxidized-ssh/.gitignore +1 -0
  60. data/lib/oxidized/config.rb +7 -1
  61. data/lib/oxidized/hook/githubrepo.rb +37 -7
  62. data/lib/oxidized/hook/slackdiff.rb +29 -7
  63. data/lib/oxidized/input/http.rb +1 -0
  64. data/lib/oxidized/input/telnet.rb +1 -1
  65. data/lib/oxidized/manager.rb +17 -16
  66. data/lib/oxidized/model/aoscx.rb +16 -2
  67. data/lib/oxidized/model/aosw.rb +7 -1
  68. data/lib/oxidized/model/arubainstant.rb +90 -0
  69. data/lib/oxidized/model/audiocodes.rb +2 -2
  70. data/lib/oxidized/model/cnos.rb +13 -10
  71. data/lib/oxidized/model/cumulus.rb +3 -0
  72. data/lib/oxidized/model/dlink.rb +1 -0
  73. data/lib/oxidized/model/dlinknextgen.rb +3 -0
  74. data/lib/oxidized/model/edgecos.rb +2 -1
  75. data/lib/oxidized/model/eos.rb +2 -0
  76. data/lib/oxidized/model/f5os.rb +17 -0
  77. data/lib/oxidized/model/firewareos.rb +10 -1
  78. data/lib/oxidized/model/fortios.rb +24 -1
  79. data/lib/oxidized/model/garderos.rb +43 -0
  80. data/lib/oxidized/model/h3c.rb +1 -1
  81. data/lib/oxidized/model/ibos.rb +1 -0
  82. data/lib/oxidized/model/ios.rb +20 -12
  83. data/lib/oxidized/model/iosxr.rb +1 -1
  84. data/lib/oxidized/model/lenovonos.rb +2 -0
  85. data/lib/oxidized/model/linuxgeneric.rb +1 -1
  86. data/lib/oxidized/model/netgear.rb +1 -1
  87. data/lib/oxidized/model/nodegrid.rb +1 -1
  88. data/lib/oxidized/model/nsxdfw.rb +30 -0
  89. data/lib/oxidized/model/nxos.rb +2 -1
  90. data/lib/oxidized/model/os6.rb +48 -0
  91. data/lib/oxidized/model/rgos.rb +1 -1
  92. data/lib/oxidized/model/riverbed.rb +104 -0
  93. data/lib/oxidized/model/routeros.rb +2 -2
  94. data/lib/oxidized/model/saos.rb +18 -1
  95. data/lib/oxidized/model/siklumhtg.rb +22 -0
  96. data/lib/oxidized/model/uplinkolt.rb +46 -0
  97. data/lib/oxidized/model/vyatta.rb +2 -2
  98. data/lib/oxidized/model/xos.rb +7 -0
  99. data/lib/oxidized/node.rb +30 -18
  100. data/lib/oxidized/nodes.rb +13 -5
  101. data/lib/oxidized/output/file.rb +45 -42
  102. data/lib/oxidized/output/git.rb +185 -160
  103. data/lib/oxidized/output/gitcrypt.rb +188 -186
  104. data/lib/oxidized/output/http.rb +53 -51
  105. data/lib/oxidized/output/output.rb +6 -4
  106. data/lib/oxidized/source/csv.rb +44 -49
  107. data/lib/oxidized/source/http.rb +63 -81
  108. data/lib/oxidized/source/jsonfile.rb +63 -0
  109. data/lib/oxidized/source/source.rb +43 -18
  110. data/lib/oxidized/source/sql.rb +66 -59
  111. data/lib/oxidized/version.rb +2 -2
  112. data/oxidized.gemspec +22 -16
  113. metadata +111 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 408f73ee50ed7040fab6c0034d197c5755f4d1042e8f9923ab8159fd90d36497
4
- data.tar.gz: 747b1a2c42d53a8eb1903b61119f7184b8fe78c2ea240d879523c6d8758cc42a
3
+ metadata.gz: 59670040bed3f1d863d073d2f87dfaa07f3918eef49c3a0f2bbf44b6b111c3cc
4
+ data.tar.gz: 7e1c5400732aaf05567e20c635bee4e9bd9d0d4254b1aec78f2cb69fb48c98a2
5
5
  SHA512:
6
- metadata.gz: 216511de21f3497c2cf36f22b379b3eba411e39e969544e7a6fb0d5ec60e725d2086621f8c803cfef3fb88655fd27d78a1973a2df947712a3ee124f7189c5293
7
- data.tar.gz: 567883bf03d9e46c0df4f4fead4e361f7a2b30e648cad01e994da14a705d99cd7e06763de9f8f8aedc87578757df02e2fad9bda343fd08dca22770d3478a4ebb
6
+ metadata.gz: 60fad3a803759b63ee5519d0abb7f60eedd397eef68fa0728009b41553698b0d6b45dbd1c02de235ca9b929849b63b6caff3e751d5c24cdcf7039f1096b8727c
7
+ data.tar.gz: ea896202d8ba22fae8f64ba596b48fd31bdca016dee62652a1ca3feb27be0c2d07328472c4f8fa96f3b001ffacdc37078555f0c6439dbe1aca9ce85cc32afe3d
@@ -19,7 +19,7 @@ jobs:
19
19
  runs-on: ubuntu-latest
20
20
  strategy:
21
21
  matrix:
22
- ruby-version: ['3.0', '3.1', '3.2']
22
+ ruby-version: ['3.1', '3.2', '3.3']
23
23
 
24
24
  steps:
25
25
  - uses: actions/checkout@v4
@@ -34,7 +34,7 @@ jobs:
34
34
  uses: reviewdog/action-rubocop@v2
35
35
  with:
36
36
  rubocop_version: gemfile
37
- rubocop_extensions: rubocop-minitest:gemfile rubocop-rake:gemfile
37
+ rubocop_extensions: rubocop-minitest:gemfile rubocop-rake:gemfile rubocop-sequel:gemfile
38
38
  reporter: github-pr-review
39
39
  - name: Run tests
40
40
  run: bundle exec rake
@@ -14,6 +14,8 @@ jobs:
14
14
  steps:
15
15
  - uses: actions/stale@v9
16
16
  with:
17
+ stale-issue-message: 'This issue is stale because it has been open 90 days with no activity.'
18
+ stale-pr-message: 'This PR is stale because it has been open 90 days with no activity.'
17
19
  operations-per-run: 500
18
- days-before-issue-stale: 90
19
- days-before-close: 30
20
+ days-before-stale: 90
21
+ days-before-close: -1
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ inherit_from: .rubocop_todo.yml
3
3
  # Do not attempt to police vendored code
4
4
  AllCops:
5
5
  NewCops: enable
6
- TargetRubyVersion: 3.0
6
+ TargetRubyVersion: 3.1
7
7
  Exclude:
8
8
  - 'vendor/**/*'
9
9
 
@@ -19,8 +19,12 @@ Style/FrozenStringLiteralComment:
19
19
  Layout/LineLength:
20
20
  Enabled: false
21
21
 
22
+ # We do not enforce the cop in the models as it would not work with the
23
+ # DSL style of the models
22
24
  Lint/AmbiguousRegexpLiteral:
23
- Enabled: false
25
+ Enabled: true
26
+ Exclude:
27
+ - lib/oxidized/model/*.rb
24
28
 
25
29
  Lint/RaiseException:
26
30
  Enabled: true
@@ -52,12 +56,19 @@ Style/FormatStringToken:
52
56
  Style/HashEachMethods:
53
57
  Enabled: true
54
58
 
59
+ Style/HashSyntax:
60
+ EnforcedShorthandSyntax: either
61
+
55
62
  Style/HashTransformKeys:
56
63
  Enabled: true
57
64
 
58
65
  Style/HashTransformValues:
59
66
  Enabled: true
60
67
 
68
+ Style/RegexpLiteral:
69
+ EnforcedStyle: slashes
70
+ AllowInnerSlashes: true
71
+
61
72
  Style/RescueModifier:
62
73
  Enabled: false
63
74
 
@@ -82,8 +93,12 @@ Metrics/ClassLength:
82
93
  ## Metrics/CyclomaticComplexity:
83
94
  ## Max: 7
84
95
 
96
+ # The BlockLength metric does not apply to unit tests. They are in nature
97
+ # long and not very pretty
85
98
  Metrics/BlockLength:
86
99
  Max: 150
100
+ Exclude:
101
+ - spec/**/*_spec.rb
87
102
 
88
103
  Metrics/ParameterLists:
89
104
  Max: 6
@@ -94,3 +109,4 @@ Lint/EmptyBlock:
94
109
  require:
95
110
  - rubocop-rake
96
111
  - rubocop-minitest
112
+ - rubocop-sequel
data/.rubocop_todo.yml CHANGED
@@ -1,22 +1,22 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2024-02-27 14:27:59 UTC using RuboCop version 1.60.2.
3
+ # on 2024-10-15 06:30:40 UTC using RuboCop version 1.66.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 27
9
+ # Offense count: 29
10
10
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
11
11
  Metrics/AbcSize:
12
12
  Enabled: false
13
13
 
14
- # Offense count: 17
14
+ # Offense count: 18
15
15
  # Configuration parameters: AllowedMethods, AllowedPatterns.
16
16
  Metrics/CyclomaticComplexity:
17
17
  Max: 12
18
18
 
19
- # Offense count: 14
19
+ # Offense count: 15
20
20
  # Configuration parameters: AllowedMethods, AllowedPatterns.
21
21
  Metrics/PerceivedComplexity:
22
22
  Max: 12
@@ -72,19 +72,12 @@ Style/OpenStructUse:
72
72
  - 'lib/oxidized/node.rb'
73
73
  - 'spec/hook/githubrepo_spec.rb'
74
74
 
75
- # Offense count: 47
76
- # This cop supports safe autocorrection (--autocorrect).
77
- # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
78
- # SupportedStyles: slashes, percent_r, mixed
79
- Style/RegexpLiteral:
80
- Enabled: false
81
-
82
75
  # Offense count: 31
83
76
  # This cop supports unsafe autocorrection (--autocorrect-all).
84
77
  Style/SlicingWithRange:
85
78
  Enabled: false
86
79
 
87
- # Offense count: 83
80
+ # Offense count: 85
88
81
  # This cop supports unsafe autocorrection (--autocorrect-all).
89
82
  # Configuration parameters: Mode.
90
83
  Style/StringConcatenation:
data/CHANGELOG.md CHANGED
@@ -4,6 +4,67 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
+ ## [0.31.0 – 2024-11-29]
8
+
9
+ ### Added
10
+ - model for Riverbed Steelhead (@Swaeltjie)
11
+ - model for uplink EP4440-DP OLT (@AAm-kun)
12
+ - model for Siklu Multihaul TG radios (@bdg-robert)
13
+ - model for VMWare NSX DFW (@elmobp)
14
+ - model for F5OS (@teunvink)
15
+ - cumulus: Add possibility to use NVUE (@lagertonne)
16
+ - model for garderos (@robertcheramy)
17
+ - unit tests framework for models with ssh input (@robertcheramy)
18
+ - os6: Added support to Dell EMC Networking OS6 (@anubisg1)
19
+ - model for HPE Aruba Networking Instant Mode (Aruba Instant). Fixes #3057 (@robertcheramy)
20
+ - Add JSONFILE source (@sargon)
21
+
22
+ ### Changed
23
+ - h3c: change prompt to expect either angle (user-view) or square (system-view) brackets (@nl987)
24
+ - xos: Hide radius and user secrets for XOS (@iriseden)
25
+ - eos: Hide radius and snmp secrets for Arista EOS (@iriseden)
26
+ - fortios: Hide date in acme certifcate comments (@systeembeheerder)
27
+ - dlink: added support for 'enable admin' before getting configuration, if enable=true (@as8net)
28
+ - dlinknextgen: strip uptime and ntp update time from config
29
+ - Updated slackdiff.rb to use slack_ruby_client instead of slack-api (@Punicaa)
30
+ - oxidized: options (such as credentials, etc.) now use the same resolution logic as variables and can also be defined per model in a group (@EinGlasVollKakao)
31
+ - saos: add inventory and software status collection (@grbeneke)
32
+ - container-image: update to phusion/baseimage:noble-1.0.0 and include security upgrades at build time (@robertcheramy)
33
+ - container-image: use ubuntu-packages instead of gems in order to reduce container image size (@robertcheramy)
34
+ - edgecos.rb: hide temperature and fan speed (@dhooper6430)
35
+ - cnos: show information before config, remove secrets only when told to do so (@robje)
36
+ - Updated slackdiff.rb to use new files.getUploadURLExternal slack file upload API instead of deprecated files.upload (@varesa)
37
+ - Updated source/output files to reference a Source/Output module to avoid namespace duplication (@laf, @robertcheramy)
38
+ - ios: Hide WLAN PSK, AP profile dot1x password, AP profile mgmtuser password/secret and radius COA server-key (@devon-mar)
39
+ - ios: remove values from custom SNMP OID's, set by an EEM script (@syn-bit)
40
+ - Update net-ssh to 7.3 to enable support for aes(128|256)gcm. Fixes #3168 (@jacobw)
41
+ - removed time command from uplink EP4440-DP OLT model
42
+ - fortios: variable `fullconfig` to get the configuration with default values. Fixes: #3159 (@robertcheramy)
43
+ - container-image: install x25519 gem package to support more ssh kex. Fixes #3070 (@benasse)
44
+ - lenovonos: Salt administrator-password line when remove_unstable_lines is set to True (@kani999)
45
+ - lenovonos: Removes lines that started with Fan because RPM always changes. (@kani999)
46
+
47
+ ### Fixed
48
+ - fixed error for ibos when remove_secret is set (@dminuoso)
49
+ - fixed prompt for Watchguard FirewareOS not matching the regex when the node is managed and master (@benasse)
50
+ - fixed prompt for vyos/vyatta to allow logins with non-priviliged accounts. Fixes #3111 (@h-lopez)
51
+ - fixed power consumption included in ArubaOS-CX diffs starting with FL.10.13.xxx. Fixes #3142 (@terratalpi)
52
+ - fixed oxidized-web getting "version not found" when fetching a version from git and no group is defined. Fixes #2222 (@robertcheramy)
53
+ - fixed telnet to disconnect gracefully even if it throws IOError while disconnect. Fixes #3212 (@ytti)
54
+ - docs: run git garbage collection to address performance issues. Fixes #3121 (@robertcheramy)
55
+ - saos: fixed handling of 'unsaved configuration' indicator in prompt (@grbeneke)
56
+ - rgos: also strip "System uptime" for installed modules (@spike77453)
57
+ - fixed digest authentication when using http input (@spike77453)
58
+ - fixed aosw prompt; now working with ArubaOS 8 (@mabezi, @robertcheramy)
59
+ - routeros: fix system info for CHR. Fixes #3180 (@systeembeheerder)
60
+ - removed hardcoded '~/.config/oxidized/config'. Fixes #3229 (@robertcheramy)
61
+ - linuxgeneric: updated prompt to support '$' at the end (@robertcheramy)
62
+ - hook githubrepo: add a specific warning when rugged not installed with ssh support. Fixes #3211 (@robertcheramy)
63
+ - hook githubrepo: works with custom branch names (@robertcheramy)
64
+ - ios: removes secrets when config has multiple snmp-server host lines. Fixes #3239 (@robertcheramy)
65
+ - ios: fixed device specs on ASR900 Series. Fixes #3297 (@robertcheramy, @roshnaraman)
66
+ - netgear: prompt for gs752tpp. Fixes #3287 (@robertcheramy)
67
+ - aoscx: fixed regex for 6400 switches to hide temperature and power (@steveneppler)
7
68
 
8
69
  ## [0.30.1 – 2024-04-12]
9
70
 
@@ -13,7 +74,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
13
74
  ### Fixed
14
75
  - The version string was not set correctly (@robertcheramy)
15
76
 
16
-
17
77
  ## [0.30.0 – 2024-04-11]
18
78
 
19
79
  ### Added
data/CONTRIBUTING.md CHANGED
@@ -6,6 +6,9 @@ A great place for users to get involved is the [GitHub issues](https://github.co
6
6
  Through the issues, you can interact with maintainers and other users. You can open an issue
7
7
  if you need help, but you can also help other users by reviewing their issues and commenting on them.
8
8
 
9
+ Before writing an issue, please read our documentation on
10
+ [how to write good issues](/docs/Issues.md).
11
+
9
12
  > ## Legal Notice
10
13
  > When submitting content to this project, you must agree that you have authored 100%
11
14
  > of the content, that you have the necessary rights to the content and that the
@@ -119,6 +122,8 @@ bundle config set --local path 'vendor/bundle'
119
122
  bundle install
120
123
  ```
121
124
 
125
+ Note: if you need to install rugged with ssh support, you can tell bundler so with `bundle config build.rugged --with-ssh`. Reinstall rugged with `bundle pristine rugged`
126
+
122
127
  ### Run your code
123
128
  ```bash
124
129
  bundle exec bin/oxidized
data/Dockerfile CHANGED
@@ -1,39 +1,45 @@
1
- # Single-stage build of an oxidized container from phusion/baseimage-docker jammy-1.0.1, derived from Ubuntu 22.04 (Jammy Jellyfish)
2
- FROM docker.io/phusion/baseimage:jammy-1.0.1
1
+ ###################
2
+ # Stage 1: Prebuild to save space in the final image.
3
3
 
4
- # set up dependencies for the build process
5
- RUN apt-get -yq update \
6
- && apt-get -yq --no-install-recommends install ruby3.0 ruby3.0-dev libssl3 bzip2 libssl-dev pkg-config make cmake libssh2-1 libssh2-1-dev git git-email libmailtools-perl g++ libffi-dev ruby-bundler libicu70 libicu-dev libsqlite3-0 libsqlite3-dev libmysqlclient21 libmysqlclient-dev libpq5 libpq-dev zlib1g-dev msmtp \
7
- && apt-get clean \
8
- && rm -rf /var/lib/apt/lists/*
4
+ FROM docker.io/phusion/baseimage:noble-1.0.0 AS prebuilder
9
5
 
10
- # dependencies for hooks
11
- RUN gem install --no-document aws-sdk slack-ruby-client xmpp4r cisco_spark
6
+ # install necessary packages for building gems
7
+ RUN apt-get update && apt-get install -y \
8
+ build-essential \
9
+ git \
10
+ ruby-dev \
11
+ && rm -rf /var/lib/apt/lists/*
12
12
 
13
- # dependencies for sources
14
- RUN gem install --no-document gpgme sequel sqlite3 mysql2 pg
13
+ # create bundle directory
14
+ RUN mkdir -p /usr/local/bundle
15
+ ENV GEM_HOME=/usr/local/bundle
15
16
 
16
- # dependencies for inputs
17
- RUN gem install --no-document net-tftp net-http-persistent mechanize
17
+ ###################
18
+ # Install the x25519 gem
19
+ RUN gem install x25519 --no-document
18
20
 
19
- # build and install oxidized
21
+ ###################
22
+ # build oxidized
20
23
  COPY . /tmp/oxidized/
21
24
  WORKDIR /tmp/oxidized
22
25
 
23
26
  # docker automated build gets shallow copy, but non-shallow copy cannot be unshallowed
24
27
  RUN git fetch --unshallow || true
25
28
 
29
+ # Remove any older gems of oxidized if they exist
30
+ RUN rm pkg/* || true
31
+
26
32
  # Ensure rugged is built with ssh support
27
- RUN CMAKE_FLAGS='-DUSE_SSH=ON' rake install
33
+ RUN rake build
28
34
 
29
- # web interface
30
- RUN gem install oxidized-web --no-document
31
35
 
32
- # clean up
33
- WORKDIR /
34
- RUN rm -rf /tmp/oxidized
35
- RUN apt-get -yq --purge autoremove ruby-dev pkg-config make cmake ruby-bundler libssl-dev libssh2-1-dev libicu-dev libsqlite3-dev libmysqlclient-dev libpq-dev zlib1g-dev
36
+ ###################
37
+ # Stage2: build an oxidized container from phusion/baseimage-docker and install x25519 from stage1
38
+ FROM docker.io/phusion/baseimage:noble-1.0.0
36
39
 
40
+ ENV DEBIAN_FRONTEND=noninteractive
41
+
42
+ ##### Place "static" commands at the beginning to optimize image size and build speed
37
43
  # add non-privileged user
38
44
  ARG UID=30000
39
45
  ARG GID=$UID
@@ -55,4 +61,59 @@ COPY extra/oxidized.runit /etc/service/oxidized/run
55
61
  COPY extra/auto-reload-config.runit /etc/service/auto-reload-config/run
56
62
  COPY extra/update-ca-certificates.runit /etc/service/update-ca-certificates/run
57
63
 
64
+ # set up dependencies for the build process
65
+ RUN apt-get -yq update \
66
+ && apt-get -yq upgrade \
67
+ && apt-get -yq --no-install-recommends install ruby \
68
+ # Build process of oxidized from git (beloww)
69
+ git \
70
+ # Allow git send-email from docker image
71
+ git-email libmailtools-perl \
72
+ # Allow sending emails in the docker container
73
+ msmtp \
74
+ # Debuging tools inside the container
75
+ inetutils-telnet \
76
+ # Use ubuntu gems where possible
77
+ # Gems needed by oxidized
78
+ ruby-rugged ruby-slop ruby-psych \
79
+ ruby-net-telnet ruby-net-ssh ruby-net-ftp ruby-net-scp ruby-ed25519 \
80
+ # Gem dependencies for inputs
81
+ ruby-net-http-persistent ruby-mechanize \
82
+ # Gem dependencies for sources
83
+ ruby-sqlite3 ruby-mysql2 ruby-pg ruby-sequel ruby-gpgme\
84
+ # Gem dependencies for hooks
85
+ ruby-aws-sdk ruby-xmpp4r \
86
+ # Gems needed by oxidized-web
87
+ ruby-charlock-holmes ruby-haml ruby-htmlentities ruby-json \
88
+ puma ruby-sinatra ruby-sinatra-contrib \
89
+ && apt-get clean \
90
+ && rm -rf /var/lib/apt/lists/*
91
+
92
+ # copy the compiled gem from the builder stage
93
+ COPY --from=prebuilder /usr/local/bundle /usr/local/bundle
94
+
95
+ # Set environment variables for bundler
96
+ ENV GEM_HOME="/usr/local/bundle"
97
+ ENV PATH="$GEM_HOME/bin:$PATH"
98
+
99
+ # gems not available in ubuntu noble
100
+ RUN gem install --no-document \
101
+ # dependencies for hooks
102
+ slack-ruby-client cisco_spark \
103
+ # dependencies for specific inputs
104
+ net-tftp
105
+
106
+ # install oxidized from prebuilder
107
+ # The Dockerfile ist version-independent, so use oxidized-*.gem to cach the gem
108
+ RUN mkdir -p /tmp/oxidized
109
+ COPY --from=prebuilder /tmp/oxidized/pkg/oxidized-*.gem /tmp/oxidized/
110
+ RUN gem install /tmp/oxidized/oxidized-*.gem
111
+
112
+ # install oxidized-web
113
+ RUN gem install oxidized-web --no-document
114
+
115
+ # clean up
116
+ WORKDIR /
117
+ RUN rm -rf /tmp/oxidized
118
+
58
119
  EXPOSE 8888/tcp
data/README.md CHANGED
@@ -101,23 +101,7 @@ gem install oxidized-script oxidized-web # If you don't install oxidized-web, en
101
101
 
102
102
  ### CentOS, Oracle Linux, Red Hat Linux
103
103
 
104
- On CentOS 6 and 7 / RHEL 6 and 7, begin by installing Ruby 2.3 or greater. This can be accomplished in one of several ways:
105
-
106
- Install Ruby 2.3 from [SCL](https://www.softwarecollections.org/en/scls/rhscl/rh-ruby23/):
107
-
108
- ```shell
109
- yum install centos-release-scl
110
- yum install rh-ruby30 rh-ruby30-ruby-devel
111
- scl enable rh-ruby30 bash
112
- ```
113
-
114
- The following additional packages will be required to build the dependencies:
115
-
116
- ```shell
117
- yum install make cmake which sqlite-devel openssl-devel libssh2-devel ruby gcc ruby-devel libicu-devel gcc-c++
118
- ```
119
-
120
- Alternatively, install Ruby 2.6 via RVM by following the instructions:
104
+ On CentOS 6 and 7 / RHEL 6 and 7, begin by installing Ruby 3.1 via RVM by following the instructions:
121
105
 
122
106
  Make sure you dont have any leftover ruby:
123
107
  ```yum erase ruby```
@@ -129,8 +113,8 @@ sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A17031138
129
113
  curl -sSL https://get.rvm.io | bash -s stable
130
114
  source /etc/profile.d/rvm.sh
131
115
  rvm requirements run
132
- rvm install 3.0
133
- rvm use 3.0
116
+ rvm install 3.1
117
+ rvm use 3.1
134
118
  ```
135
119
 
136
120
  Install oxidized requirements:
@@ -200,7 +184,7 @@ Run the container for the first time to initialize the config:
200
184
  _Note: this step in only required for creating the Oxidized configuration file and can be skipped if you already have one._
201
185
 
202
186
  ```shell
203
- docker run --rm -v /etc/oxidized:/home/oxidized/.config/oxidized -p 8888:8888/tcp -t oxidized/oxidized:latest oxidized
187
+ docker run --rm -v /etc/oxidized:/home/oxidized/.config/oxidized -p 8888:8888/tcp --user oxidized -t oxidized/oxidized:latest oxidized
204
188
  ```
205
189
 
206
190
  If the RESTful API and Web Interface are enabled, on the docker host running the container
@@ -295,7 +279,7 @@ It is recommended practice to run Oxidized using its own username. This usernam
295
279
  useradd -s /bin/bash -m oxidized
296
280
  ```
297
281
 
298
- > It is recommended __not__ to run Oxidized as root.
282
+ > It is recommended __not__ to run Oxidized as root. After creating a dedicated user, switch to the oxidized user using su oxidized to ensure that Oxidized is run under the correct user context.
299
283
 
300
284
  To initialize a default configuration in your home directory `~/.config/oxidized/config`, simply run `oxidized` once. If you don't further configure anything from the output and source sections, it'll extend the examples on a subsequent `oxidized` execution. This is useful to see what options for a specific source or output backend are available.
301
285
 
data/Rakefile CHANGED
@@ -27,7 +27,8 @@ task :test do
27
27
  Rake::TestTask.new do |t|
28
28
  t.libs << 'spec'
29
29
  t.test_files = FileList['spec/**/*_spec.rb']
30
- t.warning = true
30
+ # Don't display ambiguity warning between regexp and division in models
31
+ t.warning = false
31
32
  t.verbose = true
32
33
  end
33
34
  end
@@ -75,7 +76,7 @@ task :chmod do
75
76
  extra/update-ca-certificates.runit
76
77
  ]
77
78
  dirs = []
78
- %x(git ls-files -z).split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }.each do |file|
79
+ %x(git ls-files -z).split("\x0").reject { |f| f.match(/^(test|spec|features)\//) }.each do |file|
79
80
  dirs.push(File.dirname(file))
80
81
  xbit.include?(file) ? File.chmod(0o0755, file) : File.chmod(0o0644, file)
81
82
  end
@@ -9,7 +9,7 @@ The following example will log an active ssh/telnet session `/home/oxidized/.con
9
9
  ```yaml
10
10
  log: /home/oxidized/.config/oxidized/log
11
11
 
12
- ...
12
+ # ...
13
13
 
14
14
  input:
15
15
  default: ssh, telnet
@@ -45,7 +45,7 @@ As a partial example from ios.rb:
45
45
  ```ruby
46
46
  cmd :secret do |cfg|
47
47
  cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
48
- (...)
48
+ # ...
49
49
  cfg
50
50
  end
51
51
  ```
@@ -98,14 +98,14 @@ vars:
98
98
  Per-Node:
99
99
 
100
100
  ```yaml
101
- ...
101
+ # ...
102
102
  map:
103
103
  name: 0
104
104
  model: 1
105
105
  vars_map:
106
106
  enable: 2
107
107
  ssh_keys: 3
108
- ...
108
+ # ...
109
109
  ```
110
110
 
111
111
  If you are using a non-standard path, especially when copying the private key via a secured channel, make sure that the permissions are set correctly:
@@ -131,7 +131,7 @@ This can be provided on a per-node basis by mapping the proper fields from your
131
131
  An example for a `csv` input source that maps the 4th field as the `ssh_proxy` value and the 5th field as `ssh_proxy_port`.
132
132
 
133
133
  ```yaml
134
- ...
134
+ # ...
135
135
  map:
136
136
  name: 0
137
137
  model: 1
@@ -139,7 +139,7 @@ vars_map:
139
139
  enable: 2
140
140
  ssh_proxy: 3
141
141
  ssh_proxy_port: 4
142
- ...
142
+ # ...
143
143
  ```
144
144
 
145
145
  ## SSH enabling legacy algorithms
@@ -149,7 +149,7 @@ When connecting to older firmware over SSH, it is sometimes necessary to enable
149
149
  These settings can be provided on a per-node basis by mapping the ssh_kex, ssh_host_key, ssh_hmac and the ssh_encryption fields from you source.
150
150
 
151
151
  ```yaml
152
- ...
152
+ # ...
153
153
  map:
154
154
  name: 0
155
155
  model: 1
@@ -159,7 +159,7 @@ vars_map:
159
159
  ssh_host_key: 4
160
160
  ssh_hmac: 5
161
161
  ssh_encryption: 6
162
- ...
162
+ # ...
163
163
  ```
164
164
 
165
165
  ## FTP Passive Mode
@@ -242,13 +242,15 @@ groups:
242
242
  password: ubnt
243
243
  ```
244
244
 
245
- Model specific variables within groups
245
+ Model specific variables/credentials within groups
246
246
 
247
247
  ```yaml
248
248
  groups:
249
249
  foo:
250
250
  models:
251
251
  arista:
252
+ username: admin
253
+ password: password
252
254
  vars:
253
255
  ssh_keys: "~/.ssh/id_rsa_foo_arista"
254
256
  vyatta:
@@ -260,6 +262,8 @@ groups:
260
262
  vars:
261
263
  ssh_keys: "~/.ssh/id_rsa_bar_routeros"
262
264
  vyatta:
265
+ username: admin
266
+ password: pass
263
267
  vars:
264
268
  ssh_keys: "~/.ssh/id_rsa_bar_vyatta"
265
269
  ```
@@ -273,16 +277,16 @@ group_map:
273
277
  alias3: groupB
274
278
  alias4: groupB
275
279
  aliasN: groupZ
276
- ...
280
+ # ...
277
281
  ```
278
282
 
279
283
  add group mapping to a source
280
284
 
281
285
  ```yaml
282
286
  source:
283
- ...
287
+ # ...
284
288
  <source>:
285
- ...
289
+ # ...
286
290
  map:
287
291
  model: 0
288
292
  name: 1
@@ -311,15 +315,35 @@ models:
311
315
  password: pass
312
316
  ```
313
317
 
318
+ ### Options (credentials, vars, etc.) precedence:
319
+ From least to most important:
320
+ - global options
321
+ - model specific options
322
+ - group specific options
323
+ - model specific options in groups
324
+ - options defined on single nodes
325
+
326
+ More important options overwrite less important ones if they are set.
327
+
314
328
  ## RESTful API and Web Interface
315
329
 
316
330
  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.
317
331
 
332
+ ```yaml
333
+ # Listen on http://[::1]:8888/
334
+ rest: "[::1]:8888"
335
+ ```
336
+
318
337
  ```yaml
319
338
  # Listen on http://127.0.0.1:8888/
320
339
  rest: 127.0.0.1:8888
321
340
  ```
322
341
 
342
+ ```yaml
343
+ # Listen on http://[2001:db8:0:face:b001:0:dead:beaf]:8888/oxidized/
344
+ rest: "[2001:db8:0:face:b001:0:dead:beaf]:8888"
345
+ ```
346
+
323
347
  ```yaml
324
348
  # Listen on http://10.0.0.1:8000/oxidized/
325
349
  rest: 10.0.0.1:8000/oxidized