mirror of
https://github.com/fail2ban/fail2ban.git
synced 2026-03-11 08:55:31 +00:00
New tag '<ip-host>' introduced: can be used in actions to retrieve the host name (dns) from the IP address
This commit is contained in:
parent
b832b77e3c
commit
a0bb51ef92
2 changed files with 6 additions and 0 deletions
|
|
@ -291,6 +291,7 @@ class Actions(JailThread, Mapping):
|
|||
AI_DICT = {
|
||||
"ip": lambda self: self.__ticket.getIP(),
|
||||
"ip-rev": lambda self: self['ip'].getPTR(''),
|
||||
"ip-host": lambda self: self['ip'].getHost(),
|
||||
"fid": lambda self: self.__ticket.getID(),
|
||||
"failures": lambda self: self.__ticket.getAttempt(),
|
||||
"time": lambda self: self.__ticket.getTime(),
|
||||
|
|
|
|||
|
|
@ -376,6 +376,11 @@ class IPAddr(object):
|
|||
|
||||
return "%s.%s" % (".".join(reversed(exploded_ip)), suffix)
|
||||
|
||||
def getHost(self):
|
||||
"""Return the host name (DNS) of the provided IP address object
|
||||
"""
|
||||
return DNSUtils.ipToName(self.ntoa)
|
||||
|
||||
@property
|
||||
def isIPv4(self):
|
||||
"""Either the IP object is of address family AF_INET
|
||||
|
|
|
|||
Loading…
Reference in a new issue