Le Jeudi 9 Février 2006 22:57, Eric Cooper a écrit :
> On Fri, Feb 10, 2006 at 02:17:13AM +0900, Romain Lenglet wrote:
> > approx runs as a standalone demon, but does not allow to
> > either filter connections according to /etc/hosts.allow and
> > /etc/hosts.deny files, nor to bind to a specific address.
> >
> > Filtering according to hosts_access(5) files should be
> > relatively easy, by using the TCP wrapper library (package
> > libwrap0). Alternatively, making approx a passive program
> > executed by tcpd (inetd) or making it able to bind on one or
> > more explicitly specified interfaces would make it better
> > from a security viewpoint.
>
> Thanks, these are good suggestions.  I'll look into this for
> the next version.  Do you have any advice on which approach is
> better (more flexible for alternate inetd schemes, or more
> secure, or other criteria)?

From the least to the most performant:
- start through inetd: inetd parses /etc/hosts.*, and starts a 
process for every connection, which is very unefficient
- use libwrap: like inetd, parse /etc/hosts.* for every 
established connection
- bind to specific addresses: attempted connections to unwanted 
addresses are refused at the kernel level

From the least to the most flexible:
- bind to specific addresses: it does filter connection according 
only to the destination address, and is useful only if the 
system has several IP addresses and only a subset of those 
addresses should accept connections
- inetd and libwrap: filtering according to source address, 
service, client user, etc.

Impact on design (from low impact to high impact):
- start through inetd: you would have to move from a standalone 
daemon design to a one-process-per-connection design (that's 
bad)
- bind to specific addresses: you would have to add a 
configuration parameter to specify the interface(s) to bind to
- use libwrap: you would only have to add a few library calls in 
your code


So, what I suggest you is to first add calls to libwrap in your 
code just after every connection is established. It is quite 
easy to do: just add a call to hosts_ctl(...) after every 
accept(...).
However, I have no clue on how to do that in Ocaml.

Then, if you have time ;), add a parameter to the format of 
approx.conf to specify the address to bind to, and use that 
parameter as the parameter to bind(...).

-- 
Romain LENGLET
Pr. Chiba Shigeru Group
Dept. of Mathematical and Computing Sciences
Tokyo Institute of Technology

Reply via email to