oxidized 0.34.3 → 0.35.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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codeql.yml +4 -4
  3. data/.github/workflows/publishdocker.yml +82 -11
  4. data/.github/workflows/ruby.yml +1 -1
  5. data/.github/workflows/stale.yml +1 -1
  6. data/.rubocop.yml +1 -0
  7. data/.rubocop_todo.yml +1 -1
  8. data/CHANGELOG.md +39 -1
  9. data/Dockerfile +74 -66
  10. data/README.md +2 -2
  11. data/Rakefile +21 -3
  12. data/docs/Configuration.md +92 -0
  13. data/docs/Creating-Models.md +85 -19
  14. data/docs/Ruby-API.md +52 -0
  15. data/docs/Supported-OS-Types.md +4 -1
  16. data/extra/oxidized.runit +1 -1
  17. data/lib/oxidized/core.rb +2 -1
  18. data/lib/oxidized/input/http.rb +9 -2
  19. data/lib/oxidized/input/scp.rb +3 -3
  20. data/lib/oxidized/input/ssh.rb +3 -3
  21. data/lib/oxidized/input/telnet.rb +2 -2
  22. data/lib/oxidized/model/adva.rb +1 -1
  23. data/lib/oxidized/model/airfiber.rb +1 -1
  24. data/lib/oxidized/model/aoscx.rb +29 -44
  25. data/lib/oxidized/model/aosw.rb +1 -1
  26. data/lib/oxidized/model/arubainstant.rb +18 -6
  27. data/lib/oxidized/model/asternos.rb +1 -1
  28. data/lib/oxidized/model/axos.rb +1 -1
  29. data/lib/oxidized/model/comtrol.rb +1 -1
  30. data/lib/oxidized/model/cumulus.rb +2 -7
  31. data/lib/oxidized/model/eatonnetwork.rb +5 -0
  32. data/lib/oxidized/model/eltex.rb +1 -1
  33. data/lib/oxidized/model/enterasys800.rb +1 -1
  34. data/lib/oxidized/model/fabricos.rb +1 -1
  35. data/lib/oxidized/model/fsos.rb +1 -1
  36. data/lib/oxidized/model/garderos.rb +1 -6
  37. data/lib/oxidized/model/ironware.rb +1 -1
  38. data/lib/oxidized/model/mlnxos.rb +3 -10
  39. data/lib/oxidized/model/model.rb +101 -12
  40. data/lib/oxidized/model/netgear.rb +1 -0
  41. data/lib/oxidized/model/netonix.rb +1 -1
  42. data/lib/oxidized/model/netscaler.rb +1 -1
  43. data/lib/oxidized/model/nxos.rb +9 -9
  44. data/lib/oxidized/model/onefinity.rb +1 -1
  45. data/lib/oxidized/model/opnsense.rb +8 -0
  46. data/lib/oxidized/model/perle.rb +35 -0
  47. data/lib/oxidized/model/pfsense.rb +8 -0
  48. data/lib/oxidized/model/saos10.rb +1 -1
  49. data/lib/oxidized/model/siklu.rb +1 -1
  50. data/lib/oxidized/model/siklumhtg.rb +1 -1
  51. data/lib/oxidized/model/sixwind.rb +1 -1
  52. data/lib/oxidized/model/slxos.rb +1 -1
  53. data/lib/oxidized/model/sonicos.rb +1 -1
  54. data/lib/oxidized/model/speedtouch.rb +1 -1
  55. data/lib/oxidized/model/telco.rb +1 -1
  56. data/lib/oxidized/model/tnsr.rb +7 -3
  57. data/lib/oxidized/model/trango.rb +1 -1
  58. data/lib/oxidized/model/ucs.rb +1 -1
  59. data/lib/oxidized/model/voltaire.rb +1 -1
  60. data/lib/oxidized/model/vyatta.rb +1 -1
  61. data/lib/oxidized/model/vyos.rb +34 -0
  62. data/lib/oxidized/model/zhoneolt.rb +1 -1
  63. data/lib/oxidized/model/zynoscli.rb +1 -1
  64. data/lib/oxidized/node.rb +6 -1
  65. data/lib/oxidized/source/http.rb +10 -2
  66. data/lib/oxidized/version.rb +2 -2
  67. data/oxidized.gemspec +4 -5
  68. metadata +13 -29
  69. data/lib/oxidized/model/timos.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a87e3af9faae64551e102d6cdc54df2e45faabca7ba632ca08ef5d75d15de049
4
- data.tar.gz: 1b53f1e19450f791ec11cdd61fe228764374d16aa41c1fef2c246c63f1cbaa4e
3
+ metadata.gz: 1c6d2a888514d85b0339a1c7511546258fc9af9665caf0702811d9a7712471c3
4
+ data.tar.gz: 5c1e9435a1c74249ac5eb13f8a56bc543766dfb51960791293b1c9acdc82a288
5
5
  SHA512:
6
- metadata.gz: 37b6c4f96885e86b5780ad61ce64e8f51292ddb2a33ab794cae270101f436cbaad3c684b7262b01197a61e93e8d45257dae2ecb3b080fb6befd9f93162778515
7
- data.tar.gz: 5b7739c4e7fa07904c94ad241d9a95c636d7774c517f1235db893192c0df938c8c91bd2d6efd161eaba7ea35cbbc7dd129a275d83f3d58386ca986126ef9adcf
6
+ metadata.gz: 382ebf9e233125c17f8ec5acd1fe426f8ba95d5a88e8d4f2f1ae3aebe3b5749945917f7887898b71de2bdce7851b50e4785f82ee72a0eb952a117746307b9fed
7
+ data.tar.gz: 5792b01eab4cb6208c4515fcabc891416b9c782b47fe7015220670c25271ab8c9719cbc7174a0605629b6e4373ab37ab46cbc60f19c787bed7d3ebe33af96eff
@@ -40,11 +40,11 @@ jobs:
40
40
 
41
41
  steps:
42
42
  - name: Checkout repository
43
- uses: actions/checkout@v4
43
+ uses: actions/checkout@v6
44
44
 
45
45
  # Initializes the CodeQL tools for scanning.
46
46
  - name: Initialize CodeQL
47
- uses: github/codeql-action/init@v3
47
+ uses: github/codeql-action/init@v4
48
48
  with:
49
49
  languages: ${{ matrix.language }}
50
50
  # If you wish to specify custom queries, you can do so here or in a config file.
@@ -58,7 +58,7 @@ jobs:
58
58
  # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
59
59
  # If this step fails, then you should remove it and run the build manually (see below)
60
60
  - name: Autobuild
61
- uses: github/codeql-action/autobuild@v3
61
+ uses: github/codeql-action/autobuild@v4
62
62
 
63
63
  # ℹ️ Command-line programs to run using the OS shell.
64
64
  # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -71,6 +71,6 @@ jobs:
71
71
  # ./location_of_script_within_repo/buildscript.sh
72
72
 
73
73
  - name: Perform CodeQL Analysis
74
- uses: github/codeql-action/analyze@v3
74
+ uses: github/codeql-action/analyze@v4
75
75
  with:
76
76
  category: "/language:${{matrix.language}}"
@@ -3,19 +3,33 @@ on:
3
3
  push:
4
4
  branches: [ "master" ]
5
5
  tags: [ "[0-9]+.[0-9]+.[0-9]+" ]
6
+ env:
7
+ REGISTRY_IMAGE: oxidized/oxidized
6
8
 
7
9
  jobs:
8
10
  build:
9
11
  if: github.repository_owner == 'ytti'
10
- runs-on: ubuntu-latest
12
+ runs-on: ${{ matrix.runner }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ include:
17
+ - platform: linux/amd64
18
+ runner: ubuntu-latest
19
+ - platform: linux/arm64
20
+ runner: ubuntu-24.04-arm
21
+
11
22
  steps:
23
+ - name: Prepare
24
+ run: |
25
+ platform=${{ matrix.platform }}
26
+ echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
12
27
 
13
- - name: Define tags
28
+ - name: Docker meta
14
29
  id: meta
15
30
  uses: docker/metadata-action@v5
16
31
  with:
17
- images: |
18
- oxidized/oxidized
32
+ images: ${{ env.REGISTRY_IMAGE }}
19
33
  tags: |
20
34
  type=semver,pattern={{version}}
21
35
  type=sha,prefix=master-
@@ -28,17 +42,74 @@ jobs:
28
42
  username: ${{ secrets.DOCKER_USERNAME }}
29
43
  password: ${{ secrets.DOCKER_PASSWORD }}
30
44
 
31
- - name: Set up QEMU
32
- uses: docker/setup-qemu-action@v3
33
-
34
45
  - name: Set up Docker Buildx
35
46
  uses: docker/setup-buildx-action@v3
36
47
 
37
- - name: Build and push
48
+ - name: Build and push by digest
49
+ id: build
38
50
  uses: docker/build-push-action@v6
39
51
  with:
40
- platforms: linux/amd64,linux/arm64
41
- push: true
42
- tags: ${{ steps.meta.outputs.tags }}
52
+ platforms: ${{ matrix.platform }}
53
+ tags: ${{ env.REGISTRY_IMAGE }}
54
+ labels: |
55
+ ${{ steps.meta.outputs.labels }}
56
+ org.opencontainers.image.ref.name=${{ steps.meta.outputs.version }}
43
57
  build-args: |
44
58
  BUILDKIT_CONTEXT_KEEP_GIT_DIR=true
59
+ outputs: type=image,push-by-digest=true,name-canonical=true,push=true
60
+
61
+ - name: Export digest
62
+ run: |
63
+ mkdir -p ${{ runner.temp }}/digests
64
+ digest="${{ steps.build.outputs.digest }}"
65
+ touch "${{ runner.temp }}/digests/${digest#sha256:}"
66
+
67
+ - name: Upload digest
68
+ uses: actions/upload-artifact@v5
69
+ with:
70
+ name: digests-${{ env.PLATFORM_PAIR }}
71
+ path: ${{ runner.temp }}/digests/*
72
+ if-no-files-found: error
73
+ retention-days: 1
74
+
75
+ merge:
76
+ runs-on: ubuntu-latest
77
+ needs:
78
+ - build
79
+ steps:
80
+ - name: Download digests
81
+ uses: actions/download-artifact@v6
82
+ with:
83
+ path: ${{ runner.temp }}/digests
84
+ pattern: digests-*
85
+ merge-multiple: true
86
+
87
+ - name: Login to Docker Hub
88
+ uses: docker/login-action@v3
89
+ with:
90
+ username: ${{ secrets.DOCKER_USERNAME }}
91
+ password: ${{ secrets.DOCKER_PASSWORD }}
92
+
93
+ - name: Set up Docker Buildx
94
+ uses: docker/setup-buildx-action@v3
95
+
96
+ - name: Docker meta
97
+ id: meta
98
+ uses: docker/metadata-action@v5
99
+ with:
100
+ images: ${{ env.REGISTRY_IMAGE }}
101
+ tags: |
102
+ type=semver,pattern={{version}}
103
+ type=sha,prefix=master-
104
+ flavor: |
105
+ latest=true
106
+
107
+ - name: Create manifest list and push
108
+ working-directory: ${{ runner.temp }}/digests
109
+ run: |
110
+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
111
+ $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
112
+
113
+ - name: Inspect image
114
+ run: |
115
+ docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
@@ -23,7 +23,7 @@ jobs:
23
23
  continue-on-error: ${{ matrix.ruby-version == 'ruby-head' }}
24
24
 
25
25
  steps:
26
- - uses: actions/checkout@v4
26
+ - uses: actions/checkout@v6
27
27
  - name: Set up Ruby
28
28
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
29
29
  # change this to (see https://github.com/ruby/setup-ruby#versioning):
@@ -12,7 +12,7 @@ jobs:
12
12
  stale:
13
13
  runs-on: ubuntu-latest
14
14
  steps:
15
- - uses: actions/stale@v9
15
+ - uses: actions/stale@v10
16
16
  with:
17
17
  stale-issue-message: 'This issue is stale because it has been open 90 days with no activity.'
18
18
  stale-pr-message: 'This PR is stale because it has been open 90 days with no activity.'
data/.rubocop.yml CHANGED
@@ -68,6 +68,7 @@ Style/FormatString:
68
68
 
69
69
  Style/FormatStringToken:
70
70
  EnforcedStyle: unannotated
71
+ AllowedMethods: ['metadata']
71
72
 
72
73
  Style/HashEachMethods:
73
74
  Enabled: true
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-08-01 14:00:10 UTC using RuboCop version 1.79.1.
3
+ # on 2025-12-03 13:47:41 UTC using RuboCop version 1.81.7.
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
data/CHANGELOG.md CHANGED
@@ -4,13 +4,51 @@ 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.35.0 - 2025-12-04]
8
+ ### Release Notes
9
+ - VyOS now has it's own Model and should be used for supported VyOS versions instead of the Vyatta Model.
10
+ - AosCX has been reworked and may break old OS versions. Submit an issue along with a YAML Simulation File if you encounter problems.
11
+ - TiMOS (deprecated model) has been removed. Use SROS.
12
+ - FortiOs will be reworked in Release 0.36 (Issue #3680). Subscribe to the issue if you want to be informed and test the model before the release.
13
+ - Support for Ruby 3.1 will be discontinued in Release 0.36 (Issue #3688) if no one objects.
14
+
15
+ ### Added
16
+ - Allow setting timeout on per node basis. Closes #3612 (@ytti)
17
+ - Added Vyos as individual model. Closes #3603 #3560 (@nicolasberens)
18
+ - Add metadata to models. Closes #3249 (@robertcheramy)
19
+ - perle: new model for console servers (@robertcheramy)
20
+ - Introduce [conditional commands](/docs/Ruby-API.md#conditional-commands) (@robertcheramy)
21
+
22
+ ### Changed
23
+ - tnsr: added simulation data for older versions (@Vantomas)
24
+ - docker image: change default shell to bash. (@electrocret)
25
+ - refactor suppression of ANSI escape codes into model.rb (use `clean :escape_codes` in your model. Updated cumulus, garderos, mlnxos and vyos. (@robertcheramy)
26
+ - aoscx: rework handling of ANSI escape codes (@robertcheramy)
27
+ - docker: build on arm64 natively. Closes #3665 (@robertcheramy)
28
+ - docker image: move base image from phusion/baseimage to debian:trixie-slim (@robertcheramy)
29
+
30
+ ### Fixed
31
+ - input/http: bracket IPv6 URI. Fixes #3620 (@ytti)
32
+ - tnsr: fixed prompt regex, sometimes --More-- pager is misplaced on older versions (@ClumsyAdmin)
33
+ - eatonnetwork: Update for firmware v2.2.0 #3634 (@thanegill)
34
+ - input/http: Corrected pagination causing duplicated nodes. Fixes #3676 (@kquilliam)
35
+ - many models: fix redundant regular expressions (@robertcheramy)
36
+ - timos: remove deprecated model timos. Use sros. #3617 (@robertcheramy)
37
+ - fsos: set terminal width to 0. Fixes #3576 (@robertcheramy)
38
+ - aoscx: rework environmental data anonymization. Fixes #3568 (@robertcheramy, inspired by PR #3653 by @martadams89)
39
+ - netgear: fix prompt issues caused by ANSI escape codes. Fixes #3287 (@robertcheramy)
40
+ - remove redundant dependency on bundler producing a CI failure on ruby-head (@robertcheramy)
41
+ - nxos: use "show inventory" when "show inventory all" is not supported. Fixes #3657 (@robertcheramy)
42
+ - arubainstant: handle spaces/parentheses in AP names and add Zone column. Fixes #3611 (@iRomanyshyn, @robertcheramy)
43
+ - core: fix "undefined method `[]' for nil" when only extensions: configured. Fixes: #3607 (@robertcheramy)
44
+
45
+
7
46
  ## [0.34.3 - 2025-08-05]
8
47
  This release fixes an issue preventing /node/show/<hostname> to work in oxidized-web.
9
48
 
10
49
  ### Fixed
11
50
  - Guarantee that node vars is a dict (Issue ytti/oxidized-web#365) (@ytti)
12
51
 
13
-
14
52
  ## [0.34.2 – 2025-08-01]
15
53
  This release mainly fixes a bug in input/scp that made ssh raise an error when
16
54
  closing a closed connection (Issue #3583).
data/Dockerfile CHANGED
@@ -1,94 +1,102 @@
1
- FROM docker.io/phusion/baseimage:noble-1.0.2
2
-
3
- ENV DEBIAN_FRONTEND=noninteractive
1
+ FROM docker.io/debian:trixie-slim
4
2
 
5
3
  ##### Place "static" commands at the beginning to optimize image size and build speed
6
- # remove default ubuntu user
7
- RUN userdel -r ubuntu
8
4
 
9
5
  # add non-privileged user
10
- ARG UID=30000
11
- ARG GID=$UID
12
- RUN groupadd -g "${GID}" -r oxidized && useradd -u "${UID}" -r -m -d /home/oxidized -g oxidized oxidized
6
+ RUN groupadd -g "30000" -r oxidized && \
7
+ useradd -u "30000" -r -m -d /home/oxidized -g oxidized oxidized && \
8
+ chsh -s /bin/bash oxidized
13
9
 
10
+ # See PR #3637 - ruby runs /bin/sh and bash is whished for exec hooks
11
+ RUN ln -sf /bin/bash /bin/sh
14
12
 
15
13
  ##### MSMTP - Sending emails
16
14
  # link config for msmtp for easier use.
17
15
  # /home/oxidized/.msmtprc is a symbolic link to /home/oxidized/.config/oxidized/.msmtprc
18
16
  # Create the files as the user oxidized
19
17
  RUN mkdir -p /home/oxidized/.config/oxidized/ && \
20
- chmod -R ug=rwX,o= /home/oxidized/.config/ && \
21
18
  touch /home/oxidized/.config/oxidized/.msmtprc && \
22
- chmod -R u=rw,go= /home/oxidized/.config/oxidized/.msmtprc && \
23
19
  ln -s /home/oxidized/.config/oxidized/.msmtprc /home/oxidized/ && \
24
- chown -R oxidized:oxidized /home/oxidized/.config /home/oxidized/.msmtprc
20
+ chmod -R ug=rwX,o= /home/oxidized/.config/ && \
21
+ chown -R oxidized:oxidized /home/oxidized/
25
22
 
26
23
  # add runit services
27
24
  COPY extra/oxidized.runit /etc/service/oxidized/run
28
25
  COPY extra/auto-reload-config.runit /etc/service/auto-reload-config/run
29
26
  COPY extra/update-ca-certificates.runit /etc/service/update-ca-certificates/run
30
27
 
31
- # set up dependencies for the build process
32
- RUN apt-get -qy update \
33
- && apt-get -qy upgrade \
34
- && apt-get -qy --no-install-recommends install ruby \
35
- # Build process of oxidized from git and git-tools in the container
36
- git \
37
- # Allow git send-email from docker image
38
- git-email libmailtools-perl \
39
- # Allow sending emails in the docker container
40
- msmtp \
41
- # Debuging tools inside the container
42
- inetutils-telnet \
43
- # Use ubuntu gems where possible
44
- # Gems needed by oxidized
45
- ruby-rugged ruby-slop ruby-psych \
46
- ruby-net-telnet ruby-net-ssh ruby-net-ftp ruby-ed25519 \
47
- # Gem dependencies for inputs
48
- ruby-net-http-persistent ruby-mechanize \
49
- # Gem dependencies for sources
50
- ruby-sqlite3 ruby-mysql2 ruby-pg ruby-sequel ruby-gpgme\
51
- # Gem dependencies for hooks
52
- ruby-aws-sdk ruby-xmpp4r \
53
- # Gems needed by oxidized-web
54
- ruby-charlock-holmes ruby-haml ruby-htmlentities ruby-json \
55
- puma ruby-sinatra ruby-sinatra-contrib \
56
- && apt-get clean \
57
- && rm -rf /var/lib/apt/lists/*
58
-
59
- # gems not available in ubuntu noble
60
- RUN gem install --no-document \
61
- # dependencies for hooks
62
- slack-ruby-client cisco_spark \
63
- # dependencies for specific inputs
64
- net-tftp \
65
- # Net scp is needed in Version >= 4.1.0, which is not available in ubuntu
66
- net-scp
67
-
68
- # Prepare the build of oxidized, copy our workig directory in the container
28
+ # Prepare the build of oxidized, copy our working directory in the container
69
29
  COPY . /tmp/oxidized/
70
30
  WORKDIR /tmp/oxidized
71
31
 
72
- # Install gems which needs a build environment
73
- RUN apt-get -qy update && \
74
- apt-get -qy install --no-install-recommends \
75
- build-essential ruby-dev && \
76
- ##### X25519 (a.k.a. Curve25519) Elliptic Curve Diffie-Hellman
77
- gem install x25519 && \
78
- ##### build & install oxidized from the working repository
32
+ # set up dependencies for the build process
33
+ RUN set -eux; \
34
+ export DEBIAN_FRONTEND=noninteractive; \
35
+ apt-get update; \
36
+ # no apt-get upgrade needed, as debian images are rebuilt on security issues
37
+ apt-get install -y --no-install-recommends \
38
+ # runit: lightweight service supervisor
39
+ # dumb-init: proper PID 1 signal handling
40
+ # gosu: run oxidized as the user oxidized
41
+ runit dumb-init gosu \
42
+ # Build tools
43
+ build-essential ruby-dev \
44
+ # Useful tools
45
+ openssh-client vim-tiny inetutils-telnet \
46
+ # Dependencies for /extra scripts
47
+ curl jq \
48
+ # Build process of oxidized from git and git-tools in the container
49
+ git \
50
+ # Allow git send-email from docker image
51
+ git-email libmailtools-perl \
52
+ # Allow sending emails in the docker container
53
+ msmtp \
54
+ # Use debian packaged gems where possible
55
+ # ruby and core gems needed by oxidized
56
+ ruby ruby-rugged ruby-slop \
57
+ # Gem dependencies for inputs
58
+ ruby-net-telnet ruby-net-ssh ruby-net-ftp ruby-ed25519 ruby-net-scp \
59
+ ruby-net-http-persistent ruby-mechanize \
60
+ # Gem dependencies for sources
61
+ ruby-sqlite3 ruby-mysql2 ruby-pg ruby-sequel ruby-gpgme\
62
+ # Gem dependencies for hooks
63
+ ruby-aws-sdk ruby-xmpp4r \
64
+ # Gems needed by oxidized-web
65
+ ruby-charlock-holmes ruby-haml ruby-htmlentities ruby-json \
66
+ puma ruby-sinatra ruby-sinatra-contrib \
67
+ # Gems needed by slack-ruby-client
68
+ ruby-faraday ruby-faraday-net-http ruby-faraday-multipart ruby-hashie \
69
+ # Gems needed by semantic logger
70
+ ruby-concurrent \
71
+ ; \
72
+ # build & install oxidized from the working repository
79
73
  # docker automated build gets shallow copy, but non-shallow copy cannot be unshallowed
80
- git fetch --unshallow || true && \
81
- rake install && \
82
- # install oxidized-web
83
- gem install oxidized-web --no-document && \
74
+ git fetch --unshallow || true; \
75
+ rake install; \
76
+ # install oxidized-web and gems not available in debian trixie
77
+ gem install --no-document --no-wrappers --conservative --minimal-deps \
78
+ oxidized-web \
79
+ # dependencies for hooks
80
+ slack-ruby-client cisco_spark \
81
+ # dependencies for specific inputs
82
+ net-tftp \
83
+ ##### X25519 (a.k.a. Curve25519) Elliptic Curve Diffie-Hellman
84
+ x25519 \
85
+ ; \
84
86
  # remove the packages we do not need.
85
- apt-get -qy remove build-essential ruby-dev && \
86
- apt-get -qy autoremove && \
87
- apt-get clean && \
88
- rm -rf /var/lib/apt/lists/*
87
+ apt-get remove -y build-essential ruby-dev; \
88
+ apt-get autoremove -y ; \
89
+ apt-get clean; \
90
+ rm -rf /var/lib/apt/lists/*; \
91
+ find /var/lib/gems/*/cache -mindepth 1 -delete; \
92
+ rm -rf /tmp/oxidized;
89
93
 
90
- # clean up
91
94
  WORKDIR /
92
- RUN rm -rf /tmp/oxidized
93
95
 
94
96
  EXPOSE 8888/tcp
97
+
98
+ # dumb-init handles PID 1 for proper signal forwarding (Ctrl-C, SIGTERM)
99
+ ENTRYPOINT ["/usr/bin/dumb-init", "--"]
100
+
101
+ # runit supervises all services in /etc/service/
102
+ CMD ["runsvdir", "-P", "/etc/service"]
data/README.md CHANGED
@@ -84,7 +84,7 @@ add-apt-repository universe
84
84
  Install the dependencies:
85
85
 
86
86
  ```shell
87
- apt install ruby ruby-dev libsqlite3-dev libssl-dev pkg-config cmake libssh2-1-dev libicu-dev zlib1g-dev g++ libyaml-dev
87
+ apt install ruby ruby-dev libsqlite3-dev libssl-dev pkg-config cmake libssh2-1-dev libicu-dev zlib1g-dev g++ libyaml-dev libzstd-dev
88
88
  ```
89
89
 
90
90
  Finally, install Oxidized:
@@ -101,7 +101,7 @@ gem install oxidized-script # Script-based input/output extensions
101
101
  ```
102
102
 
103
103
  ### Rocky Linux, Red Hat Enterprise Linux
104
- These instructions has been verified on Rocky Linux 9.3 and Fedora.
104
+ These instructions has been verified on Rocky Linux 9, Rocky Linux 10 and Fedora.
105
105
 
106
106
  On Rocky Linux 9, you need to install/enable EPEL, CRB and Ruby 3.1:
107
107
  ```shell
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rake/testtask'
3
+ require 'time'
3
4
  require_relative 'lib/oxidized/version'
4
5
 
5
6
  gemspec = Gem::Specification.load(Dir['*.gemspec'].first)
@@ -92,17 +93,34 @@ desc 'Build the container image with docker or podman'
92
93
  task :build_container do
93
94
  branch_name = %x(git rev-parse --abbrev-ref HEAD).chop.gsub '/', '_'
94
95
  sha_hash = %x(git rev-parse --short HEAD).chop
96
+ sha_hash_long = %x(git rev-parse HEAD).chop
95
97
  image_tag = "#{branch_name}-#{sha_hash}"
98
+ created_time = Time.now.iso8601
99
+
100
+ # Build-Args for consistent labels
101
+ build_args = [
102
+ "--label org.opencontainers.image.title=oxidized",
103
+ "--label org.opencontainers.image.description='Local build of Oxidized'",
104
+ "--label org.opencontainers.image.url=https://github.com/ytti/oxidized",
105
+ "--label org.opencontainers.image.source=https://github.com/ytti/oxidized",
106
+ "--label org.opencontainers.image.created=#{created_time}",
107
+ "--label org.opencontainers.image.ref.name=#{image_tag}",
108
+ "--label org.opencontainers.image.licenses=Apache-2.0",
109
+ "--label org.opencontainers.image.version=#{image_tag}",
110
+ "--label org.opencontainers.image.revision=#{sha_hash_long}",
111
+ "-t oxidized:#{image_tag}",
112
+ "-t oxidized:latest"
113
+ ].join(' ')
96
114
 
97
115
  # Prefer podman if available as it runs rootless
98
116
  if command_available?('podman')
99
- sh "podman build -t oxidized:#{image_tag} -t oxidized:latest ."
117
+ sh "podman build #{build_args} ."
100
118
  elsif command_available?('docker')
101
119
  if docker_needs_root?
102
120
  puts 'docker needs root to build the image. Using sudo...'
103
- sh "sudo docker build -t oxidized:#{image_tag} -t oxidized:latest ."
121
+ sh "sudo docker build #{build_args} ."
104
122
  else
105
- sh "docker build -t oxidized:#{image_tag} -t oxidized:latest ."
123
+ sh "docker build #{build_args} ."
106
124
  end
107
125
  else
108
126
  puts 'You need Podman or Docker to build the container image.'
@@ -456,3 +456,95 @@ The threads used to fetch the configs are named `Oxidized::Job 'hostname'`:
456
456
  /home/xxx/oxidized/lib/oxidized/input/ssh.rb:127:in `sleep'
457
457
  /home/xxx/oxidized/lib/oxidized/input/ssh.rb:127:in `block (2 levels) in expect'
458
458
  ```
459
+
460
+ ## Metadata
461
+ You can include some metadata in your model outputs, for this you have to set
462
+ the variable `metadata` to `true`:
463
+ ```yaml
464
+ vars:
465
+ metadata: true
466
+ ```
467
+
468
+ As every [variable](#options-credentials-vars-etc-precedence), you can set it on
469
+ model, group and even node level.
470
+
471
+ By default this will produce
472
+ `"%{comment}Fetched by Oxidized with model %{model} from host %{name} [%{ip}]\n"`
473
+ at the first line of every model output. Some models with specific needs (XML
474
+ for example) will save the metadata differently (for example, OpnSense and
475
+ PfSense save an XML comment at the end of the model).
476
+
477
+ ### Customize metadata
478
+ You can customize the metadata produced by setting the varibles `metadata_top`
479
+ (top of the file) and `metadata_bottom` (bottom of the file).
480
+
481
+ These variables accept string templates, and you can include newline characters
482
+ (\n) to control formatting.
483
+
484
+ Both `metadata_top` and `metadata_bottom` support interpolation of dynamic values
485
+ using the following substitution templates:
486
+ - `%{model}`: name of the Oxidized model
487
+ - `%{name}`: name of the node
488
+ - `%{ip}`: IP address of the node
489
+ - `%{group}`: group name of the node
490
+ - `%{comment}`: comment string used in the model output (`# `)
491
+ - `%{year}`: current year (`2025`)
492
+ - `%{month}`: current month, zero-padded (`03` for March)
493
+ - `%{day}`: current day, zero-padded (`09`)
494
+ - `%{hour}`: current hour (24-hour format, zero-padded)
495
+ - `%{minute}`: current minute, zero-padded
496
+ - `%{second}`: current second, zero-padded
497
+
498
+ Example:
499
+ ```yaml
500
+ vars:
501
+ metadata: true
502
+ metadata_top: "%{comment}Model: %{model}; Device %{name} [%{ip}] at %{year}-%{month}-%{day} %{hour}:%{minute}:%{second}\n"
503
+ ```
504
+
505
+ ### Customize metadata in models
506
+ When writing a custom metadata for a model, you can default to
507
+ `vars("metadata_*")` or the model default. You need to interpolate the strings
508
+ with interpolate_string. This example is taken from OpnSense, and makes an
509
+ XML comment of the default strings, with precedence for vars("metadata_bottom"),
510
+ as the XML comment is situated at the bottom.
511
+
512
+ ```ruby
513
+ metadata :bottom do
514
+ xmlcomment interpolate_string(
515
+ vars("metadata_bottom") ||
516
+ vars("metadata_top") ||
517
+ Oxidized::Model::METADATA_DEFAULT
518
+ )
519
+ end
520
+ ```
521
+
522
+ You can also change the metadata in the models in your configuration directory with
523
+ [monkey patching](Creating-Models.md#monkey-patching-blocks-in-existing-models).
524
+ This can be done in two ways:
525
+
526
+ 1. Interpolation string:
527
+ ```ruby
528
+ require 'oxidized/model/ios.rb'
529
+
530
+ class IOS
531
+ metadata :top, "%{comment}Model: %{model}\n"
532
+ metadata :bottom, "%{comment}Will be placed at the end of the output\n"
533
+ end
534
+ ```
535
+
536
+ 2. For advanced code, you can use a code block, and access every variable of
537
+ the model:
538
+
539
+ ```ruby
540
+ require 'oxidized/model/opnsense.rb'
541
+ class OpnSense
542
+ metadata :top do
543
+ xmlcomment "Model:#{self.class.name}, hostname: #{@node.name}, ip:#{@node.ip}"
544
+ end
545
+
546
+ metadata :bottom, nil
547
+ end
548
+ ```
549
+
550
+ Remove a previous metadata by setting it to `nil`.