oxidized 0.34.3 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/.coderabbit.yaml +21 -0
  3. data/.github/workflows/codeql.yml +4 -4
  4. data/.github/workflows/publishdocker.yml +88 -15
  5. data/.github/workflows/ruby.yml +2 -4
  6. data/.github/workflows/stale.yml +1 -1
  7. data/.rubocop.yml +14 -2
  8. data/.rubocop_todo.yml +21 -2
  9. data/CHANGELOG.md +86 -1
  10. data/Dockerfile +74 -66
  11. data/README.md +4 -5
  12. data/Rakefile +21 -3
  13. data/docs/Configuration.md +122 -1
  14. data/docs/Creating-Models.md +209 -28
  15. data/docs/Docker.md +2 -1
  16. data/docs/Inputs.md +29 -0
  17. data/docs/Model-Notes/APC.md +72 -0
  18. data/docs/Model-Notes/ExaLink.md +43 -0
  19. data/docs/Model-Notes/Fortinet.md +75 -0
  20. data/docs/Model-Notes/IvantiConnectSecure.md +59 -0
  21. data/docs/Model-Notes/TrueNAS.md +19 -0
  22. data/docs/ModelUnitTests.md +23 -0
  23. data/docs/Outputs.md +18 -4
  24. data/docs/Release.md +1 -1
  25. data/docs/Ruby-API.md +134 -1
  26. data/docs/Supported-OS-Types.md +22 -8
  27. data/docs/Troubleshooting.md +1 -1
  28. data/extra/device2yaml.rb +2 -3
  29. data/extra/hooks/modelrules.rb +55 -0
  30. data/extra/hooks/modelrulesadvanced.rb +168 -0
  31. data/extra/hooks/srcipmap.rb +54 -0
  32. data/extra/oxidized.runit +1 -1
  33. data/lib/oxidized/core.rb +2 -1
  34. data/lib/oxidized/hook/githubrepo.rb +2 -1
  35. data/lib/oxidized/hook.rb +56 -8
  36. data/lib/oxidized/input/exec.rb +0 -4
  37. data/lib/oxidized/input/ftp.rb +0 -13
  38. data/lib/oxidized/input/http.rb +47 -15
  39. data/lib/oxidized/input/input.rb +33 -13
  40. data/lib/oxidized/input/scp.rb +11 -65
  41. data/lib/oxidized/input/ssh.rb +12 -62
  42. data/lib/oxidized/input/sshbase.rb +107 -0
  43. data/lib/oxidized/input/telnet.rb +2 -6
  44. data/lib/oxidized/input/tftp.rb +7 -3
  45. data/lib/oxidized/model/adva.rb +1 -1
  46. data/lib/oxidized/model/airfiber.rb +1 -1
  47. data/lib/oxidized/model/aoscx.rb +32 -45
  48. data/lib/oxidized/model/aosw.rb +11 -12
  49. data/lib/oxidized/model/apc_aos.rb +4 -0
  50. data/lib/oxidized/model/apcaos.rb +39 -0
  51. data/lib/oxidized/model/arubainstant.rb +29 -26
  52. data/lib/oxidized/model/asa.rb +7 -7
  53. data/lib/oxidized/model/asternos.rb +1 -1
  54. data/lib/oxidized/model/axos.rb +1 -1
  55. data/lib/oxidized/model/comtrol.rb +1 -1
  56. data/lib/oxidized/model/comware.rb +3 -1
  57. data/lib/oxidized/model/cumulus.rb +2 -7
  58. data/lib/oxidized/model/defacto.rb +26 -0
  59. data/lib/oxidized/model/dslcommands.rb +93 -0
  60. data/lib/oxidized/model/dslsetup.rb +102 -0
  61. data/lib/oxidized/model/eatonnetwork.rb +5 -0
  62. data/lib/oxidized/model/efos.rb +5 -5
  63. data/lib/oxidized/model/eltex.rb +1 -1
  64. data/lib/oxidized/model/enterasys800.rb +1 -1
  65. data/lib/oxidized/model/exalink.rb +36 -0
  66. data/lib/oxidized/model/fabricos.rb +1 -1
  67. data/lib/oxidized/model/fastiron.rb +2 -2
  68. data/lib/oxidized/model/firelinuxos.rb +1 -3
  69. data/lib/oxidized/model/fortigate.rb +160 -0
  70. data/lib/oxidized/model/fortios.rb +28 -69
  71. data/lib/oxidized/model/fsos.rb +2 -4
  72. data/lib/oxidized/model/garderos.rb +1 -6
  73. data/lib/oxidized/model/h3c.rb +1 -1
  74. data/lib/oxidized/model/ios.rb +21 -15
  75. data/lib/oxidized/model/ironware.rb +6 -4
  76. data/lib/oxidized/model/ivanti.rb +54 -0
  77. data/lib/oxidized/model/macros.rb +60 -0
  78. data/lib/oxidized/model/mlnxos.rb +14 -17
  79. data/lib/oxidized/model/model.rb +89 -98
  80. data/lib/oxidized/model/ndms.rb +6 -0
  81. data/lib/oxidized/model/netgear.rb +6 -3
  82. data/lib/oxidized/model/netonix.rb +1 -1
  83. data/lib/oxidized/model/netscaler.rb +1 -1
  84. data/lib/oxidized/model/nxos.rb +9 -9
  85. data/lib/oxidized/model/onefinity.rb +1 -1
  86. data/lib/oxidized/model/opnsense.rb +8 -0
  87. data/lib/oxidized/model/outputs.rb +5 -0
  88. data/lib/oxidized/model/perle.rb +41 -0
  89. data/lib/oxidized/model/pfsense.rb +8 -0
  90. data/lib/oxidized/model/saos10.rb +1 -1
  91. data/lib/oxidized/model/siklu.rb +1 -1
  92. data/lib/oxidized/model/siklumhtg.rb +1 -1
  93. data/lib/oxidized/model/sixwind.rb +1 -1
  94. data/lib/oxidized/model/slxos.rb +1 -1
  95. data/lib/oxidized/model/smartbyte.rb +48 -0
  96. data/lib/oxidized/model/sonicos.rb +1 -1
  97. data/lib/oxidized/model/speedtouch.rb +1 -1
  98. data/lib/oxidized/model/telco.rb +1 -1
  99. data/lib/oxidized/model/tnsr.rb +7 -3
  100. data/lib/oxidized/model/trango.rb +1 -1
  101. data/lib/oxidized/model/truenas.rb +10 -1
  102. data/lib/oxidized/model/ucs.rb +1 -1
  103. data/lib/oxidized/model/voltaire.rb +1 -1
  104. data/lib/oxidized/model/voss.rb +3 -0
  105. data/lib/oxidized/model/vyatta.rb +1 -1
  106. data/lib/oxidized/model/vyos.rb +36 -0
  107. data/lib/oxidized/model/zhoneolt.rb +1 -1
  108. data/lib/oxidized/model/zynoscli.rb +1 -1
  109. data/lib/oxidized/node.rb +31 -24
  110. data/lib/oxidized/nodes.rb +2 -0
  111. data/lib/oxidized/output/file.rb +7 -1
  112. data/lib/oxidized/output/git.rb +11 -1
  113. data/lib/oxidized/output/gitcrypt.rb +1 -1
  114. data/lib/oxidized/output/http.rb +12 -3
  115. data/lib/oxidized/source/csv.rb +5 -0
  116. data/lib/oxidized/source/http.rb +10 -2
  117. data/lib/oxidized/source/jsonfile.rb +5 -0
  118. data/lib/oxidized/source/sql.rb +5 -0
  119. data/lib/oxidized/version.rb +2 -2
  120. data/lib/oxidized/worker.rb +36 -15
  121. data/lib/refinements.rb +18 -0
  122. data/oxidized.gemspec +28 -25
  123. metadata +98 -71
  124. data/docs/Model-Notes/APC_AOS.md +0 -65
  125. data/docs/Model-Notes/FortiOS.md +0 -44
  126. data/lib/oxidized/model/timos.rb +0 -10
@@ -0,0 +1,59 @@
1
+ ### Ivanti Connect Secure (ICS)
2
+
3
+ #### Overview
4
+
5
+ This model provides support for Ivanti Connect Secure (ICS) appliances using REST API ([official documentation](https://help.ivanti.com/ps/help/en_US/ICS/22.x/22.7R2/22.xICSAG.pdf)).
6
+ ICS stores its configuration as a binary ZIP archive (with `system.cfg` and `user.cfg` files) which is retrieved using the `/api/v1/system/binary-configuration` endpoint.
7
+
8
+ The model performs an initial authentication against `/api/v1/realm_auth` using Basic Auth (`username`/`password`) and retrieves a temporary `api_key`.
9
+ This key is then used for all further API requests during the Oxidized collection cycle.
10
+
11
+ The model is designed to work with standard ICS deployments without requiring command-line access to the device.
12
+
13
+ #### How Configuration Is Retrieved
14
+
15
+ 1. Oxidized authenticates using:
16
+
17
+ ```bash
18
+ POST /api/v1/realm_auth
19
+ ```
20
+
21
+ with:
22
+ - Basic Auth: `username` + `password`
23
+ - JSON body `{"realm": "<realm>"}`
24
+
25
+
26
+ 2. ICS returns a temporary:
27
+
28
+ ```json
29
+ { "api_key": "<token>" }
30
+ ```
31
+
32
+
33
+ 3. The configuration is fetched from:
34
+
35
+ ```bash
36
+ GET /api/v1/system/binary-configuration
37
+ ```
38
+
39
+ with:
40
+ - `api_key` as `username`
41
+ - `''` as `password`
42
+
43
+ ICS responds with a BASE64-encoded ZIP archive containing the device configuration.
44
+ The model stores this BASE64 value as a single uninterrupted line.
45
+
46
+
47
+ #### Required Node Configuration
48
+
49
+ In source (CSV, HTTP, SQL, etc.), simply define:
50
+
51
+ ```yaml
52
+ model: ivanti
53
+ username: <your username>
54
+ password: <your password>
55
+ vars:
56
+ realm: <your realm> # Optional, default = "Users"
57
+ ```
58
+
59
+ The model will automatically handle authentication and obtain the API key as stated above.
@@ -0,0 +1,19 @@
1
+ # TrueNAS
2
+
3
+ This should support both older TrueNAS CORE (FreeBSD-based) and newer
4
+ TrueNAS SCALE (Linux-based) devices.
5
+
6
+ ## Authentication
7
+
8
+ Ensure that the user configured for oxidized to login to your device has the
9
+ permissions to read the configuration database. On older devices, this would
10
+ just work.
11
+
12
+ On newer devices, the `/data/freenas-v1.db` file can only be read by the
13
+ root user. You can make sure that the user that oxidized uses to login
14
+ (`oxidized` in this example) can dump the configuration using `sudo` by
15
+ adding something like this to your `/etc/sudoers` file:
16
+
17
+ ```
18
+ oxidized ALL=(ALL) NOPASSWD: /usr/bin/sqlite3 file\:///data/freenas-v1.db?mode\=ro&immutable\=1 .dump
19
+ ```
@@ -4,6 +4,7 @@ effort to use. There are three different default unit tests for models:
4
4
  - [Device Simulation](ModelUnitTests.md#device-simulation)
5
5
  - [Device Prompt](ModelUnitTests.md#device-prompt)
6
6
  - [Secrets](ModelUnitTests.md#secrets)
7
+ - [Significant Changes](ModelUnitTests.md#significant-changes)
7
8
 
8
9
  You only need to provide test files under [/spec/model/data](/spec/model/data),
9
10
  and the tests will be run automatically with `rake test`. See
@@ -187,6 +188,28 @@ pass:
187
188
  - 'hash-mgmt-user rocks password hash <secret removed> usertype read-only'
188
189
  ```
189
190
 
191
+ ## Significant Changes
192
+ You can test if the model correctly detects significant changes from a YAML
193
+ simulation file (`#simulation.yaml`) when run with variable
194
+ `output_store_mode` set to `on_significant`.
195
+
196
+ The output is checked against a file with the same
197
+ prefix as the yaml simulation file, but with the suffix
198
+ `#significant_changes.yaml`.
199
+
200
+ The `#significant_changes.yaml` file contains two sections with a list of
201
+ strings or regular expressions to test:
202
+ - pass: the test passes only if the output contains these strings (significant changes).
203
+ - fail: the test fails if the output contain these strings (non-significant changes).
204
+
205
+ ```yaml
206
+ pass:
207
+ - "! Processor ID: FCL2XXXXXXX"
208
+ fail:
209
+ - "! Last configuration change at 13:57:08 CET Wed Mar 13 2024"
210
+ - "! NVRAM config last updated at 15:26:39 CET Wed Mar 13 2024 by oxidized"
211
+ ```
212
+
190
213
  ## Custom tests
191
214
  When you write custom tests for your models, please do not use the filenames
192
215
  mentioned above, as it will interfere with the standard tests. If you need to
data/docs/Outputs.md CHANGED
@@ -211,9 +211,9 @@ output:
211
211
 
212
212
  Please note that user list is only updated once at creation.
213
213
 
214
- ## Output: Http
214
+ ## Output: HTTP
215
215
 
216
- The HTTP output will POST a config to the specified HTTP URL. Basic username/password authentication is supported.
216
+ The HTTP output will POST a config as JSON to the specified HTTP URL. It supports HTTP Basic Authentication, custom headers, and SSL/TLS verification control.
217
217
 
218
218
  Example HTTP output configuration:
219
219
 
@@ -221,11 +221,25 @@ Example HTTP output configuration:
221
221
  output:
222
222
  default: http
223
223
  http:
224
- user: admin
225
- password: changeit
226
224
  url: "http://192.168.162.50:8080/db/coll"
225
+ user: admin # Optional - for HTTP basic auth
226
+ password: changeit # Optional - for HTTP basic auth
227
+ ssl_verify: false # Optional - verify SSL certs (default: false)
228
+ headers: # Optional - custom HTTP headers
229
+ X-Custom-Header: "value"
230
+ X-API-Key: "secret"
227
231
  ```
228
232
 
233
+ ### Configuration Options
234
+
235
+ | Option | Required | Description |
236
+ |--------------|----------|---------------------------------------------------------|
237
+ | `url` | Yes | Full HTTP/HTTPS URL to POST the config to |
238
+ | `user` | No | Username for HTTP Basic Authentication |
239
+ | `password` | No | Password for HTTP Basic Authentication |
240
+ | `ssl_verify` | No | When `true`, verify SSL certificates (default: `false`) |
241
+ | `headers` | No | Hash of custom HTTP headers to include in the request |
242
+
229
243
  ## Output types
230
244
 
231
245
  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).
data/docs/Release.md CHANGED
@@ -61,7 +61,7 @@ They test different ruby versions an run security checks on the code (codeql).
61
61
  6. Install an test the gem locally
62
62
  ```shell
63
63
  gem install --user-install pkg/oxidized-0.xx.yy.gem
64
- ~/.local/share/gem/ruby/3.1.0/bin/oxidized
64
+ ~/.local/share/gem/ruby/3.3.0/bin/oxidized
65
65
  ```
66
66
 
67
67
  ## Release in github
data/docs/Ruby-API.md CHANGED
@@ -2,6 +2,40 @@
2
2
 
3
3
  The following objects exist in Oxidized.
4
4
 
5
+ ## Index
6
+ - [Input](#input)
7
+ - [http](#http)
8
+ - [Output](#output)
9
+ - [Source](#source)
10
+ - [Model](#model)
11
+ - [At the top level](#at-the-top-level)
12
+ - [cfg](#cfg)
13
+ - [inputs](#inputs)
14
+ - [cmd](#cmd)
15
+ - [comment](#comment)
16
+ - [prompt](#prompt)
17
+ - [expect](#expect)
18
+ - [pre / post](#pre--post)
19
+ - [macro :enable](#macro-enable)
20
+ - [clean :escape_codes](#clean-escape_codes)
21
+ - [clean :cut](#clean-cut)
22
+ - [At the second level](#at-the-second-level)
23
+ - [comment](#comment-1)
24
+ - [password](#password)
25
+ - [post_login](#post_login)
26
+ - [pre_logout](#pre_logout)
27
+ - [send](#send)
28
+ - [cmd](#cmd-1)
29
+ - [Monkey patching](#monkey-patching)
30
+ - [clear: true](#clear-true)
31
+ - [prepend: true](#prepend-true)
32
+ - [Refinements - String Convenience Methods](#refinements)
33
+ - [cut_tail](#cut_tail)
34
+ - [cut_head](#cut_head)
35
+ - [cut_both](#cut_both)
36
+ - [keep_lines](#keep_lines)
37
+ - [reject_lines](#reject_lines)
38
+
5
39
  ## Input
6
40
 
7
41
  * gets config from nodes
@@ -59,6 +93,40 @@ The block may contain commands to change some behaviour for the given methods
59
93
 
60
94
  Supports [monkey patching](#monkey-patching).
61
95
 
96
+ #### 'inputs'
97
+ `inputs` can be used to specify multiple inputs to be run on the model. It
98
+ takes a list of either input symbols or lists of input symbols:
99
+ ```ruby
100
+ inputs [:ssh, %i[scp ftp]]
101
+ inputs [:ssh, :scp]
102
+ ```
103
+
104
+ Oxidized will run the model against each item of `inputs`. If an item is a
105
+ list of symbols (`%i[scp ftp]`), it will try each input in the order
106
+ configured in the `input/default` section of the oxidized configuration file.
107
+
108
+ If `inputs` is not specified, Oxidized will try each input that has a `cfg`
109
+ section in the model, in the order configured in the `input/default` section
110
+ of the oxidized configuration file.
111
+
112
+ To specify which command is to run against which input, use the `input`
113
+ parameter of the `cmd` configuration:
114
+ ```ruby
115
+ cmd 'upsabout', input: :ssh do |cfg|
116
+ comment cfg
117
+ end
118
+
119
+ cmd 'config.ini', input: %i[scp ftp] do |cfg|
120
+ "; ========== config.ini ==========\n" + cfg
121
+ end
122
+ ```
123
+
124
+ `cmd` without `input` parameter will run against every input.
125
+
126
+
127
+ See the [ApcAos model](/lib/oxidized/model/apcaos.rb) for a full example.
128
+
129
+
62
130
  #### `cmd`
63
131
 
64
132
  Is used to specify commands that should be executed on a model in order to
@@ -68,6 +136,7 @@ gather its configuration. It can be called with:
68
136
  * A string and a block
69
137
  * `:all` and a block
70
138
  * `:secret` and a block
139
+ * `:significant_changes` and a block
71
140
 
72
141
  The block takes a single parameter `cfg` containing the output of the command
73
142
  being processed.
@@ -88,11 +157,44 @@ given block before emitting it to hide secrets if secret hiding is enabled. The
88
157
  block should replace any secrets with `'<hidden>'` and return the resulting
89
158
  string.
90
159
 
160
+ Calling `cmd` with `:significant_changes` and a block will pass the final
161
+ configuration to the given block. The resulting string should contain
162
+ significant changes only and will be used to
163
+ [decide if the configuration should be stored](Configuration.md#store-configuration-only-on-significant-changes).
164
+
91
165
  Execution order is `:all`, `:secret`, and lastly the command specific block, if
92
166
  given.
93
167
 
168
+ The `cmd "string"` method accepts a lambda function via the `:if` argument
169
+ to execute the command only when the lambda evaluates to true.
170
+ The lambda function is evaluated at runtime in the instance context.
171
+ See [Conditional `cmd`](Creating-Models.md#conditional-cmd) for details.
172
+
173
+ The `cmd "string"` method accepts a list of supported inputs via the `:input`
174
+ argument to limit this command to specific inputs.
175
+ ```ruby
176
+ cmd 'config.ini', input: %i[scp ftp] do |cfg|
177
+ "; ========== config.ini ==========\n" + cfg
178
+ end
179
+ ```
180
+
94
181
  Supports [monkey patching](#monkey-patching).
95
182
 
183
+ #### pre / post
184
+ After all `cmd` have been run, the blocks defined in pre and post are called. The
185
+ output of pre will be prepended to the output of the model, The output of post
186
+ will be appended.
187
+
188
+ ```ruby
189
+ pre do
190
+ "Prepended output after cmd blocks have been run\n"
191
+ end
192
+
193
+ post do
194
+ "Appended output after cmd blocks have been run\n"
195
+ end
196
+ ```
197
+
96
198
  #### `comment`
97
199
 
98
200
  Called with a single string containing the string to prepend for comments in
@@ -119,6 +221,28 @@ it's further processed.
119
221
 
120
222
  Supports [monkey patching](#monkey-patching).
121
223
 
224
+ #### `macro :enable`
225
+ Implements an [handling of enable](Creating-Models.md#handling-enable-mode) for the model.
226
+
227
+ #### `clean :escape_codes`
228
+ [Remove ANSI escape codes](Creating-Models.md#remove-ansi-escape-codes) from the output.
229
+
230
+ #### `clean :cut`
231
+ Removes (default) the first and last line of the outputs (most of the time
232
+ command echo and prompt).
233
+ Arguments: head (default: 1), tail (default: 1)
234
+ ```ruby
235
+ clean :cut, head: 2, tail: 0
236
+ ```
237
+
238
+ Equivalent to:
239
+ ```ruby
240
+ cmd :all do |cfg|
241
+ cfg.cut_both(2, 0)
242
+ end
243
+ ```
244
+
245
+
122
246
  ### At the second level
123
247
 
124
248
  The following methods are available:
@@ -161,6 +285,10 @@ Supports [monkey patching](#monkey-patching).
161
285
  Usually used inside `expect` or blocks passed to `post_login`/`pre_logout`.
162
286
  Takes a single parameter: a string to be sent to the device.
163
287
 
288
+ #### `cmd`
289
+ You can nest a `cmd` block inside first level blocks. It will be executed at
290
+ runtime.
291
+
164
292
  ### Monkey patching
165
293
 
166
294
  Several model blocks accept behavior-modifying arguments that make monkey
@@ -171,7 +299,6 @@ This functionality is supported by `cfg`, `cmd`, `pre_*`, `post_*`, and `expect`
171
299
  blocks.
172
300
 
173
301
  #### `clear: true`
174
-
175
302
  Resets the existing block, allowing the user to completely override its contents.
176
303
 
177
304
  #### `prepend: true`
@@ -201,3 +328,9 @@ single line was present.
201
328
 
202
329
  Returns a multi-line string without the first and last lines, or an empty string
203
330
  if fewer than three lines were present.
331
+
332
+ #### `keep_lines`
333
+ Returns a multi-line string with only the lines matching any pattern (String or Regexp) given in an array.
334
+
335
+ #### `reject_lines`
336
+ Returns a multi-line string without the lines matching any pattern (String or Regexp) given in an array.
@@ -2,6 +2,7 @@
2
2
 
3
3
  |Vendor |OS model |oxidized model |model maintainers|comment / model notes|
4
4
  |--------------------|------------------------------|-------------------------------------------------|-----------------|---------------------|
5
+ |-generic- |Cisco-like |[defacto](/lib/oxidized/model/defacto.rb) |@ytti, @robertcheramy|[The defacto model may work on cisco like CLIs](/docs/Creating-Models.md#use-the-defacto-model)|
5
6
  |6WIND |VSR |[sixwind](/lib/oxidized/model/sixwind.rb) |@hcaldicott |
6
7
  |A10 Networks |ACOS |[acos](/lib/oxidized/model/acos.rb) | |
7
8
  |Accedian Performance Elements (NIDs)|AEN |[aen](/lib/oxidized/model/aen.rb)
@@ -17,7 +18,7 @@
17
18
  |Allied Telesis |Alliedware Plus |[awplus](/lib/oxidized/model/awplus.rb)
18
19
  | |AT-8000S, AT-8000GS series |[powerconnect](/lib/oxidized/model/powerconnect.rb)
19
20
  |Alvarion |BreezeACCESS |[alvarion](/lib/oxidized/model/alvarion.rb)
20
- |APC |AOS |[apc_aos](/lib/oxidized/model/apc_aos.rb) |@robertcheramy |[APC AOS](Model-Notes/APC_AOS.md)
21
+ |APC |AOS |[apcaos](/lib/oxidized/model/apcaos.rb) |@robertcheramy |[APC](Model-Notes/APC.md)
21
22
  |Arbor Networks |ArbOS |[arbos](/lib/oxidized/model/arbos.rb) | |[ArbOS](Model-Notes/ArbOS.md)
22
23
  |Arista |EOS |[eos](/lib/oxidized/model/eos.rb) | |[EOS](Model-Notes/EOS.md)
23
24
  |Arris |C4CMTS |[c4cmts](/lib/oxidized/model/c4cmts.rb)
@@ -35,7 +36,7 @@
35
36
  | |FastIron |[fastiron](/lib/oxidized/model/fastiron.rb)
36
37
  | |IronWare |[ironware](/lib/oxidized/model/ironware.rb)
37
38
  | |NOS (Network Operating System)|[nos](/lib/oxidized/model/nos.rb)
38
- | |Vyatta |[vyatta](/lib/oxidized/model/vyatta.rb)
39
+ | |Vyatta |[vyatta](/lib/oxidized/model/vyatta.rb) | | Also used for Vyos <= 1.2.x, for newer versions use the VyOS model
39
40
  | |6910 |[br6910](/lib/oxidized/model/br6910.rb)
40
41
  | |SLX-OS |[slxos](/lib/oxidized/model/slxos.rb)
41
42
  |Calix |AXOS |[axos](/lib/oxidized/model/axos.rb)
@@ -52,6 +53,7 @@
52
53
  | |AsyncOS |[asyncos](/lib/oxidized/model/asyncos.rb)
53
54
  | |CatOS |[catos](/lib/oxidized/model/catos.rb)
54
55
  | |Cisco Catalyst Express |[ciscoce](/lib/oxidized/model/ciscoce.rb)
56
+ | |ExaLink Fusion (Nexus 3550-F) |[exalink](/lib/oxidized/model/exalink.rb) |@obol89 |[ExaLink](Model-Notes/ExaLink.md)
55
57
  | |FireLinuxOS |[firelinuxos](/lib/oxidized/model/firelinuxos.rb)
56
58
  | |IOS |[ios](/lib/oxidized/model/ios.rb) |@robertcheramy |[IOS](Model-Notes/IOS.md)
57
59
  | |IOSXR |[iosxr](/lib/oxidized/model/iosxr.rb)
@@ -74,7 +76,7 @@
74
76
  |DELL |PowerConnect |[powerconnect](/lib/oxidized/model/powerconnect.rb)
75
77
  | |AOSW |[aosw](/lib/oxidized/model/aosw.rb) | |Same model as Aruba Wireless
76
78
  | |DellX |[dellx](/lib/oxidized/model/dellx.rb)
77
- | |Dell EMC Networking OS6 |[os6](/lib/oxidized/model/os6.rb) | |[Dell EMC Networking OS6](Model-Notes/OS6.md)
79
+ | |Dell EMC Networking OS6 |[os6](/lib/oxidized/model/os6.rb) | |[Dell EMC Networking OS6](Model-Notes/OS6.md)
78
80
  | |Dell EMC Networking OS10 |[os10](/lib/oxidized/model/os10.rb) | |[Dell EMC Networking OS10](Model-Notes/OS10.md)
79
81
  |D-Link |D-Link |[dlink](/lib/oxidized/model/dlink.rb)
80
82
  | |D-Link cisco like CLI |[dlinknextgen](/lib/oxidized/model/dlinknextgen.rb)
@@ -98,10 +100,12 @@
98
100
  |Firebrick |FBxxxx |[firebrick](/lib/oxidized/model/firebrick.rb)
99
101
  |Force10 |DNOS |[dnos](/lib/oxidized/model/dnos.rb)
100
102
  | |FTOS |[ftos](/lib/oxidized/model/ftos.rb)
101
- |FortiGate |FortiOS |[fortios](/lib/oxidized/model/fortios.rb) | |[FortiOS](Model-Notes/FortiOS.md)
102
- |FortiWLC |FortiWLC |[fortiwlc](/lib/oxidized/model/fortiwlc.rb)
103
+ |Fortinet |FortiGate |[fortigate](/lib/oxidized/model/fortigate.rb) |@robertcheramy |[Fortinet](Model-Notes/Fortinet.md)
104
+ | |FortiOS |[fortios](/lib/oxidized/model/fortios.rb) |@robertcheramy |[Fortinet](Model-Notes/Fortinet.md)
105
+ | |FortiWLC |[fortiwlc](/lib/oxidized/model/fortiwlc.rb)
103
106
  |Fujitsu |PRIMERGY Blade switch 1/10Gbe |[fujitsupy](/lib/oxidized/model/fujitsupy.rb)
104
107
  | |1FINITY Switches |[onefinity](/lib/oxidized/model/onefinity.rb)
108
+ |[Garderos](https://garderos.com/) |GRS (Garderos Router Software) |[garderos](/lib/oxidized/model/garderos.rb) | @robertcheramy |Routers for harsh environments
105
109
  |GCOM Technologies |Broadband Network Platform Software|[gcombnps](/lib/oxidized/model/gcombnps.rb)
106
110
  |Grandstream Networks|GSX |[grandstream](/lib/oxidized/model/grandstream.rb)
107
111
  |Hatteras |Hatteras |[hatteras](/lib/oxidized/model/hatteras.rb)
@@ -119,6 +123,7 @@
119
123
  |Icotera |6400 series |[icotera](/lib/oxidized/model/icotera.rb)
120
124
  |Ingate |SIParator/Firewalls |[ingate](/lib/oxidized/model/ingate.rb) |@thanegill
121
125
  |IP Infusion |OcNOS |[ocnos](/lib/oxidized/model/ocnos.rb)
126
+ |Ivanti |Ivanti Connect Secure (ICS) |[ivanti](/lib/oxidized/model/ivanti.rb) |@candleflip |[ICS](Model-Notes/IvantiConnectSecure.md)
122
127
  |Juniper |JunOS |[junos](/lib/oxidized/model/junos.rb) | |[MX/QFX/EX/SRX/J Series](Model-Notes/JunOS.md)
123
128
  | |ScreenOS (Netscreen) |[screenos](/lib/oxidized/model/screenos.rb)
124
129
  |LANCOM Systems GmbH |LCOS |[lancom](/lib/oxidized/model/lancom.rb)
@@ -127,7 +132,7 @@
127
132
  |Linuxgeneric |CentOS |[linuxgeneric](/lib/oxidized/model/linuxgeneric.rb)| |[LinuxGeneric](Model-Notes/LinuxGeneric.md)
128
133
  |Mellanox |MLNX-OS |[mlnxos](/lib/oxidized/model/mlnxos.rb)
129
134
  | |Voltaire |[voltaire](/lib/oxidized/model/voltaire.rb)
130
- |Mikrotik |RouterOS |[routeros](/lib/oxidized/model/routeros.rb) | |[RouterOS](Model-Notes/RouterOS.md)
135
+ |Mikrotik |RouterOS |[routeros](/lib/oxidized/model/routeros.rb) | |[RouterOS](Model-Notes/RouterOS.md)
131
136
  | |SwOS and SwOS Lite |[swos](/lib/oxidized/model/swos.rb)
132
137
  |Mimosa |Mimosa (B11) |[mimosab11](/lib/oxidized/model/mimosab11.rb)
133
138
  |Motorola |RFS |[mtrlrfs](/lib/oxidized/model/mtrlrfs.rb)
@@ -138,6 +143,7 @@
138
143
  |Netgear |Netgear switches |[netgear](/lib/oxidized/model/netgear.rb) | |[Netgear](Model-Notes/Netgear.md)
139
144
  |Netonix |WISP Switch (As Netonix) |[netonix](/lib/oxidized/model/netonix.rb)
140
145
  |Nokia (formerly TiMetra, Alcatel, Alcatel-Lucent)|SR OS (TiMOS)|[sros](/lib/oxidized/model/sros.rb) | |[Nokia ISAM](Model-Notes/Nokia.md)
146
+ | |SR OS Model-Driven CLI (7705 SAR, 7210 SAS, 7450 ESS, 7750 SR, 7950 XRS, NSP) |[srosmd](/lib/oxidized/model/srosmd.rb) | |
141
147
  |OneAccess |OneOS |[oneos](/lib/oxidized/model/oneos.rb)
142
148
  | |TDRE |[tdre](/lib/oxidized/model/tdre.rb)
143
149
  |OpenBSD | |[openbsd](/lib/oxidized/model/openbsd.rb)
@@ -146,18 +152,22 @@
146
152
  |OPNsense | |[opnsense](/lib/oxidized/model/opnsense.rb)
147
153
  |Palo Alto |PanOS API |[panos_api](/lib/oxidized/model/panos_api.rb) | |[PanOS_API](Model-Notes/PanOS_API.md)
148
154
  | |PanOS |[panos](/lib/oxidized/model/panos.rb)
155
+ |[Perle](https://www.perle.com)|IOLAN Console Servers|[perle](/lib/oxidized/model/perle.rb) |@robertcheramy
149
156
  |PLANET SG/SGS Switches| |[planet](/lib/oxidized/model/planet.rb)
150
157
  |pfSense | |[pfsense](/lib/oxidized/model/pfsense.rb)
151
158
  |Pure Storage |PurityOS |[purityos](/lib/oxidized/model/purityos.rb)
152
159
  |Radware |AlteonOS |[alteonos](/lib/oxidized/model/alteonos.rb)
153
160
  |Raisecom |Raisecom |[raisecom](/lib/oxidized/model/raisecom.rb)
161
+ |Riverbed |SteelHead |[riverbed](/lib/oxidized/model/riverbed.rb)
154
162
  |Ruijie Networks |RGOS |[rgos](/lib/oxidized/model/rgos.rb)
155
163
  |QTECH |QSW-2800, QSW-3400, QSW-3450, QSW-3500|[qtech](/lib/oxidized/model/qtech.rb)
156
164
  |Quanta |Quanta / VxWorks 6.6 (1.1.0.8)|[quantaos](/lib/oxidized/model/quantaos.rb)
157
165
  |Siklu |EtherHaul |[siklu](/lib/oxidized/model/siklu.rb) |@bdg-robert
158
166
  | |Multihaul TG |[siklumhtg](/lib/oxidized/model/siklumhtg.rb) |@bdg-robert |[Siklu Multihaul TG](Model-Notes/SikluMHTG.md)
159
167
  |Seiko Solutions |SmartCS, SmartCS mini |[smartcs](/lib/oxidized/model/smartcs.rb)
168
+ |SmartByte |LT-S8228G series |[smartbyte](/lib/oxidized/model/smartbyte.rb) |@freddy36
160
169
  |SonicWALL |SonicOS |[sonicos](/lib/oxidized/model/sonicos.rb)
170
+ |[SONiC](https://sonicfoundation.dev/) |Enterprise SONiC |[enterprise_sonic](/lib/oxidized/model/enterprise_sonic.rb) | |
161
171
  |SNR |SNR-S300G, S2xxx, S3xxx, S4xxx|[dcnos](/lib/oxidized/model/dcnos.rb)
162
172
  |Speedtouch |Thomson Speedtouch |[speedtouch](/lib/oxidized/model/speedtouch.rb)
163
173
  |Supermicro |SSE-G2252, G2252P |[edgecos](/lib/oxidized/model/edgecos.rb)
@@ -175,12 +185,14 @@
175
185
  | |Edgeos |[edgeos](/lib/oxidized/model/edgeos.rb)
176
186
  | |EdgeSwitch |[edgeswitch](/lib/oxidized/model/edgeswitch.rb)
177
187
  | |AirFiber |[airfiber](/lib/oxidized/model/airfiber.rb)
178
- | |UnifiAP |[unifiap](/lib/oxidized/model/unifiap.rb) |@clifcox |Also suports AirOS, and some Unifi switches
179
- |Uplink |EP4440-DP |[EP4440](/lib/oxidized/model/uplinkolt.rb) | |Might support all EP4440 series
188
+ | |UnifiAP |[unifiap](/lib/oxidized/model/unifiap.rb) |@clifcox |Also suports AirOS, and some Unifi switches
189
+ |Uplink |EP4440-DP |[EP4440](/lib/oxidized/model/uplinkolt.rb) | |Might support all EP4440 series
180
190
  |VMWare |NSX Edge (configuration) |[nsxconfig](/lib/oxidized/model/nsxconfig.rb)
181
191
  | |NSX Edge (firewall rules) |[nsxfirewall](/lib/oxidized/model/nsxfirewall.rb)
182
192
  | |NSX Distributed Firewall |[nsxdfw](/lib/oxidized/model/nsxdfw.rb)
193
+ |VYOS Networks |VYOS |[vyos](/lib/oxidized/model/vyos.rb) | |Fork of Vyatta, tracking the supported versions (>= 1.4.x)
183
194
  |Watchguard |Fireware OS |[firewareos](/lib/oxidized/model/firewareos.rb)
195
+ |Waystream (PacketFront)|iBOS (Intelligent Broadband OS)|[ibos](/lib/oxidized/model/ibos.rb)
184
196
  |Westell |Westell 8178G, Westell 8266G |[weos](/lib/oxidized/model/weos.rb)
185
197
  |Yadro |KornfeldOS |[kornfeldos](/lib/oxidized/model/kornfeldos.rb)
186
198
  |YAMAHA |YAMAHA NVR/RTX Series |[yamaha](/lib/oxidized/model/yamaha.rb)
@@ -190,5 +202,7 @@
190
202
  |Zyxel |ZyNOS |[zynos](/lib/oxidized/model/zynos.rb) | |[XGS4600 Series](Model-Notes/XGS4600-Zyxel.md)
191
203
  | |ZyNOS GS-series variant |[zynosgs](/lib/oxidized/model/zynosgs.rb)
192
204
  | |ZyNOS ADSL |[zynosadsl](/lib/oxidized/model/zynosadsl.rb)
205
+ | |ZyNOS CLI (DSLAMs, e.g. SAM1316)|[zynoscli](/lib/oxidized/model/zynoscli.rb)
206
+ | |ZyNOS MGS series |[zynosmgs](/lib/oxidized/model/zynosmgs.rb)
193
207
  | |NDMS |[ndms](/lib/oxidized/model/ndms.rb)
194
208
  | |1308 |[zy1308](/lib/oxidized/model/zy1308.rb)
@@ -86,7 +86,7 @@ ssh-keyscan gitserver.git.com >> ~/.ssh/known_hosts
86
86
 
87
87
  If you are running oxidized in a container, you need to map /home/oxidized/.ssh in the
88
88
  container to a local repository and save the known_hosts in the local repository. You can
89
- find an example how to do this under [examples/podman-compose](/examples/podman-compose/)
89
+ find an example how to do this under [Docker.md](Docker.md#store-the-ssh-keys-a-remote-git-repository)
90
90
 
91
91
  ## Oxidized ignores the changes I made to its git repository
92
92
  First of all: you shouldn't manipulate the git repository of oxidized. Don't
data/extra/device2yaml.rb CHANGED
@@ -91,9 +91,8 @@ def yaml_output(prepend = '')
91
91
 
92
92
  prepend = @sequence_prepend_output + prepend
93
93
 
94
- # as we want to prepend 'prepend' to each line, we need each_line and chomp
95
- # chomp removes the trainling \n
96
- @ssh_output.each_line(chomp: true) do |line|
94
+ # each_line(chomp: true) would remove \r\n, so we prefer split
95
+ @ssh_output.split("\n", -1).each do |line|
97
96
  # encode line and remove the first and the trailing double quote
98
97
  line = line.dump[1..-2]
99
98
  if firstline
@@ -0,0 +1,55 @@
1
+ ### script in ~/config/oxidized/hook/modelrules.rb ## or OXDIZED_HOME equivalent
2
+ ###
3
+ ### router.db:
4
+ ### router1:1.1.1.1:routeros::mikrotik
5
+ ### router2:2.2.2.2:ios:switch:cisco
6
+ ### router3:3.3.3.3:routeros:switch:mikrotik
7
+ ###
8
+ ### config:
9
+ ### source:
10
+ ### default: csv
11
+ ### csv:
12
+ ### file: "/Users/ytti/.config/oxidized/router.db"
13
+ ### delimiter: !ruby/regexp /:/
14
+ ### map:
15
+ ### name: 0
16
+ ### ip: 1
17
+ ### model: 2
18
+ ### group: 3
19
+ ### hooks:
20
+ ### somename:
21
+ ### type: modelrules
22
+ ### events: ["source_node_transform"]
23
+ ### rules:
24
+ ### - vendor: mikrotik
25
+ ### group: switch
26
+ ### model: eltex
27
+ ###
28
+ ### Nodes BEFORE script:
29
+ ### {name: "router1", ip: "1.1.1.1", model: "routeros", group: ""}
30
+ ### {name: "router2", ip: "2.2.2.2", model: "ios", group: "switch"}
31
+ ### {name: "router3", ip: "3.3.3.3", model: "routeros", group: "switch"}
32
+ ###
33
+ ### Nodes AFTER script:
34
+ ### {name: "router1", ip: "1.1.1.1", model: "routeros", group: ""}
35
+ ### {name: "router2", ip: "2.2.2.2", model: "ios", group: "switch"}
36
+ ### {name: "router3", ip: "3.3.3.3", model: "eltex", group: "switch"}
37
+ class ModelRules < Oxidized::Hook
38
+ def validate_cfg!
39
+ raise KeyError, 'hook.rules is required' unless cfg.has_key?('rules')
40
+ end
41
+
42
+ def run_hook(ctx)
43
+ # node is the node[key] that we'd return without manipulation
44
+ node = ctx.node ## e.g. node[:ip], node[:model] - what ever config maps
45
+
46
+ ## node_raw is source specific, in CSV it is just the field number, in HTTP it is JSON
47
+ vendor = ctx.node_raw[4]
48
+
49
+ cfg.rules.each do |rule|
50
+ node[:model] = rule['model'] if node[:group] == rule['group'] && vendor == rule['vendor']
51
+ end
52
+
53
+ node
54
+ end
55
+ end