Skip to content
Browse files

Modify full path config file imports for alerts

  • Loading branch information...
pwnbus committed Aug 7, 2019
1 parent 2490b92 commit 12f9b5ecc5d0e3c437db44bcdf16614ef530ce05
Showing with 9 additions and 5 deletions.
  1. +2 −1 alerts/lib/
  2. +3 −1 alerts/
  3. +4 −3 tests/alerts/
@@ -118,8 +118,9 @@ def parse_config(self, config_filename, config_keys):
myparser = OptionParser()
self.config = None
(self.config, args) = myparser.parse_args([])
full_config_filename = os.path.join(os.path.dirname(__file__), "../", config_filename)
for config_key in config_keys:
temp_value = getConfig(config_key, "", config_filename)
temp_value = getConfig(config_key, "", full_config_filename)
setattr(self.config, config_key, temp_value)

def close_connections(self):
@@ -8,6 +8,7 @@
from lib.alerttask import AlertTask
from mozdef_util.query_models import SearchQuery, TermMatch
import re
import os

# This alert consumes data produced by the MIG sshkey module and mig-runner.
# ssh key related events are compared against a whitelist which is the
@@ -46,7 +47,8 @@ def main(self):
# Load whitelist from file system and store in object, path specifies the
# path to load the whitelist from
def _parse_whitelist(self, path):
with open(path) as fd:
full_config_filename = os.path.join(os.path.dirname(__file__), path)
with open(full_config_filename) as fd:
lns = [x.strip() for x in fd.readlines()]
for entry in lns:
@@ -9,16 +9,17 @@
import sys
import logging

from tests.unit_test_suite import UnitTestSuite

from freezegun import freeze_time
import mock

import copy
import re
import json

from tests.unit_test_suite import UnitTestSuite

from alerts.lib import alerttask
sys.path.append(os.path.join(os.path.dirname(__file__), "../../alerts/lib"))
from lib import alerttask

def mock_add_hostname_to_ip(ip):

0 comments on commit 12f9b5e

Please sign in to comment.
You can’t perform that action at this time.