1. Subscriptions
  2. Services
  3. Hardware
  4. Support

ClearFoundation

Forums
Welcome, Guest
firewall.lua and mac-address filtering
(1 viewing) 1 Guest
Go to bottomPage: 1
TOPIC: firewall.lua and mac-address filtering
#7167
firewall.lua and mac-address filtering 1 Year, 11 Months ago  
My ClearOs 5.1 is acting as a wireless access point. Therefore I also enabled mac address filtering in /etc/firewall (0x12000200 rules). All worked to my satisfaction, until yesterday.

My wireless clients did not receive an ip-address anymore.

I remembered having had this problem in the passed. What I then found (and redid again), was that /etc/rc.d/firewall.lua installs the iptables rules. More precise, function RunIncomingDenied in this file adds the mac-filtering to the nat prerouting table. This function contains a loop, iterating over all rules and adding them to iptables if the rule is a mac-filtering rule.

The fragment below is from function RunIncomingDenied in file /etc/rc.d/firewall.lua:
Code:


        for _, rule in RULES do
            r_type, r_proto, r_addr, r_port, r_param = ExpandRule(rule)

            if b_and(r_type, tonumber(os.getenv("FWR_ENABLED"))) ~= 0 and
                b_and(r_type, tonumber(os.getenv("FWR_MAC_FILTER"))) ~= 0 and
                b_and(r_type, tonumber(os.getenv("FWR_WIFI"))) ~= 0 and
                b_and(r_type, tonumber(os.getenv("FWR_CUSTOM"))) == 0 then

                mac_filter = "yes"

                echo("Adding wireless MAC filtering for: " .. WIFIF)
                iptables("nat",
                    string.format("-A PREROUTING -i %s -m mac --mac-source %s -j %s",
                    WIFIF, r_addr, FW_ACCEPT))
            end
-- AKo
        end
-- AKo
            if mac_filter ~= nil then
                iptables("nat", "-A PREROUTING -i " .. WIFIF .. " -j " .. FW_DROP)
            end
-- AKo  end
    end



However, also inside the loop is a statement to add a drop rule. The end effect is only the first mac-address being accepted, all others are below the added drop statement. When I make the modification indicated with the "-- AKo" lines, I get a correct iptables "nat" PREROUTING.

Can somebody please tell me if this change is necessary, or what I did wrong in setting up my mac-address filtering rules?

Thanks in advance,
albert
albert
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#7202
Re:firewall.lua and mac-address filtering 1 Year, 11 Months ago  
hi,
i am very intersted in ur mac filter.could u tell me how to config it?i am dying to know that!
Lingfeng Xiong
Junior Boarder
Posts: 27
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#7206
Re:firewall.lua and mac-address filtering 1 Year, 11 Months ago  
Hi Lingfeng,

Mac address filtering was in the previous versions of ClarkConnect available via a special module in the web interface ( https : // server:81 ). I could not find that module any more. But though this part disappeared in the web interface, the functionality is still present.

The top of the file defines WIFIF as your wireless network. As far as I found out, mac address filtering is only done on the wireless network. Setting this variable is best done over the web interface, where you define your networks.

File /etc/firewall contains all RULES for your firewall. The part for the RULES contains a comment above it which gives you further information.

When you add a rule like:

Code:


   <name>||0x12000200|0|<mac-address>|| \



to this rule-set, you install mac-address filtering on the WIFIF. In this rule is:

<name> a name for this rule, so eg "laptop" or "iPAQ" or something
<mac-address> is the mac adress in format ff:ff:ff:ff:ff:ff

Regards,
albert
albert
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#7217
Re:firewall.lua and mac-address filtering 1 Year, 11 Months ago  
hi albert,
thx very much!!!!!

Regards,
Lingfeng Xiong
Lingfeng Xiong
Junior Boarder
Posts: 27
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1
  get the latest posts directly to your desktop