mirror of https://github.com/fail2ban/fail2ban
code review and ChangeLog entry
parent
db16b4c22a
commit
f75c3d8a02
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue