-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
130 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -7,16 +7,28 @@ This module is maintained by [The Shadowserver Foundation](https://www.shadowser | |
|
||
Please contact [email protected] with any issues or concerns. | ||
|
||
The report configuration is now stored in a _schema.json_ file downloaded from https://interchange.shadowserver.org/intelmq/v1/schema. | ||
The report configuration is now stored in a _shadowserver-schema.json_ file downloaded from https://interchange.shadowserver.org/intelmq/v1/schema. | ||
|
||
For environments that have internet connectivity the `update_schema.py` script should be called from a cron job to obtain the latest revision. | ||
The parser will attempt to download a schema update on startup unless INTELMQ_SKIP_INTERNET is set. | ||
The parser will attempt to download a schema update on startup when the *auto_update* option is enabled. | ||
|
||
For air-gapped systems automation will be required to download and copy the _schema.json_ file into this directory. | ||
Schema downloads can also be scheduled as a cron job: | ||
|
||
``` | ||
02 01 * * * intelmq.bots.parsers.shadowserver.parser --update-schema | ||
``` | ||
|
||
For air-gapped systems automation will be required to download and copy the file to VAR_STATE_PATH/shadowserver-schema.json. | ||
|
||
The parser will automatically reload the configuration when the file changes. | ||
|
||
|
||
## Schema contract | ||
|
||
Once set the `classification.identifier`, `classification.taxonomy`, and `classification.type` fields will remain static. | ||
|
||
Once set report fields will not be deleted. | ||
|
||
|
||
## Sample configuration: | ||
|
||
``` | ||
|
@@ -46,6 +58,7 @@ shadowserver-parser: | |
parameters: | ||
destination_queues: | ||
_default: [file-output-queue] | ||
auto_update: true | ||
run_mode: continuous | ||
``` | ||
|
This file contains 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 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 was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
intelmq/tests/bots/parsers/shadowserver/test_download_schema.py
This file contains 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,28 @@ | ||
# SPDX-FileCopyrightText: 2023 The Shadowserver Foundation | ||
# | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Thu Jul 27 19:44:44 2023 | ||
""" | ||
|
||
import unittest | ||
import os | ||
import logging | ||
from intelmq import VAR_STATE_PATH | ||
import intelmq.bots.parsers.shadowserver._config as config | ||
import intelmq.lib.utils as utils | ||
import intelmq.lib.test as test | ||
|
||
@test.skip_internet() | ||
class TestShadowserverSchemaDownload(unittest.TestCase): | ||
|
||
def test_download(self): | ||
schema_file = os.path.join(VAR_STATE_PATH, 'shadowserver-schema.json') | ||
config.set_logger(utils.log('test-bot', log_path=None)) | ||
if os.path.exists(schema_file): | ||
os.unlink(schema_file) | ||
self.assertEqual(True, config.update_schema()) | ||
self.assertEqual(True, os.path.exists(schema_file)) |