Re: per-interface packet filters

From: Andre Oppermann (andre_at_freebsd.org)
Date: 12/15/04

  • Next message: Andre Oppermann: "Re: per-interface packet filters, design approach"
    Date: Wed, 15 Dec 2004 13:53:50 +0100
    To: Gleb Smirnoff <glebius@freebsd.org>
    
    

    Gleb Smirnoff wrote:
    >
    > On Wed, Dec 15, 2004 at 11:50:55AM +0100, Andre Oppermann wrote:
    > A> First you change the way pfil_hooks is used in a multiprotocol incompatible
    > A> way. Lets have a look at ip_input():
    > A>
    > A> pfil_run_hooks(&inet_pfil_hook, &m, m->m_pkthdr.rcvif, PFIL_IN, NULL);
    > A> ^^^^^^^^^^^^^^
    > A>
    > A> PFIL_HOOKS is a generic API with clear semantics. You can't just replace
    > A> this inet_pfil_hook with an interface specific one. That would be INET
    > A> only and you'd have to do the same for IPv6, IPX and whatever other protocols
    > A> may come.
    > A>
    > A> Secondly the stuct ifnet would have to be extended with a pfil_head pointer
    > A> for every protocol family in the system. This would be non-dynamic and
    > A> would require a recompile of all drivers etc. when a protocol is added or
    > A> removed. Struct ifnet is not a dynamic structure.
    >
    > Yes, it needs to be extended. An alternative is handling a table of
    > interfaces vs chains inside firewalls. We are speaking a lot of design,
    > which of above designs is better? Is it going to be easy to edit all these

    Handling it inside firewalls is the correct design.

    > tables when an interface is destroyed? No. Would it be possible to know

    Yes, you can subscribe to the routing socket where such information of
    interface arrivals, departures and changes are announced. The same way
    routing daemons get their information. Maybe this can be extended to
    provide a generic call-back handler interface to avoid duplication of
    the parsing code for each firewall.

    > which chains/filters are used on interface via ifconfig? No. Would it be

    Which chains/filters are used on an interface is firewall package specific
    anyway. IPFW, PF and IPF have different semantics and syntax for this.
    With Sam's recent modularization changes to ifconfig it would be possible
    to have a module doing that via ifconfig for each of these.

    > possible to avoid entering firewall functions when processing interfaces
    > without ACLs? No.

    It would go into the pfil_hook chain and the firewall code would just issue
    a return (0). One function call. Please remember that there can be other
    things besides firewalls residing in a PFIL_HOOKS chain. You can implement
    IPSEC via a pfil hook module. These may want to run independently of your
    firewall passing all traffic.

    > So, we are changing design in strange direction, because we don't want
    > struct ifnet to grow?

    No, I'm *designing* kernel functionality compared to bolt-on hacking it.

    > In Juniper|Cisco world, the fact that ACLs are attached in configuration
    > of interfaces, but not firewalls, gives a strong suspection that they have
    > it in their analog of struct ifnet.

    So what? Are we Cisco or Juniper? Do you jump out of the window on 13th
    floor if your pop idol does? No, you think first.

    I'm not saying what Cisco|Juniper do is bad, but neither am I saying
    it's the one and only truth in networking. There may be better or more
    clever approaches. Much of what they do is based on legacy requirements
    especially on Cisco. We have to look at the high-level goal first, not
    the specific implementation of someone else.

    > A> Thirdly have the modules that are hooked into the pfil_hooks no idea that
    > A> they have to register multiple times with multiple chains and so on. This
    > A> means that all firewall packages in FreeBSD need to be adjusted to deal
    > A> with these changes, often in a non-trivial way, to continue to function.
    >
    > I'd like to avoid autohooking here. I'd prefer to have a userland utility
    > which allows sysadmin to hook chain X from packet filter Y to interface
    > fxp0 direction IN, protocol IPv4.

    This is firewall package specific anyway.

    > Now we have autohooking to preserve compatibility with pre-pfil firewalls.
    >
    > A> And we lose the compatibility with NetBSD where the PFIL_HOOKS API comes
    > A> from.
    >
    > Why? We just have more places where filters can be hooked.

    No. Modules using PFIL_HOOKS would have to be written especially for
    FreeBSD to deal with your new behaviour. You can't just take a module
    written for NetBSD and compile it on FreeBSD and vice versa. The goal
    of the common PFIL_HOOKS API was to make especially that possible.

    > A> I hope you understand now that you change the PFIL_HOOKS API not in the
    > A> binary or structure way but in use and semantics.
    >
    > Yes. Let's call it smth different to word API.

    No.

    > A> So please put the PFIL_HOOKS discussion to a rest now as it simply won't
    > A> happen. There are perfect alternatives to change IPFW to fit your needs
    > A> within IPFW itself and with the information supplied by the PFIL_HOOKS API.
    >
    > Ok, "simply won't happen", is the words I was awaiting for.

    Good. PFIL_HOOKS case closed now?

    -- 
    Andre
    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
    

  • Next message: Andre Oppermann: "Re: per-interface packet filters, design approach"

    Relevant Pages

    • Re: ftp problem
      ... > here is my whole firewall script ... > # No restrictions on Loopback Interface ... > # or from this gateway server destine for the public Internet. ... > # Allow out secure FTP, Telnet, and SCP ...
      (freebsd-questions)
    • Re: Checkpoint experiences
      ... decide they want the firewall used by the big boys...often repeated, ... The Nokia appliance IPSO, is useful if you don't want to take the ... It is no wonder that the Nokia interface is called ... > billions on training, and classes, consultants, support contracts, etc. ...
      (comp.security.firewalls)
    • Re: Lets talk about firewalls - what do we as a group think a firewall should be/have?
      ... part of the same network as the LAN. ... Each interface of a firewall should be distinct from ... interfaces, so a "DMZ interface" is not a requirement. ...
      (comp.security.firewalls)
    • Proxy ARP and Routing
      ... some CPE from our ISP connected to a firewall. ... the public IPs on the physical DMZ network. ... packets to the host on the DMZ? ... on the DMZ interface. ...
      (SunManagers)
    • RE: [fw-wiz] Dynamic routing on a firewall
      ... is on this interface", rather than having to work it out manually each time. ... Obviously, if the firewall is using dynamic routing, there would be no ... >> party is in their own DMZ. ...
      (Firewall-Wizards)