mirror of https://github.com/fail2ban/fail2ban
New tag '<ip-host>' introduced: can be used in actions to retrieve the host name (dns) from the IP address
parent
b832b77e3c
commit
a0bb51ef92
|
@ -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 New Issue