oxidized 0.36.0 → 0.38.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 (159) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +30 -4
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +10 -3
  4. data/.github/ISSUE_TEMPLATE/support-request.md +30 -4
  5. data/.github/PULL_REQUEST_TEMPLATE.md +3 -1
  6. data/.github/workflows/codeql.yml +4 -4
  7. data/.github/workflows/publishdocker.yml +2 -2
  8. data/.github/workflows/ruby.yml +10 -3
  9. data/.github/workflows/stale.yml +1 -1
  10. data/.rubocop.yml +3 -0
  11. data/.rubocop_todo.yml +2 -8
  12. data/AGENTS.md +174 -0
  13. data/CHANGELOG.md +127 -0
  14. data/CONTRIBUTING.md +78 -44
  15. data/Dockerfile +8 -4
  16. data/README.md +8 -1
  17. data/Rakefile +1 -1
  18. data/docs/Configuration.md +10 -1
  19. data/docs/Creating-Models.md +6 -6
  20. data/docs/DeviceSimulation.md +80 -51
  21. data/docs/Docker.md +49 -0
  22. data/docs/Hooks.md +92 -67
  23. data/docs/Inputs.md +95 -16
  24. data/docs/Issues.md +49 -13
  25. data/docs/Model-Notes/FTD.md +64 -0
  26. data/docs/Model-Notes/GrandstreamHT8xx.md +8 -0
  27. data/docs/Model-Notes/HPEAruba.md +5 -0
  28. data/docs/Model-Notes/ITMGOS.md +40 -0
  29. data/docs/Model-Notes/PanOS_API.md +20 -1
  30. data/docs/Model-Notes/RouterOS.md +13 -0
  31. data/docs/Model-Notes/TPLink.md +75 -0
  32. data/docs/Model-Notes/TrueNAS.md +11 -7
  33. data/docs/Outputs.md +1 -0
  34. data/docs/Release.md +49 -22
  35. data/docs/Ruby-API.md +231 -9
  36. data/docs/Supported-OS-Types.md +10 -4
  37. data/docs/Troubleshooting.md +8 -9
  38. data/extra/device2yaml.rb +21 -5
  39. data/extra/hooks/modelrulesadvanced.rb +2 -4
  40. data/extra/oxidized.service +0 -1
  41. data/extra/syslog.rb +1 -1
  42. data/lib/oxidized/cli/support.rb +149 -0
  43. data/lib/oxidized/cli.rb +9 -0
  44. data/lib/oxidized/config/vars.rb +2 -1
  45. data/lib/oxidized/core.rb +20 -0
  46. data/lib/oxidized/hook/ciscosparkdiff.rb +1 -1
  47. data/lib/oxidized/hook/slackdiff.rb +1 -1
  48. data/lib/oxidized/hook/xmppdiff.rb +2 -2
  49. data/lib/oxidized/hook.rb +2 -0
  50. data/lib/oxidized/input/cli.rb +14 -2
  51. data/lib/oxidized/input/debugtext.rb +40 -0
  52. data/lib/oxidized/input/debugyaml.rb +82 -0
  53. data/lib/oxidized/input/exec.rb +1 -6
  54. data/lib/oxidized/input/ftp.rb +0 -4
  55. data/lib/oxidized/input/http.rb +23 -15
  56. data/lib/oxidized/input/scp.rb +3 -1
  57. data/lib/oxidized/input/ssh.rb +28 -21
  58. data/lib/oxidized/input/sshbase.rb +50 -24
  59. data/lib/oxidized/input/telnet.rb +14 -11
  60. data/lib/oxidized/input/tftp.rb +0 -4
  61. data/lib/oxidized/model/acos.rb +2 -2
  62. data/lib/oxidized/model/acsw.rb +1 -1
  63. data/lib/oxidized/model/adtran.rb +1 -1
  64. data/lib/oxidized/model/aireos.rb +3 -3
  65. data/lib/oxidized/model/aoscx.rb +20 -12
  66. data/lib/oxidized/model/aosw.rb +8 -13
  67. data/lib/oxidized/model/arbos.rb +1 -1
  68. data/lib/oxidized/model/aricentiss.rb +1 -1
  69. data/lib/oxidized/model/asa.rb +1 -1
  70. data/lib/oxidized/model/asternos.rb +1 -1
  71. data/lib/oxidized/model/audiocodesmp.rb +1 -1
  72. data/lib/oxidized/model/awplus.rb +4 -3
  73. data/lib/oxidized/model/bdcom.rb +1 -1
  74. data/lib/oxidized/model/br6910.rb +1 -1
  75. data/lib/oxidized/model/c4cmts.rb +1 -1
  76. data/lib/oxidized/model/ciscosmb.rb +0 -1
  77. data/lib/oxidized/model/cnos.rb +10 -1
  78. data/lib/oxidized/model/comnetms.rb +1 -1
  79. data/lib/oxidized/model/coriantgroove.rb +1 -1
  80. data/lib/oxidized/model/cumulus.rb +3 -3
  81. data/lib/oxidized/model/dellx.rb +1 -1
  82. data/lib/oxidized/model/dlink.rb +1 -1
  83. data/lib/oxidized/model/dlinknextgen.rb +2 -1
  84. data/lib/oxidized/model/dnos.rb +2 -2
  85. data/lib/oxidized/model/eatonnetwork.rb +33 -32
  86. data/lib/oxidized/model/eciapollo.rb +1 -1
  87. data/lib/oxidized/model/edgeos.rb +3 -3
  88. data/lib/oxidized/model/enterasys.rb +1 -1
  89. data/lib/oxidized/model/eos.rb +1 -0
  90. data/lib/oxidized/model/fastiron.rb +10 -1
  91. data/lib/oxidized/model/fiberdriver.rb +1 -1
  92. data/lib/oxidized/model/firelinuxos.rb +1 -1
  93. data/lib/oxidized/model/fortigate.rb +16 -3
  94. data/lib/oxidized/model/fortios.rb +1 -1
  95. data/lib/oxidized/model/ftd.rb +183 -0
  96. data/lib/oxidized/model/ftos.rb +2 -2
  97. data/lib/oxidized/model/garderos.rb +16 -5
  98. data/lib/oxidized/model/grandstreamht8xx.rb +19 -0
  99. data/lib/oxidized/model/hpebladesystem.rb +1 -1
  100. data/lib/oxidized/model/ibos.rb +1 -2
  101. data/lib/oxidized/model/ingate.rb +15 -1
  102. data/lib/oxidized/model/ios.rb +2 -0
  103. data/lib/oxidized/model/iosxr.rb +9 -3
  104. data/lib/oxidized/model/ironware.rb +1 -1
  105. data/lib/oxidized/model/itmgos.rb +74 -0
  106. data/lib/oxidized/model/junos.rb +10 -4
  107. data/lib/oxidized/model/kornfeldos.rb +2 -4
  108. data/lib/oxidized/model/lancom.rb +2 -2
  109. data/lib/oxidized/model/linuxgeneric.rb +4 -2
  110. data/lib/oxidized/model/masteros.rb +1 -1
  111. data/lib/oxidized/model/mlnxos.rb +1 -1
  112. data/lib/oxidized/model/model.rb +5 -2
  113. data/lib/oxidized/model/mtrlrfs.rb +1 -1
  114. data/lib/oxidized/model/ndms.rb +1 -1
  115. data/lib/oxidized/model/necix.rb +1 -1
  116. data/lib/oxidized/model/netgear.rb +1 -1
  117. data/lib/oxidized/model/netscaler.rb +1 -1
  118. data/lib/oxidized/model/nxos.rb +13 -1
  119. data/lib/oxidized/model/ocnos.rb +1 -1
  120. data/lib/oxidized/model/onefinity.rb +1 -1
  121. data/lib/oxidized/model/oneos.rb +0 -1
  122. data/lib/oxidized/model/openbsd.rb +1 -1
  123. data/lib/oxidized/model/os10.rb +2 -2
  124. data/lib/oxidized/model/os6.rb +3 -2
  125. data/lib/oxidized/model/panos.rb +1 -1
  126. data/lib/oxidized/model/panos_api.rb +42 -14
  127. data/lib/oxidized/model/procurve.rb +63 -31
  128. data/lib/oxidized/model/routeros.rb +6 -1
  129. data/lib/oxidized/model/screenos.rb +2 -2
  130. data/lib/oxidized/model/sgos.rb +1 -1
  131. data/lib/oxidized/model/siklu.rb +2 -2
  132. data/lib/oxidized/model/slxos.rb +1 -1
  133. data/lib/oxidized/model/sonicos.rb +2 -2
  134. data/lib/oxidized/model/tdre.rb +2 -2
  135. data/lib/oxidized/model/telco.rb +1 -1
  136. data/lib/oxidized/model/tmos.rb +11 -2
  137. data/lib/oxidized/model/tplink.rb +8 -10
  138. data/lib/oxidized/model/truenas.rb +56 -5
  139. data/lib/oxidized/model/viptela.rb +1 -1
  140. data/lib/oxidized/model/voltaire.rb +1 -1
  141. data/lib/oxidized/model/vrp.rb +14 -8
  142. data/lib/oxidized/model/vsololt.rb +93 -0
  143. data/lib/oxidized/model/vyatta.rb +3 -3
  144. data/lib/oxidized/model/vyos.rb +6 -1
  145. data/lib/oxidized/model/xos.rb +1 -1
  146. data/lib/oxidized/model/zhoneolt.rb +1 -1
  147. data/lib/oxidized/node.rb +9 -9
  148. data/lib/oxidized/nodes.rb +5 -13
  149. data/lib/oxidized/output/git.rb +72 -81
  150. data/lib/oxidized/output/gitcrypt.rb +13 -32
  151. data/lib/oxidized/redact.rb +18 -0
  152. data/lib/oxidized/signals.rb +2 -16
  153. data/lib/oxidized/source/source.rb +5 -1
  154. data/lib/oxidized/source/sql.rb +1 -0
  155. data/lib/oxidized/version.rb +2 -2
  156. data/lib/oxidized.rb +1 -0
  157. data/lib/refinements.rb +7 -3
  158. data/oxidized.gemspec +20 -11
  159. metadata +74 -29
data/CONTRIBUTING.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Oxidized - Contributing Guide
2
- You can contribute to [Oxidized](https://github.com/ytti/oxidized/) in many ways, and first of all we'd like to thank you for taking your time to improve this great project!
2
+ You can contribute to [Oxidized](https://github.com/ytti/oxidized/) in many ways. First of all, we'd like to thank you for taking the time to improve this great project!
3
+
4
+ ## Thank you to all our contributors!
5
+
6
+ Oxidized would not be possible without the time, ideas and expertise contributed by our community.
7
+ We sincerely thank [everyone who has contributed to Oxidized](https://github.com/ytti/oxidized/graphs/contributors)!
3
8
 
4
9
  > ## Legal Notice
5
10
  > When submitting content to this project, you must agree that you have authored 100%
@@ -16,50 +21,47 @@ Through the issues, you can interact with maintainers and other users. You can o
16
21
  if you need help, but you can also help other users by reviewing their issues and commenting on them.
17
22
 
18
23
  Before writing an issue, please read our documentation on
19
- [how to write good issues](/docs/Issues.md).
24
+ [how to write good issues](docs/Issues.md).
20
25
 
21
26
 
22
27
  ## Contribute some content
23
28
  Content contributions are always welcome. You do not need to be a maintainer for this.
24
- You even do not need to be a ruby programmer, as an example, the documentation always needs some
29
+ You do not even need to be a Ruby programmer. For example, the documentation always needs
25
30
  enhancements :-)
26
31
 
27
- Contributions can be submitted through pull requests in github. For a full explanation how to
32
+ Contributions can be submitted through pull requests on GitHub. For a full explanation of how to
28
33
  contribute some content, see [How to contribute content](#how-to-contribute-content).
29
34
 
30
35
 
31
36
  ## Help Needed
32
37
 
33
- As things stand right now, `oxidized` is maintained by a few people. A great
38
+ As things stand right now, `oxidized` is maintained by only a few people. A great
34
39
  many [contributors](https://github.com/ytti/oxidized/graphs/contributors) have
35
- helped further the software, however contributions are not the same as ongoing
36
- owner- and maintainer-ship. It appears that many companies use the software to
37
- manage their network infrastructure, this is great news! But without additional
40
+ helped further the software. However, contributions are not the same as taking on ongoing
41
+ ownership and maintenance. It appears that many companies use the software to
42
+ manage their network infrastructure, which is great news! But without additional
38
43
  help to maintain the software and put out releases, the future of oxidized
39
- might be less bright. The current pace of development and the much needed
40
- refactoring simply are not sustainable if they are to be driven by a few
41
- persons.
44
+ might be less bright. The current pace of development and the much-needed
45
+ refactoring are not sustainable if they are to be driven by only a few
46
+ people.
42
47
 
43
48
  ## Model maintainers
44
- Oxidized supports more than [150 different devices](docs/Supported-OS-Types.md), and there is no way a person
49
+ Oxidized supports more than [150 different devices](docs/Supported-OS-Types.md), and there is no way one person
45
50
  maintaining the infrastructure code ([Oxidized maintainers](#oxidized-maintainers))
46
- has any ability to have complete understanding of each model and validity of changes upon them.
51
+ can completely understand every model and assess the validity of all changes to them.
47
52
 
48
53
  On the other hand, we have a lot of great users with a detailed understanding of *their*
49
- favorite hardware and a technical background which is plenty sufficient to support
50
- *their*" model in oxidized. The model maintainer role is designed to have a very low
51
- entry barrier, low maintenance burden and needs no long-term commitment.
54
+ favorite hardware and more than enough technical knowledge to support
55
+ *their* model in Oxidized. The model maintainer role is designed to have a very low
56
+ entry barrier and low maintenance burden, and it requires no long-term commitment.
52
57
 
53
58
  ### Model maintainer tasks
54
59
  A model maintainer has the following tasks:
55
60
 
56
- * Monitor and comment any model changes in a reasonable time (up to 3 weeks)
57
- * Monitor, comment and fix issues related to the model in a reasonable time (up to 3 weeks)
58
- * Note that Oxidized has a very liberal approach to changes: if someone needed it,
59
- I need good reason to reject it.
60
- * When a model maintainer comments a Pull Request as ready to merge into main,
61
- an [Oxidized maintainer](#oxidized-maintainers) will merge it without any
62
- further checks. If nothing happens, the model maintainer should trigger an Oxidized maintainer directly ;-).
61
+ * Monitor and comment on any model changes within a reasonable time
62
+ * Monitor, comment on and fix issues related to the model within a reasonable time
63
+ * Note that Oxidized has a very liberal approach to changes: if someone needs a change,
64
+ there must be a good reason to reject it.
63
65
  * If there are multiple model maintainers for a model, they should agree among themselves
64
66
  how they want to collaborate
65
67
  * Please remove yourself as maintainer, if you no longer wish to respond on changes related to the model. We may remove unresponsive model maintainers, but it is nicer if you let us know.
@@ -67,7 +69,7 @@ how they want to collaborate
67
69
 
68
70
  ### How to add / remove yourself as a model maintainer?
69
71
 
70
- The model maintainers are listed in [docs/Supported.OS-Types.md]. Add or remove yourself in the table and push the change to github (pull request). Don't know how? Have a look at [How to contribute content](#how-to-contribute-content).
72
+ The model maintainers are listed in [docs/Supported-OS-Types.md](docs/Supported-OS-Types.md). Add or remove yourself in the table and submit the change on GitHub as a pull request. Don't know how? Have a look at [How to contribute content](#how-to-contribute-content).
71
73
 
72
74
  ## Oxidized maintainers
73
75
  ### Become a maintainer for Oxidized
@@ -91,22 +93,45 @@ post](http://brson.github.io/2017/04/05/minimally-nice-maintainer) on what it
91
93
  means to be a maintainer.
92
94
 
93
95
  ### Current maintainers
94
- Current active maintainer of Oxidized are:
96
+ The current active maintainers of Oxidized are:
95
97
  * Saku Ytti (@ytti) - he is the original author of Oxidized
96
- * Alexander Schaber (@aschaber1)
97
98
  * Robert Chéramy (@robertcheramy)
98
99
 
99
100
 
100
101
  ## How to contribute content
101
102
  Content can be code, but also documentation and other things.
102
103
 
104
+ ### Using AI coding agents
105
+ Using AI coding assistants (Copilot, Claude, ChatGPT, ...) to help write your
106
+ contribution is fine. But whatever tool you use, **you remain the
107
+ author and are responsible for the code you submit**:
108
+
109
+ * A human must read, understand and be able to explain every line before it is
110
+ submitted. If you don't understand what the code does, do not submit it.
111
+ * Test your contribution and make sure it actually works (see
112
+ [Run tests](#run-tests)). Agents happily produce plausible-looking code that
113
+ does not work.
114
+ * Keep the change focused and minimal — agents tend to add unrelated
115
+ "improvements", verbose comments and dead code. Clean this up before opening
116
+ a pull request.
117
+
118
+ Please do not open pull requests containing raw, unreviewed agent output.
119
+ Oxidized is maintained by only a few volunteers, and every pull request is
120
+ reviewed carefully by a human. Reviewing code that the author has not read or
121
+ understood themselves is a lot of work and rather thankless — it shifts the
122
+ effort of understanding the change onto the maintainers. Respect their time by
123
+ submitting code you have genuinely reviewed and stand behind.
124
+
125
+ If you use an agent, the repository provides [AGENTS.md](AGENTS.md) with project
126
+ conventions the agent should follow.
127
+
103
128
  ### Fork the repository
104
129
  Fork this repository to your GitHub account by clicking the "Fork" button at the top right. This creates a personal copy of the project you can work on.
105
130
 
106
131
  ### Clone your fork
107
132
  Clone your forked repository to your local machine using the `git clone` command:
108
133
  ```bash
109
- git clone git@github.com:##yourname##/oxidized.git
134
+ git clone git@github.com:YOUR_GITHUB_USERNAME/oxidized.git
110
135
  ```
111
136
 
112
137
  ### Create a new branch
@@ -115,28 +140,38 @@ Create a new branch for your contribution. Choose a concise name for your branch
115
140
  git checkout -b 1234-your-branch-name
116
141
  ```
117
142
 
118
- ### Create a ruby bundle
119
- You need [Bundler](https://bundler.io/) to install ruby dependencies locally. If it is not already
143
+ ### Create a Ruby bundle
144
+ You need [Bundler](https://bundler.io/) to install Ruby dependencies locally. If it is not already
120
145
  installed on your system, it should be prepackaged in your favorite Linux or
121
- Ruby distribution. On Debian Bookworm, you can install Bundler with `sudo apt install ruby-bundler`
146
+ Ruby distribution. On Debian, you can install Bundler with `sudo apt install ruby-bundler`.
122
147
 
123
148
  ```bash
124
149
  bundle config set --local path 'vendor/bundle'
125
150
  bundle install
126
151
  ```
127
152
 
128
- 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`
153
+ 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`.
154
+
155
+ ### Read the development guides
156
+ Before writing code, please consult the relevant project documentation. In particular, model contributors should read:
157
+
158
+ * [Creating Models](docs/Creating-Models.md) for model structure and conventions
159
+ * [Device Simulation](docs/DeviceSimulation.md) for creating and using device simulation files
160
+ * [Model Unit Tests](docs/ModelUnitTests.md) for writing and running model tests
129
161
 
130
162
  ### Run your code
131
163
  ```bash
132
164
  bundle exec bin/oxidized
133
165
  ```
134
166
 
135
- ### Use a custom oxidized configuration
136
- If you don't want to use the configuration under `~/.config/oxidized/`, you can set the path to your specific configuration with the environement variable `OXIDIZED_HOME': `export OXIDIZED_HOME=~/oxidized-config/`.
167
+ ### Use a custom Oxidized configuration
168
+ If you don't want to use the configuration under `~/.config/oxidized/`, you can set the path to your specific configuration with the environment variable `OXIDIZED_HOME`:
169
+ ```bash
170
+ export OXIDIZED_HOME=~/oxidized-config/
171
+ ```
137
172
 
138
- ### Code like a ruby professional
139
- rubocop will help you to respect our coding conventions (which are ruby coding conventions).
173
+ ### Code like a Ruby professional
174
+ RuboCop will help you follow our coding conventions (which are Ruby coding conventions).
140
175
  ```bash
141
176
  bundle exec rubocop
142
177
  ```
@@ -160,30 +195,29 @@ You can also use a git GUI like [Git Cola](https://git-cola.github.io/) for a be
160
195
  The commits will be seen in the pull request, so be concise and remember that someone will try to
161
196
  understand what you have done.
162
197
 
163
- ### Push your work to your github repository
164
- With this step, your commits will be seen on github. You are pushing the branch you created before (in this example 1234-your-branch-name`) into your fork of Oxidized.
198
+ ### Push your work to your GitHub repository
199
+ With this step, your commits will be visible on GitHub. You are pushing the branch you created before (in this example, `1234-your-branch-name`) to your fork of Oxidized.
165
200
 
166
201
  ```bash
167
202
  git push -u origin 1234-your-branch-name
168
203
  ```
169
204
 
170
- You can push as often as you wish. If you already opened a pull request, your pushed commits will automatically get updated there.
205
+ You can push as often as you wish. If you have already opened a pull request, your new commits will automatically be added to it.
171
206
 
172
207
  ### Open a pull request
173
- Go to your github repository, and github will propose to create a pull request
174
- and will guide you.
208
+ Go to your GitHub repository. GitHub will offer to create a pull request and guide you through the process.
175
209
 
176
210
  We are happy that you are contributing to Oxidized. If something is not as it
177
211
  should be, a maintainer will probably ask you to change it when reviewing the
178
212
  pull request. And if your pull request breaks something, this can be fixed, so
179
213
  don't be shy, submit your code ;-)
180
214
 
181
- Note: if the github CI fail on your pull request, fix the problems.
182
- A pull request with failed CI won't be merged into master, so maintainers may
183
- only review pull requests that have passed the CIs.
215
+ Note: if the GitHub CI checks fail on your pull request, fix the problems.
216
+ A pull request with failed CI checks won't be merged into main, so maintainers may
217
+ only review pull requests that have passed CI.
184
218
 
185
219
  ### Delete the branch from your repository
186
- When the pull request has been merged into main, github will ask if you want to delete your branch. Clean up and delete it, so that you can keep your fork clean and ready for new contributions.
220
+ When the pull request has been merged into main, GitHub will ask if you want to delete your branch. Delete it to keep your fork clean and ready for new contributions.
187
221
 
188
222
  ## One last word
189
223
  Have fun, and don't forget to congratulate yourself for your great contribution to [Oxidized](https://github.com/ytti/oxidized/)!
data/Dockerfile CHANGED
@@ -1,5 +1,7 @@
1
1
  FROM docker.io/debian:trixie-slim
2
2
 
3
+ ENV LANG=C.UTF-8
4
+
3
5
  ##### Place "static" commands at the beginning to optimize image size and build speed
4
6
 
5
7
  # add non-privileged user
@@ -55,12 +57,14 @@ RUN set -eux; \
55
57
  # ruby and core gems needed by oxidized
56
58
  ruby ruby-rugged ruby-slop \
57
59
  # Gem dependencies for inputs
58
- ruby-net-telnet ruby-net-ssh ruby-net-ftp ruby-ed25519 ruby-net-scp \
60
+ ruby-net-telnet ruby-net-ftp \
59
61
  ruby-net-http-persistent ruby-mechanize \
60
62
  # Gem dependencies for sources
61
63
  ruby-sqlite3 ruby-mysql2 ruby-pg ruby-sequel ruby-gpgme\
62
64
  # Gem dependencies for hooks
63
65
  ruby-aws-sdk ruby-xmpp4r \
66
+ # Gem dependencies for models
67
+ ruby-zip \
64
68
  # Gems needed by oxidized-web
65
69
  ruby-charlock-holmes ruby-haml ruby-htmlentities ruby-json \
66
70
  puma ruby-sinatra ruby-sinatra-contrib \
@@ -79,9 +83,9 @@ RUN set -eux; \
79
83
  # dependencies for hooks
80
84
  slack-ruby-client cisco_spark \
81
85
  # dependencies for specific inputs
82
- net-tftp \
83
- ##### X25519 (a.k.a. Curve25519) Elliptic Curve Diffie-Hellman
84
- x25519 \
86
+ # net-ssh >= 8 (installed by rake install) is not packaged in trixie,
87
+ # and the packaged ruby-net-scp requires net-ssh < 8
88
+ net-tftp net-scp \
85
89
  ; \
86
90
  # remove the packages we do not need.
87
91
  apt-get remove -y build-essential ruby-dev; \
data/README.md CHANGED
@@ -83,7 +83,14 @@ add-apt-repository universe
83
83
  Install the dependencies:
84
84
 
85
85
  ```shell
86
- apt install ruby ruby-dev libsqlite3-dev libssl-dev pkg-config cmake libssh2-1-dev libicu-dev zlib1g-dev g++ libyaml-dev libzstd-dev
86
+ apt install ruby ruby-dev libsqlite3-dev libssl-dev pkg-config cmake libssh2-1-dev libicu-dev zlib1g-dev g++ libyaml-dev libzstd-dev libgpg-error-dev
87
+ ```
88
+
89
+ On Ubuntu 26.04 or newer, you also need `libjitterentropy3-dev` until
90
+ [Ubuntu bug #2158026](https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/2158026) is fixed:
91
+
92
+ ```shell
93
+ apt install libjitterentropy3-dev
87
94
  ```
88
95
 
89
96
  Finally, install Oxidized:
data/Rakefile CHANGED
@@ -30,7 +30,7 @@ task :test do
30
30
  t.ruby_opts = ['-W:deprecated']
31
31
  # Don't display ambiguity warning between regexp and division in models
32
32
  t.warning = false
33
- t.verbose = true
33
+ t.verbose = false
34
34
  end
35
35
  end
36
36
 
@@ -83,7 +83,6 @@ username: oxidized
83
83
  password: S3cr3tx
84
84
  model: junos
85
85
  interval: 3600 #interval in seconds, when 0 is configured no fetch config is done at initial start and after
86
- log: ~/.config/oxidized/log
87
86
  debug: false
88
87
  threads: 30 # maximum number of threads
89
88
  # use_max_threads:
@@ -143,6 +142,16 @@ model_map:
143
142
  cisco: ios
144
143
  juniper: junos
145
144
  !ruby/regexp /procurve/: procurve
145
+ logger:
146
+ # The default level is :info
147
+ # level: :info
148
+ appenders:
149
+ - type: syslog
150
+ level: :error
151
+ - type: stdout
152
+ level: :warn
153
+ - type: file
154
+ file: ~/.config/oxidized/info.log
146
155
  ```
147
156
 
148
157
  ## Advanced Group Configuration
@@ -189,7 +189,7 @@ The macro (with defaults) implements following code:
189
189
  if vars(:enable) == true
190
190
  cmd "enable"
191
191
  elsif vars(:enable)
192
- cmd "enable", /^[pP]assword:/
192
+ cmd "enable", /password/i
193
193
  cmd vars(:enable)
194
194
  end
195
195
  end
@@ -319,13 +319,13 @@ If you want the model to be integrated into Oxidized, you can
319
319
  This is a greatly appreciated submission, as there are probably other users
320
320
  using the same network device as you are.
321
321
 
322
- A good (and optional) practice for submissions is to provide a
323
- [unit test for your model](/docs/ModelUnitTests.md). This reduces the risk that
324
- further developments could break it, and facilitates debugging issues without
325
- having access to a physical network device for the model.
322
+ Every model submission should include at least a
323
+ [YAML simulation file](/docs/DeviceSimulation.md), with the expected
324
+ output needed for an automated [unit test](/docs/ModelUnitTests.md). These
325
+ reduce the risk that further developments could break the model and facilitate
326
+ debugging issues without access to a physical network device.
326
327
 
327
328
  ## Advanced feature: output type
328
-
329
329
  The loosely-coupled architecture of Oxidized allows for easy extensibility in more advanced use cases as well.
330
330
 
331
331
  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.
@@ -26,6 +26,31 @@ of the Oxidized model and `<description>` is the name of the test case.
26
26
  `<description>` is generally formatted as `<hardware>_<software>` or
27
27
  `<hardware>_<software>_<information>`.
28
28
 
29
+ ### YAML Format
30
+ The YAML file has two sections:
31
+ - init_prompt: describing the lines sent by the device before we can send a
32
+ command. It usually includes MOTD banners and must include the first prompt.
33
+ - commands: the commands the Oxidized model sends to the network device and
34
+ their outputs.
35
+
36
+ The outputs are multiline and use YAML block scalars (`|`), with the trailing \n
37
+ removed (`-` after `|`). The outputs include the echo of the given command and
38
+ the next prompt. Escape characters are coded in Ruby style (\n, \r...).
39
+
40
+ Here is a shortened example of a YAML file:
41
+ ```yaml
42
+ ---
43
+ init_prompt: |-
44
+ \e[4m\rLAB-R1234_Garderos#\e[m\x20
45
+ commands:
46
+ show system version: |-
47
+ show system version
48
+ grs-gwuz-armel/003_005_068 (Garderos; 2021-04-30 16:19:35)
49
+ \e[4m\rLAB-R1234_Garderos#\e[m\x20
50
+ # ...
51
+ exit: ""
52
+ ```
53
+
29
54
  ### Creating a YAML Simulation File with device2yaml.rb
30
55
  A device does not only output the ASCII text we can see in the console.
31
56
  It adds ANSI escape codes for nice colors, bold and underline, \r, and so on.
@@ -53,13 +78,15 @@ Usages:
53
78
  command2
54
79
  command3" [options]
55
80
 
56
- -i and -c are mutualy exclusive, one must be specified
81
+ -i and -c are mutually exclusive, one must be specified
57
82
 
58
83
  [options]:
59
84
  -c, --commands "command list" specify the commands to be run
60
85
  -i, --input file Specify an input file for commands to be run
61
86
  -o, --output file Specify an output YAML-file
62
- -t, --timeout value Specify the idle timeout beween commands (default: 5 seconds)
87
+ -p, --port port Specify SSH port (default: 22)
88
+ -t, --timeout value Specify the idle timeout between commands (default: 5 seconds)
89
+ -n, --newline value Line terminator appended to each command (default: \n)
63
90
  -e, --exec-mode Run ssh in exec mode (without tty)
64
91
  -u, --unordered The YAML simulation should not enforce an order of the commands
65
92
  -h, --help Print this help
@@ -68,9 +95,9 @@ Usages:
68
95
  - `[user@]host` specifies the user and host to connect to the device. The
69
96
  password will be prompted interactively by the script. If you do not specify a
70
97
  user, it will use the user executing the script.
71
- - The commands that will be run on the device must be defined in
72
- `deviceyaml.rb`. You can give the commands online with `-c` or read them from a
73
- file (one line per command) with `-i`. The commands should match exactly the
98
+ - The commands that will be run on the device are passed to
99
+ `device2yaml.rb`. You can give them on the command line with `-c` or read them
100
+ from a file (one line per command) with `-i`. The commands should match exactly the
74
101
  ones of the model (no abbreviations) and include the commands of the
75
102
  `post_login` and `pre_logout` sections. When using `-c` and editing the shell
76
103
  command line, `CTRL-V CTRL-J` is very useful to add a line break.
@@ -91,6 +118,11 @@ you will have to use the option `-e` to run `device2yaml.rb` in SSH exec mode.
91
118
  the model uses, use the option `-u`. Note that the `unordered` mode may not
92
119
  produce a useful YAML file when combined with user input (see
93
120
  [Interactive Mode](#interactive-mode) below).
121
+ - Commands are terminated with `\n` by default. Some CLIs (e.g. TP-Link) execute
122
+ a command only on a carriage return; for those, set the line terminator with
123
+ `-n`/`--newline` (it understands the `\n` and `\r` escapes), e.g.
124
+ `-n '\r\n'`. The chosen terminator is recorded in the YAML file as a
125
+ `command_newline` key, so it is clear how the simulation was captured.
94
126
 
95
127
  Note that `device2yaml.rb` takes some time to run because of the idle timeout of
96
128
  (default) 5 seconds between each command. You can press the "Escape" key if you
@@ -109,6 +141,49 @@ show inventory
109
141
  show running-config
110
142
  exit" -o spec/model/data/ios#C8200L_16.12.1#simulation.yaml
111
143
  ```
144
+
145
+ #### Interactive Mode
146
+ The `device2yaml.rb` script is basic and sometimes needs some help, especially
147
+ when dealing with a device that sends its output page by page and requires you
148
+ to press space for the next page. `device2yaml.rb` does not know how to handle
149
+ this.
150
+
151
+ While `device2yaml.rb` is running, you can type anything on the keyboard, and it
152
+ will be sent to the remote device. So you can press space or 'n' to get the next
153
+ page.
154
+
155
+ You can also use this to enter an enable password.
156
+
157
+ Every key press will be recorded in the YAML file, so that it can be used
158
+ in the simulation afterwards, especially for devices that paginate output. You
159
+ may need to clean the YAML file manually if you don't want some input (such
160
+ as passwords) to be included.
161
+
162
+ If you press the "Esc" key, `device2yaml.rb` will not wait for the idle timeout
163
+ and will process the next command right away.
164
+
165
+ ### Creating a YAML Simulation File with the debug option
166
+ Instead of running `device2yaml.rb` separately, you can let a running Oxidized
167
+ instance produce the YAML simulation file directly from a real backup session.
168
+ This is handy because it captures exactly the commands your model sends,
169
+ including the `post_login` and `pre_logout` sections, without having to list
170
+ them manually.
171
+
172
+ Starting with version 0.37.0, enable the `yaml` value of the `debug` option in
173
+ the `input` section of your Oxidized configuration:
174
+
175
+ ```yaml
176
+ input:
177
+ default: ssh
178
+ debug: yaml
179
+ ```
180
+
181
+ The YAML simulation file is created for `ssh` sessions in
182
+ `~/.config/oxidized/logs/` (or `$OXIDIZED_LOGS/logs/`), with the naming
183
+ convention `<IP-Address>-ssh-<timestamp>.yaml`. A new file is created for
184
+ each session. See [Debugging](/docs/Inputs.md#debugging) for the other available
185
+ `debug` values.
186
+
112
187
  ### Publishing the YAML Simulation File to Oxidized
113
188
  Publishing the YAML simulation file of your device helps maintain Oxidized. This
114
189
  task may take some time, and we are very grateful that you take this time for
@@ -148,49 +223,3 @@ Examples:
148
223
  When you are finished, commit and push to your forked repository on GitHub, and
149
224
  submit a Pull Request. Thank you for your help!
150
225
 
151
- ### Interactive Mode
152
- The `device2yaml.rb` script is basic and sometimes needs some help, especially
153
- when dealing with a device that sends its output page by page and requires you
154
- to press space for the next page. `device2yaml.rb` does not know how to handle
155
- this.
156
-
157
- While `device2yaml.rb` is running, you can type anything on the keyboard, and it
158
- will be sent to the remote device. So you can press space or 'n' to get the next
159
- page.
160
-
161
- You can also use this to enter an enable password.
162
-
163
- Every key press will be recorded in the YAML file, so that it can be used
164
- in the simulation afterwards, especialy for devices that paginate output. You
165
- may need to clean the YAML file manually if you don't want some input (such
166
- as passwords) to be included.
167
-
168
- If you press the "Esc" key, `device2yaml.rb` will not wait for the idle timeout
169
- and will process the next command right away.
170
-
171
- ### YAML Format
172
- The YAML file has two sections:
173
- - init_prompt: describing the lines sent by the device before we can send a
174
- command. It usually includes MOTD banners and must include the first prompt.
175
- - commands: the commands the Oxidized model sends to the network device and
176
- their outputs.
177
-
178
- The outputs are multiline and use YAML block scalars (`|`), with the trailing \n
179
- removed (`-` after `|`). The outputs include the echo of the given command and
180
- the next prompt. Escape characters are coded in Ruby style (\n, \r...).
181
-
182
- Here is a shortened example of a YAML file:
183
- ```yaml
184
- ---
185
- init_prompt: |-
186
- \e[4m\rLAB-R1234_Garderos#\e[m\x20
187
- commands:
188
- show system version: |-
189
- show system version
190
- grs-gwuz-armel/003_005_068 (Garderos; 2021-04-30 16:19:35)
191
- \e[4m\rLAB-R1234_Garderos#\e[m\x20
192
- # ...
193
- exit: ""
194
- ```
195
-
196
-
data/docs/Docker.md CHANGED
@@ -196,6 +196,55 @@ If you don't want to authenticate with user & password but with a ssh-key, you
196
196
  can set the ssh passphrase with the environment variable
197
197
  `OXIDIZED_SSH_PASSPHRASE`
198
198
 
199
+ ### Extend the image with additional gems or packages
200
+ Since release 0.35.0, the official image is based on `debian:trixie-slim`
201
+ instead of `phusion/baseimage`. `dumb-init` runs as PID 1 and starts runit
202
+ (`runsvdir -P /etc/service`), which supervises oxidized and the other services
203
+ in `/etc/service/`. `/sbin/my_init` and the other phusion/baseimage paths
204
+ (e.g. `/etc/my_init.d/`) do not exist anymore.
205
+
206
+ The build tools (`build-essential` and `ruby-dev`) are removed from the final
207
+ image. Running `gem install` in the container for a gem with a native extension
208
+ fails with `mkmf.rb can't find header files for ruby`, see Issue #3897.
209
+
210
+ If you need additional gems or packages, build your own image on top of the
211
+ official one. This example installs the gem `slack-api`, which depends on a
212
+ native extension:
213
+
214
+ ```dockerfile
215
+ FROM docker.io/oxidized/oxidized:0
216
+
217
+ RUN set -eux; \
218
+ apt-get update; \
219
+ apt-get install -y --no-install-recommends build-essential ruby-dev; \
220
+ gem install --no-document slack-api; \
221
+ apt-get remove -y build-essential ruby-dev; \
222
+ apt-get autoremove -y; \
223
+ apt-get clean; \
224
+ rm -rf /var/lib/apt/lists/*
225
+ ```
226
+
227
+ Save this as `Dockerfile` in an empty directory, build the image and run it the
228
+ same way as the official one:
229
+
230
+ ```shell
231
+ sudo docker build -t oxidized-custom .
232
+ sudo docker run --rm -v ~/oxidized-config:/home/oxidized/.config/oxidized -p 8888:8888/tcp oxidized-custom
233
+ ```
234
+
235
+ Do not override the entrypoint to run your own commands at startup. Use the
236
+ oxidized configuration where possible (for example [hooks](/docs/Hooks.md)).
237
+ If you need an additional process, add it as a runit service in your
238
+ Dockerfile:
239
+
240
+ ```dockerfile
241
+ COPY my-service.runit /etc/service/my-service/run
242
+ ```
243
+
244
+ The file must be an executable script. runit restarts it when it exits, so a
245
+ script that only has to run once must end with `sleep infinity`, like
246
+ [extra/update-ca-certificates.runit](/extra/update-ca-certificates.runit).
247
+
199
248
  ## Tipps & tricks
200
249
  ### podman & Debian Bookworm
201
250
  To install podman in Debian Bookwork, you need following packages: