Exemple #1
0
 def setAttributes(self, attr, is_modify):
     Rule.setAttributes(self, attr, is_modify)
     if self.type != NAT_TRANSLATE:
         self.nated_sources.clear()
         self.nated_destinations.clear()
         self.nated_filters.clear()
         if self.type == NAT_PREROUTING_ACCEPT:
             self.chain = u'PREROUTING'
         else: # type == NAT_POSTROUTING_ACCEPT
             self.chain = u'POSTROUTING'
     else:
         if len(self.nated_sources) != 0:
             self.chain = u'POSTROUTING'
         else:
             self.chain = u'PREROUTING'
Exemple #2
0
    def setAttributes(self, attr, is_modify):
        Rule.setAttributes(self, attr, is_modify)

        if not self.user_groups:
            self.applications.clear()
            self.periodicities.clear()
            self.durations.clear()
            self.operating_systems.clear()

        self.input = getIface(self.sources, self.source_platforms)
        self.output = getIface(self.destinations, self.destination_platforms)

        if isinstance(self.input, FirewallResource):
            self.chain = u'OUTPUT'
        elif isinstance(self.output, FirewallResource):
            self.chain = u'INPUT'
        else:
            self.chain = u'FORWARD'
        self.address_type = self.ADDRESS_TYPE
        if not self.log:
            self.log_prefix = None