• Mike Hibler's avatar
    Firewall support part III: client scripts. · b21e6942
    Mike Hibler authored
    Overview of simply firewall setup.
    Experimentor specifies in their ns file:
         set fw [new Firewall $ns]
         $fw style <open|closed|basic>
    to set up an "open" ("allow any"), "closed" ("deny any"), or "basic"
    (allow ICMP and ssh) firewall.  "basic is the default.  Additional rules
    can be added with:
         $fw add-rule <IPFW format rule>
         $fw add-numbered-rule <1-50000> <IPFW format rule>
    where the former implicitly numbers rules such that the firewall processes
    them in the order given in the NS file.  The latter allows explicit
    specification of the numbering.  Currently the rules are fixed strings,
    there is no variable substitution.  There is also no syntax checking done
    on the rules at parse time.
    We allocate an extra node to the experiment to serve as a firewall.
    Currently that node runs FreeBSD and uses IPFW.  In the initial configuration,
    all other nodes in the experiment will just be setup with a default route
    that points to the firewall node.  So all outbound traffic will pass through
    it.  Inbound traffic will still travel straight to the node.  This should
    prevent nodes from accidentally initiating attacks on the outside world.
    Long term we will of course enforce the firewall on all traffic, that should
    not have any effect on the NS syntax above.
    When a node boots, there will be an rc.firewall script that checks to see
    if there is a firewall for the experiment and if so, which node it is.
    This is done with the TMCD "firewallinfo" command which returns:
          TYPE=remote FWIP=N.N.N.N
          TYPE=<fwtype> STYLE=<fwstyle> IN_IF=<macaddr> OUT_IF=<macaddr>
          RULENO=<num> RULE="<ipfw command string>"
    In the case of no firewall we get back TYPE=none, and we continue as normal.
    Otherwise, there are two types of replies, one for a node that is being
    firewalled (TYPE=remote) and one for a node that is a firewall
    (TYPE=<fwtype> + RULES).
    In the TYPE=remote case, the firewall node indicated by FWIP.  This is
    the address we use for the default route.
    For TYPE=<fwtype>, we are the firewall, and we get STYLE and IN_IF/OUT_IF
    info.  Here TYPE indicates whether we should use ipfw or whatever.
    For now it is always ipfw.  IN_IF and OUT_IF may someday indicate the
    interfaces to use for the internal and external connections, right now
    both will indicate the control net interface.  So, after ensuring that
    the ipfw modules is loaded, we grab the provided RULE info, which includes
    both per-experiment and default rules, and setup ipfw.
    Issues to resolve:
           - synchronization: how to ensure firewall comes up first
           - how to better implement the firewalling
             (i.e., without the cooperation of the nodes)
           - support the equiv of linkdelays (on-node firewalling)?
           - allow firewalls within experiments?
             (ie., on experimental interfaces)
           - dynamic changing of firewall rules via events?
           - how to show firewall state in various web pages
libsetup.pm 31.7 KB