added better error handling for new variables

slight_refactoring
Sascha Rommelfangen 2018-04-13 09:15:25 +02:00 committed by GitHub
parent 299b1ae8ff
commit b235d5a416
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 27 deletions

View File

@ -128,33 +128,40 @@ if debug:
syslog.syslog(email_subject) syslog.syslog(email_subject)
syslog.syslog(email_data) syslog.syslog(email_data)
misp_url = config.misp_url try:
misp_key = config.misp_key misp_url = config.misp_url
misp_verifycert = config.misp_verifycert misp_key = config.misp_key
m2m_key = config.m2m_key misp_verifycert = config.misp_verifycert
m2m_auto_distribution = config.m2m_auto_distribution m2m_key = config.m2m_key
m2m_attachment_keyword = config.m2m_attachment_keyword m2m_auto_distribution = config.m2m_auto_distribution
m2m_attachment_keyword = config.m2m_attachment_keyword
resolver = dns.resolver.Resolver(configure=False) resolver = dns.resolver.Resolver(configure=False)
resolver.nameservers = config.nameservers resolver.nameservers = config.nameservers
excludelist = config.excludelist
excludelist = config.excludelist externallist = config.externallist
externallist = config.externallist internallist = config.internallist
internallist = config.internallist noidsflaglist = config.noidsflaglist
noidsflaglist = config.noidsflaglist ignorelist = config.ignorelist
ignorelist = config.ignorelist enforcewarninglist = config.enforcewarninglist
enforcewarninglist = config.enforcewarninglist sighting = config.sighting
sighting = config.sighting sighting_source = config.sighting_source
sighting_source = config.sighting_source removelist = config.removelist
removelist = config.removelist malwaretags = config.malwaretags
malwaretags = config.malwaretags dependingtags = config.dependingtags
dependingtags = config.dependingtags tlptag_default = config.tlptag_default
tlptag_default = config.tlptag_default stopword = config.stopword
stopword = config.stopword hash_only_tags = config.hash_only_tags
hash_only_tags = config.hash_only_tags forward_identifiers = config.forward_identifiers
forward_identifiers = config.forward_identifiers attach_original_mail = config.attach_original_mail
attach_original_mail = config.attach_original_mail except Exception as e:
syslog.syslog(str(e))
print("There is a problem with the configuration. A mandatory configuration variable is not set."
print("Did you just update? mail_to_misp might have new configuration variables."
print("Please compare with the configuration example.").
print("\nTrace:")
print(e)
sys.exit(-2)
original_email_data = email_data original_email_data = email_data
# Ignore lines in body of message # Ignore lines in body of message