Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
Add default config values for suricata-threatbus
Browse files Browse the repository at this point in the history
  • Loading branch information
Benno Evers committed Jul 21, 2021
1 parent 7b9f9d9 commit f847c19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions apps/suricata/config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ logging:
threatbus: localhost:13370
snapshot: 30
# The socket to use for connecting with Suricata.
socket: /var/run/suricata/suricata-command.socket
rules_file: /var/lib/suricata/rules/threatbus.rules
socket: /var/run/suricata/suricata-command.socket # Required.
rules_file: /var/lib/suricata/rules/threatbus.rules # Required.
# Interval in seconds to trigger `suricatasc -c ruleset-reload-nonblocking`
reload_interval: 60
20 changes: 9 additions & 11 deletions apps/suricata/suricata_threatbus/suricata.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,23 @@ def validate_config(config: Settings):
Validates the given Dynaconf object. Throws if the config is invalid.
"""
validators = [
Validator("logging.console", is_type_of=bool, required=True, eq=True)
| Validator("logging.file", is_type_of=bool, required=True, eq=True),
Validator("logging.console", is_type_of=bool, default=True),
Validator("logging.file", is_type_of=bool, default=False),
Validator(
"logging.console_verbosity",
is_in=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
required=True,
when=Validator("logging.console", eq=True),
default="INFO",
),
Validator(
"logging.file_verbosity",
is_in=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
required=True,
when=Validator("logging.file", eq=True),
default="INFO",
),
Validator(
"logging.filename", required=True, when=Validator("logging.file", eq=True)
),
Validator("threatbus", "socket", "rules_file", required=True),
Validator("snapshot", "reload_interval", is_type_of=int, required=True),
Validator("logging.filename", default="suricata-threatbus.log"),
Validator("threatbus", default="localhost:13370"),
Validator("socket", "rules_file", required=True),
Validator("snapshot", is_type_of=int, default=30),
Validator("reload_interval", is_type_of=int, default=60),
]

config.validators.register(*validators)
Expand Down

0 comments on commit f847c19

Please sign in to comment.