in elkserver/docker/redelk-base/redelkinstalldata/scripts/modules/enrich_syncdomainslists/module.py [0:0]
def get_cfg_domains(self, domainslist):
"""Gets the list of Domains present in the config file"""
cfg_domainslist = []
fname = f"/etc/redelk/domainslist_{domainslist}.conf"
# Check first if the local config file exists; if not, skip the sync
if not os.path.isfile(fname):
self.logger.warning(
"File %s doesn't exist, skipping domain list sync for this one.", fname
)
return None
with open(fname, "r", encoding="utf-8") as config_file:
content = config_file.readlines()
for line in content:
domain_match = match_domain_name(line)
self.logger.debug("Domain match: %s", domain_match)
if domain_match and domain_match.group(1) is not None:
cfg_domainslist.append(
(
domain_match.group(1),
domain_match.group(len(domain_match.groups())),
)
)
else:
self.logger.debug("Invalid domain in %s: %s", fname, line)
return cfg_domainslist