The fading out of tcpwrappers and its idea

April 27, 2015

Once upon a time, tcpwrappers were a big thing in (Unix) host security. Plenty of programs supported the original TCP Wrapper library by Wietse Venema, and people wrote their own takes on the idea. But nowadays, tcpwrappers is clearly on the way out. It doesn't seem to be used very much any more in practice, fewer and fewer programs support it at all, and of the remaining ones that (still) do, some of them are removing support for it. This isn't exclusive to Wietse Venema's original version; the whole idea and approach just doesn't seem to be all that popular any more. So what happened?

I don't know for sure, but I think the simple answer is 'firewalls and operating system level packet filtering'. The core idea of tcpwrappers is application level IP access filtering, and it dates from an era where that was your only real choice. Very few things had support for packet filtering, so you had to do this in the applications (and in general updating applications is easier than updating operating systems). These days we have robust and well developed packet filtering in kernels and in firewalls, which takes care of much of the need for tcpwrappers stuff. In many cases, maintaining packet filtering rules may be easier than maintaining tcpwrappers rules, and kernel packet filtering has the advantage that it's centralized and so universally 'supported' by programs; in fact programs don't have any choice about it.

(Kernel packet filters can't do DNS lookups the way that tcpwrappers can, but using DNS lookups for anything except logging has fallen out of favour these days. Often people don't even want to do it for logging.)

Having written some code that used libwrap, I think that another issue is that the general sort of API that Venema's tcpwrappers has is one that's fallen out of favour. Even using the library, what you get is basically a single threaded black box. This works sort of okay if you're forking for each new connection, but it doesn't expose a lot of controls or a lot of information and it's going to completely fall down if you want to do more sophisticated things (or control the DNS lookups it does). Basically Venema's tcpwrappers works best for things that you could at least conceive of running out of inetd.

(It's not impossible to create an API that offers more control, but then you wind up with something that is more complex as well. And once you get more complex, what programs want out of connection matching becomes much more program-specific; consider sshd's 'Match' stuff as contrasted with Apache's access controls.)

Another way of putting it is that in the modern world, we've come to see IP-level access control as something that should be handled outside the program entirely or that's deeply integrated with the program (or both). Neither really fits the tcpwrappers model, which is more 'sitting lightly on top of the program'.

(Certainly part of the decline of tcpwrappers is that in many environments we've moved IP access controls completely off end hosts and on to separate firewalls, for better or worse.)


Comments on this page:

By Ewen McNeill at 2015-04-27 06:37:39:

Another aspect is that one of the few non-firewall-like things that tcpwrappers did (verify forward/reverse DNS matched) these days has too high a false positive rate, because there's much less attention given to matching DNS entries (and/or any reverse DNS at all). And that's even aside from the "do you want to wait on DNS answers at all" issue.

That said, I think you're right that nearly ubiquitous host firewalls and "appliance" firewalls have largely replaced tcpwrappers and the like, and the few applications where more control is useful (eg, ssh) have grown their own more complex checks (eg, ssh has user/IP pair checks) -- which I assume is why ssh finally removed support for the older/less-sophisticated partial solution. The move away from inetd-style service provision also discourages tcpwrappers-like check layers being slotted in. Those "add on" security things that do still seem useful mostly work in parallel (eg, fail2ban-style systems), rather than being layered in.

Ewen

Written on 27 April 2015.
« My complicated feelings on abandoning old but good code
There's no portable way to turn a file descriptor read only or write only »

Page tools: View Source, View Normal, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Mon Apr 27 03:03:53 2015
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.