-
-
Notifications
You must be signed in to change notification settings - Fork 414
Next release #1677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jokob-sk
wants to merge
4
commits into
main
Choose a base branch
from
next_release
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Next release #1677
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3a206f0
Add REST Import plugin and corresponding tests
jokob-sk 9c6e6d5
fix: Correct comment formatting in modals.php
jokob-sk bb29824
Merge branch 'next_release' of https://github.com/netalertx/NetAlertX…
jokob-sk a9b2f4b
Merge pull request #1678 from netalertx/main
jokob-sk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Plugin development skill | ||
|
|
||
| 1. Assess requirements | ||
| 2. Read `docs/PLUGINS_DEV.md` | ||
| 3. Confirm field mapping | ||
| 4. Ask clarifying questions | ||
| 5. code placed in `front/plugins/<new plugin name>` | ||
|
|
||
|
|
||
| Plugin prefix: | ||
|
|
||
| - has to be uppercase letters only (no underscores) | ||
| - must be unique | ||
| - keep short but readable if possible | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| ## Overview | ||
|
|
||
| Import devices from any REST API that returns JSON | ||
|
|
||
| Designed to replace small vendor-specific plugins for systems like OPNsense, RouterOS, asset management tools, and custom inventory APIs. Multiple endpoints can be configured independently in a single plugin instance. | ||
|
|
||
| ### Quick setup guide | ||
|
|
||
| Navigate to **Settings** > **REST Import** and click **Add** to create an import definition. | ||
|
|
||
| | Field | Description | | ||
| |---|---| | ||
| | **Name** | Friendly label shown in logs (e.g. `OPNsense DHCP`) | | ||
| | **URL** | Full REST endpoint URL | | ||
| | **Method** | `GET` or `POST` | | ||
| | **Verify SSL** | Disable for self-signed certificates | | ||
| | **Auth Type** | `none`, `basic`, or `bearer` | | ||
| | **Username / API Key** | Used with `basic` auth | | ||
| | **Password / API Secret** | Used with `basic` auth | | ||
| | **Bearer Token** | Used with `bearer` auth | | ||
| | **Custom Headers** | Optional. One `Key: Value` per line | | ||
| | **POST Body** | Optional JSON body for `POST` requests | | ||
| | **Device List Path** | Dot-separated path to the array of records (e.g. `rows`, `data.devices`). Leave blank if the response is already an array | | ||
|
|
||
| ### Field mapping | ||
|
|
||
| Map API response fields to NetAlertX scan fields. Leave a mapping blank to skip that field. | ||
|
|
||
| | Popup field | Scan column | | ||
| |---|---| | ||
| | MAC Address | `scanMac` | | ||
| | IP Address | `scanLastIP` | | ||
| | Device Name | `scanName` | | ||
| | Vendor | `scanVendor` | | ||
| | SSID | `scanSSID` | | ||
| | Device Type | `scanType` | | ||
| | Parent MAC | `scanParentMAC` | | ||
| | Parent Port | `scanParentPort` | | ||
| | Site | `scanSite` | | ||
| | VLAN | `scanVlan` | | ||
|
|
||
| ### Fake MAC generation | ||
|
|
||
| Enable **Generate Fake MAC** when the API does not expose MAC addresses (e.g. remote ICMP scans, IP-only inventory systems). A deterministic fake MAC is derived from the IP address using the `fa:ce:` prefix. Requires a valid IP mapping. | ||
|
|
||
| > [!WARNING] | ||
| > Fake MACs can cause inconsistencies if IP addresses change between scans. Static IPs are strongly recommended when using this feature. | ||
|
|
||
| ### Example: OPNsense Dnsmasq API | ||
|
|
||
| **Response:** | ||
| ```json | ||
| { | ||
| "rows": [ | ||
| { | ||
| "hwaddr": "94:18:65:de:22:01", | ||
| "address": "192.168.1.2", | ||
| "hostname": "Orbi-Base-Station", | ||
| "mac_info": "NETGEAR" | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| **Configuration:** | ||
| ``` | ||
| Name: OPNsense DHCP | ||
| URL: https://firewall/api/dnsmasq/leases/search | ||
| Method: GET | ||
| Auth Type: basic | ||
| Username: admin | ||
| Device List Path: rows | ||
| MAC Address: hwaddr | ||
| IP Address: address | ||
| Device Name: hostname | ||
| Vendor: mac_info | ||
| ``` | ||
|
|
||
| ### Notes | ||
|
|
||
| - Version: 1.0.0 | ||
| - Author: `jokob-sk` | ||
| - Records with missing or invalid MAC addresses are skipped unless **Generate Fake MAC** is enabled | ||
| - Each import definition executes independently; failed imports do not block others | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a language to the fenced configuration block.
The fenced block at Line 66 has no language identifier, matching the markdownlint MD040 warning.
📝 Suggested patch
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
@front/plugins/rest_import/README.mdaround lines 66 - 77, Add a languageidentifier to the fenced code block that contains the OPNsense DHCP
configuration example. Change the opening triple backticks (
) to include a language identifier (text) to comply with markdownlint rule MD040, whichrequires all fenced code blocks to have a specified language for proper syntax
highlighting and linting compliance.