Menu

Disable hostname lookups (for sshd)

Help
2020-08-29
2020-08-31
  • Joseph Mocker

    Joseph Mocker - 2020-08-29

    I am trying to figure out how to selectively disable hostname lookups for specific modules, like sshd.

    The LookupIP function in Logwatch.pm appears to provide this functionality, saying

    For (new) backward compatibility, this function now uses the $DoLookup
    variable in the caller's namespace to determine if lookups will be made.

    But for the life of me, I don't know what that means. I've tried adding various forms to my override.conf, including

        sshd: DoLookup = 0
        DoLookup = 0
        $DoLookup = 0
    

    None of which appeared to do anything. For now I've found a global option "numeric" to disable hostname lookups everywhere.

     
  • Bjorn

    Bjorn - 2020-08-31

    Didn't know the variable DoLookup existed. Looking through the code, it appears that only the service iptables makes use of it. (Services courier and pound seem to use it, but they define their own LookupIP function. Services named and secure have them commented out. )

    The issue is that the variable needs to be defined inside the script; sshd currently does not. Try the following patch on your sshd script. Then you also need to define the following in /etc/logwatch/conf/services/sshd.conf:
    $sshd_ip_lookup = No
    (Or use the value 0.) The value of sshd_ip_lookup is passed to the global DoLookup for the sshd script.

     

Log in to post a comment.