Skip to content

Commit

Permalink
Adding USER_WHITELIST option
Browse files Browse the repository at this point in the history
  • Loading branch information
stamparm committed Dec 18, 2015
1 parent 246eb23 commit c0caaac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from core.settings import STATIC_IPCAT_LOOKUPS
from core.settings import TIMEOUT
from core.settings import TRAILS_FILE
from core.settings import WHITELIST

_ipcat_cursor = {}
_ipcat_cache = {}
Expand Down Expand Up @@ -181,7 +182,8 @@ def load_trails(quiet=False):
for row in reader:
if row:
trail, info, reference = row
retval[trail] = (info, reference)
if trail not in WHITELIST:
retval[trail] = (info, reference)

except Exception, ex:
exit("[x] something went wrong during trails file read '%s' ('%s')" % (TRAILS_FILE, ex))
Expand Down
6 changes: 5 additions & 1 deletion core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
trails = {}

NAME = "Maltrail"
VERSION = "0.8.209"
VERSION = "0.8.210"
SERVER_HEADER = "%s/%s" % (NAME, VERSION)
DATE_FORMAT = "%Y-%m-%d"
ROTATING_CHARS = ('\\', '|', '|', '/', '-')
Expand Down Expand Up @@ -217,6 +217,10 @@ def read_config(config_file):
if len(entry.split(':')) != 4:
exit("[!] invalid USERS entry '%s'" % entry)

if config.USER_WHITELIST:
for value in config.USER_WHITELIST.split(','):
WHITELIST.add(value.strip())

if not str(config.HTTP_PORT or "").isdigit():
exit("[!] invalid configuration value for 'HTTP_PORT' ('%s')" % config.HTTP_PORT)

Expand Down
3 changes: 3 additions & 0 deletions maltrail.conf
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ CHECK_SHORT_OR_MISSING_USER_AGENT false
# Capture HTTP requests with missing Host header (introducing potential false positives)
CHECK_MISSING_HOST false

# Comma delimited (custom user) whitelist (i.e. IP addresses, domain names, etc.)
USER_WHITELIST 127.0.0.1,localhost

# [All]

# Show debug messages (in console output)
Expand Down

0 comments on commit c0caaac

Please sign in to comment.