]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
suricata-reporter: Read a configuration file
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 6 Aug 2025 14:12:14 +0000 (15:12 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 3 Sep 2025 17:42:00 +0000 (18:42 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/suricata/suricata-reporter

index d5d8201b6faa8cda8ef54f2379df4dde29f09af5..0aed5e3deb5376923cb5c14555b09bcd242e5e5e 100644 (file)
@@ -21,6 +21,7 @@
 
 import argparse
 import asyncio
+import configparser
 import datetime
 import email.message
 import email.utils
@@ -54,7 +55,11 @@ class Reporter(object):
        """
                This is the main class that handles all the things...
        """
-       def __init__(self):
+       def __init__(self, config):
+               # Parse the configuration file
+               self.config = configparser.ConfigParser()
+               self.config.read(config)
+
                # Fetch CPU count
                cpu_count = multiprocessing.cpu_count()
 
@@ -374,6 +379,8 @@ async def main():
 
        # Command Line Arguments
        parser.add_argument("--verbose", "-v", action="count", help="Be more verbose")
+       parser.add_argument("--config", "-c",
+               help="Configuration File", default="/etc/suricata/reporter.conf")
 
        # Parse command line arguments
        args = parser.parse_args()
@@ -390,7 +397,7 @@ async def main():
        setup_logging(loglevel=loglevel)
 
        # Create the repoert
-       reporter = Reporter()
+       reporter = Reporter(args.config)
 
        # Run!
        await reporter.run()