diff --git a/contrib/cfgchanged.sh b/contrib/oxidized/cfgchanged.sh similarity index 100% rename from contrib/cfgchanged.sh rename to contrib/oxidized/cfgchanged.sh diff --git a/contrib/validate_config.sh b/contrib/oxidized/validate_config.sh similarity index 100% rename from contrib/validate_config.sh rename to contrib/oxidized/validate_config.sh diff --git a/docs/oxidized-hook b/docs/oxidized-hook deleted file mode 100644 index 9cc0c13..0000000 --- a/docs/oxidized-hook +++ /dev/null @@ -1,43 +0,0 @@ -Oxidized webhook -###### - -This assumes using oxidized with an git basted storage, it might look little different if you use flat-file storage. - -Installation -**** - -1) create `/opt/nettools/` -2) copy `contrib/cfgchanged.sh` and `contrib/validate_config.sh` to /opt/nettools/ (make sure it's executable) - -Configuration -**** - -1) In the oxidized config file `.config/oxidized/config` add the following to fire `/opt/nettools/cfgchanged.sh` on every config change oxidized finds in it's targets : - hooks: - conf_changed: - type: exec - events: [post_store] - cmd: '/opt/nettools/cfgchanged.sh $OX_EVENT $OX_NODE_NAME $OX_NODE_IP $OX_NODE_FROM $OX_NODE_MSG $OX_NODE_GROUP $OX_NODE_MODEL $OX_JOB_STATUS $OX_JOB_TIME $OX_REPO_COMMITREF $OX_REPO_NAME -2) change the ouput folder in `validate_config.sh` to the folder you will find the reports **note: the old reports will be overwritten** - - -Now whenever oxidized detects a config change, the `/opt/nettools/cfgchanged.sh` script is fired. -It also calls the `validate_config.sh` script in that same folder, with two parameters: - -- The full name of the device config -- The devicetype as defined in oxidized - -This leaves you with (assuming you did not alter paths): - -- all most recent configs in `/opt/nettools/data/` (The tree structure below depends upon the oxidized config.) -- all report in $HOME/lint-reports - -SIEM -**** -There is a small (?) bonus here: -If you use an IDS (t.ex. OSSEC) you can monitors your device configs and report changes the network. Add this to the ossec.conf: - /opt/siemdata - - .git$ - -**NOTE: It only reports as fast and often as oxidized is running !!** diff --git a/docs/source/index.rst b/docs/source/index.rst index 445d42b..4b9cf7e 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -11,6 +11,7 @@ Table of Contents nos/index contributing check + integrations/index Indices and tables ------------------ diff --git a/docs/source/integrations/index.rst b/docs/source/integrations/index.rst new file mode 100644 index 0000000..ca67f4f --- /dev/null +++ b/docs/source/integrations/index.rst @@ -0,0 +1,9 @@ +Integrations +============ + +This section describes integrations with other software. + +.. toctree:: + :maxdepth: 1 + + oxidized \ No newline at end of file diff --git a/docs/source/integrations/oxidized.rst b/docs/source/integrations/oxidized.rst new file mode 100644 index 0000000..2af5888 --- /dev/null +++ b/docs/source/integrations/oxidized.rst @@ -0,0 +1,41 @@ +Oxidized hooks +============== + +This document describes how to integrate `Oxidized `_ with ``netlint``. + +.. NOTE:: + This tutorial assumes that you are using oxidized with git-based storage rather than file-based storage. + +Installation +------------ + +#. Create a folder to keep the hooks in. For the purposes of this example that shall be ``/opt/nettools/``. +#. Copy ``contrib/oxidized/cfgchanged.sh`` and ``contrib/oxidized/validate_config.sh`` to said folder and make sure they + are executable. + +Configuration +------------- + +#. In the oxidized config file ``.config/oxidized/config`` add the following to fire ``/opt/nettools/cfgchanged.sh`` on + every config change oxidized finds in it's targets:: + + hooks: + conf_changed: + type: exec + events: [post_store] + cmd: '/opt/nettools/cfgchanged.sh $OX_EVENT $OX_NODE_NAME $OX_NODE_IP $OX_NODE_FROM $OX_NODE_MSG $OX_NODE_GROUP $OX_NODE_MODEL $OX_JOB_STATUS $OX_JOB_TIME $OX_REPO_COMMITREF $OX_REPO_NAME' +#. Change the output folder in ``validate_config.sh`` to the folder want the linting reports in. + +.. DANGER:: + Any old reports will be overwritten. + +Now whenever oxidized detects a config change, the ``/opt/nettools/cfgchanged.sh`` script is executed. +It also calls the ``validate_config.sh`` script in that same folder, with two parameters: + +- The full name of the device config. +- The device type as defined in oxidized. + +This leaves you with (assuming you did not alter paths): + +- Most recent configuration files in ``/opt/nettools/data/`` (the tree structure below depends upon the oxidized config). +- Lint reports in ``$HOME/lint-reports``.