Opened 11 years ago

Last modified 5 years ago

#76 new defect

innd doesn't honor DNS TTLs

Reported by: eagle Owned by: eagle
Priority: low Milestone: 2.7.0
Component: innd Version:
Severity: normal Keywords: compliance
Cc:

Description

A long-standing problem with innd is that it stores the DNS lookup results for everything in incoming.conf when it starts up and then never rechecks DNS. Most sites periodically reload incoming.conf to work around this, but it still breaks the DNS requirement to honor TTL.

Unfortunately, there's no way to do asynchronous DNS lookups using the getaddrinfo() interface, which is required to support /etc/hosts and other non-DNS sources of IP information, and we can't do the blocking calls since they can block for a long time.

That leaves, as a solution, doing DNS resolution in a child process and then asynchronously filling in the results. This will require putting incoming connections to sleep until the DNS resolution finishes, and then waking them up to do permission checking.

Change History (3)

comment:1 Changed 11 years ago by Julien ÉLIE

Keywords: compliance added

RFC 3977 says:

If NNTP clients or servers cache the results of host name lookups in order to achieve a performance improvement, they MUST observe the TTL information reported by DNS.

innd caches DNS lookups when reading incoming.conf and doesn't refresh its knowledge of DNS except when incoming.conf is reloaded.

Impact: An explicit reload is required whenever the IP address of any peer changes, and in the presence of network renumbering innd is vulnerable to spoofing if DNS is the only authentication mechanism used.

Suggested fix: This is hard to fix without unacceptable performance impact. The only good fix is to either fork a separate helper process to do DNS lookups (since gethostbyname may block for essentially an arbitrarily long period) or to use the direct resolver library so that one
can get access to a file descriptor and throw it into the select loop. Either way, this requires keeping a DNS file descriptor in the main select loop and updating knowledge of DNS periodically, which is a substantial amount of additional complexity.

comment:2 Changed 8 years ago by Julien ÉLIE

Milestone: 2.6.0

Using libevent would allow asynchronous DNS queries.

comment:3 Changed 5 years ago by Julien ÉLIE

Milestone: 2.6.02.7.0
Note: See TracTickets for help on using tickets.