Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions denyhosts-server.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
# denyhosts clients per sync. Default: 50
#max_reported_crackers: 50

# TCP addr to listen on. Default: empty (all)
#listen_address:

# TCP port to listen on. Default: 9911
#listen_port: 9911

Expand Down Expand Up @@ -110,6 +113,10 @@
# Default: yes
#resolve_hostnames: yes

# TCP addr to serve statistics. Can be the same a the listen_address in the
# [sync] section. Default: empty (all)
#listen_address:

# TCP port to serve statistics. Can be the same a the listen_port in the
# [sync] section. Default: 9911
#listen_port: 9911
4 changes: 4 additions & 0 deletions denyhosts_server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ def read_config(filename):
global max_reported_crackers
global logfile
global loglevel
global xmlrpc_listen_address
global xmlrpc_listen_port
global legacy_server
global legacy_frequency
global legacy_threshold, legacy_resiliency
global enable_debug_methods
global stats_frequency
global stats_resolve_hostnames
global stats_listen_address
global stats_listen_port
global static_dir, graph_dir, template_dir

Expand Down Expand Up @@ -103,6 +105,7 @@ def read_config(filename):
legacy_expiry_days = _getfloat(_config, "maintenance", "legacy_expiry_days", 30)

max_reported_crackers = _getint(_config, "sync", "max_reported_crackers", 50)
xmlrpc_listen_address = _get(_config, "sync", "listen_address", "")
xmlrpc_listen_port = _getint(_config, "sync", "listen_port", 9911)
enable_debug_methods = _getboolean(_config, "sync", "enable_debug_methods", False)
legacy_server = _get(_config, "sync", "legacy_server", None)
Expand Down Expand Up @@ -130,4 +133,5 @@ def read_config(filename):
graph_dir = _get(_config, "stats", "graph_dir", os.path.join(static_dir, "graph"))
template_dir = _get(_config, "stats", "template_dir", os.path.join(package_dir, "template"))
stats_resolve_hostnames = _getboolean(_config, "stats", "resolve_hostnames", True)
stats_listen_address = _get(_config, "stats", "listen_address", "")
stats_listen_port = _getint(_config, "stats", "listen_port", 9911)
10 changes: 5 additions & 5 deletions denyhosts_server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,15 @@ def start_listening():
# /static/graphs
web_static.putChild('graphs', web_graphs)

logging.info("Start listening on port {}".format(config.xmlrpc_listen_port))
logging.info("Start listening on host:port {}:{}".format(config.xmlrpc_listen_address, config.xmlrpc_listen_port))
_xmlrpc_site = server.Site(xmlrpc_root)
_xmlrpc_listener = reactor.listenTCP(config.xmlrpc_listen_port, _xmlrpc_site)
_xmlrpc_listener = reactor.listenTCP(config.xmlrpc_listen_port, _xmlrpc_site, interface=config.xmlrpc_listen_address)

if config.stats_listen_port == config.xmlrpc_listen_port:
if config.stats_listen_port == config.xmlrpc_listen_port and config.xmlrpc_listen_address == config.stats_listen_address:
_stats_listener = None
else:
logging.info("Start serving statistics on port {}".format(config.stats_listen_port))
_stats_listener = reactor.listenTCP(config.stats_listen_port, server.Site(stats_root))
logging.info("Start serving statistics on host:port {}:{}".format(config.stats_listen_address, config.stats_listen_port))
_stats_listener = reactor.listenTCP(config.stats_listen_port, server.Site(stats_root), interface=config.stats_listen_address)

maintenance_job = None
legacy_sync_job = None
Expand Down