Tighten restrictions on HOST
- private IP not allowed if intending for public use - localhost not allowed
This commit is contained in:
parent
81e6577838
commit
178de6c396
@ -122,9 +122,10 @@ class Env(LoggedClass):
|
|||||||
try:
|
try:
|
||||||
ip = ip_address(host)
|
ip = ip_address(host)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
bad = not bool(host.strip())
|
bad = host.lower().strip() in ('', 'localhost')
|
||||||
else:
|
else:
|
||||||
bad = ip.is_multicast or ip.is_unspecified
|
bad = (ip.is_multicast or ip.is_unspecified
|
||||||
|
or (ip.is_private and (self.irc or self.peer_announce)))
|
||||||
if bad:
|
if bad:
|
||||||
raise self.Error('"{}" is not a valid REPORT_HOST'.format(host))
|
raise self.Error('"{}" is not a valid REPORT_HOST'.format(host))
|
||||||
tcp_port = self.integer('REPORT_TCP_PORT', self.tcp_port) or None
|
tcp_port = self.integer('REPORT_TCP_PORT', self.tcp_port) or None
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user