code review and ChangeLog entry

pull/1758/head
sebres 2017-04-24 21:12:01 +02:00
parent db16b4c22a
commit f75c3d8a02
2 changed files with 4 additions and 5 deletions

View File

@ -69,6 +69,8 @@ TODO: implementing of options resp. other tasks from PR #1346
- `<ip-rev>` - PTR reversed representation of IP address
- `<ip-host>` - host name of the IP address
- `<F-...>` - interpolates to the corresponding filter group capture `...`
- `<fq-hostname>` - fully-qualified name of host (the same as `$(hostname -f)`)
- `<sh-hostname>` - short hostname (the same as `$(uname -n)`)
* Allow to use filter options by `fail2ban-regex`, example:
fail2ban-regex text.log "sshd[mode=aggressive]"
* Samples test case factory extended with filter options - dict in JSON to control

View File

@ -148,11 +148,8 @@ class DNSUtils:
# get it using different ways (a set with names of localhost, hostname, fully qualified):
if names is None:
names = set(['localhost'])
for hostname in (socket.gethostname, socket.getfqdn):
try:
names |= set([hostname()])
except Exception as e: # pragma: no cover
logSys.warning("Retrieving own hostnames failed: %s", e)
for fqdn in (False, True):
names.add(DNSUtils.getHostname(fqdn=fqdn))
# cache and return :
DNSUtils.CACHE_ipToName.set(key, names)
return names