Skip to contentSkip to conversation

Ebtables ruleset isn't working, any ideas?

DISCUSSION Miguel Ghobangieno 3 participants 4 messages May 19, 2009

lore
Share & tools
lore
#0 lore raw

I'm trying to make a bridge firewall that allows ssh in, and allows http/https out, but nothing else... ebtable ruleset isn't working Sad

This is what I have so far. When I set the default policy to allow everything gets through, when deny nothing gets through:

Here is the net setup: squid/sshserver --> eth1 [firewall] eth0 ---> Internet

What is supposed to be allowed:
ssh server (port 22 TCP) <--eth1 [firewall] eth0 <--- Internet ssh/squidserver --> eth1 [firewall] eth0 --> Internet (ports 80 and 443 TCP)

What is supposed to be disallowed
(spoofed ip w/o proper squidserver mac address going out) (anything else coming in)
(probably anything else going out aswell (maybe allow dns, dhcp)

This blocks EVERYTHING. It COMPLETELY IGNORES THE RULESET :( :( (The only thing it doesn't ignore is the policy)

[code]
ebtables -F FORWARD
ebtables -P FORWARD DROP
ebtables -A FORWARD -p ip --ip-proto icmp -j DROP ## block all ICMP

ebtables -A FORWARD -i eth0 -o eth1 -p ip --ip-proto tcp --ip-destination-port 22 --ip-destination 192.168.0.21 -j ACCEPT ebtables -A FORWARD -i eth1 -o eth0 -p ip --ip-proto tcp --ip-source-port 22 --ip-source 192.168.0.21 -j ACCEPT

ebtables -A FORWARD -p ip --ip-src 192.168.0.21 -s ! 00:08:0D:54:13:C9 -j DROP
ebtables -A FORWARD -i eth0 -o eth1 -p ip --ip-destination 192.168.0.21 --ip-proto tcp --ip-source-port 80 -j ACCEPT ebtables -A FORWARD -i eth1 -o eth0 -p ip --ip-source 192.168.0.21 --ip-proto tcp --ip-destination-port 80 -j ACCEPT ebtables -A FORWARD -i eth0 -o eth1 -p ip --ip-destination 192.168.0.21 --ip-proto tcp --ip-source-port 443 -j ACCEPT ebtables -A FORWARD -i eth1 -o eth0 -p ip --ip-source 192.168.0.21 --ip-proto tcp --ip-destination-port 443 -j ACCEPT [/code]

Why doesn't this work? Isn't it supposed to consider the exception rules?
(I'm testing by trying to SSH to the box, and trying to go to the IP of a webserver across the bridge from the box)

#1 lore raw
Quoted 5 lines · Miguel Ghobangieno

I'm trying to make a bridge firewall that allows ssh in, and allows http/https out, but nothing else... ebtable ruleset isn't working Sad

This is what I have so far. When I set the default policy to allow everything gets through, when deny nothing gets through:

[...]

Why don't you add log watchers to every of your rules as the last "match"? Thus you could see at least which rules match. Your rules seem to be OK but with logging enabled that'd be definitely answered. Without more information, nobody could help you.

[And don't spam mailing lists like openssl-users which has nothing to do with ebtables, even if you are desperate.]

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary
#2 lore raw

Hmmm... His rules won't match as the packets are dropped due to the default policy of the chain.

Just add at the end of your rules a log target for all who passed the "ACCEPT" rules.

Do you have nat employed on your firewall? (because you have 192.* IP addresses)

On Tue May 19 2009 wrote Jozsef Kadlecsik:

Quoted 23 lines · Miguel Ghobangieno
Quoted 5 lines

I'm trying to make a bridge firewall that allows ssh in, and allows http/https out, but nothing else... ebtable ruleset isn't working Sad

This is what I have so far. When I set the default policy to allow everything gets through, when deny nothing gets through:

[...]

Why don't you add log watchers to every of your rules as the last "match"? Thus you could see at least which rules match. Your rules seem to be OK but with logging enabled that'd be definitely answered. Without more information, nobody could help you.

[And don't spam mailing lists like openssl-users which has nothing to do with ebtables, even if you are desperate.]

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

Quoted 5 lines
          H-1525 Budapest 114, POB. 49, Hungary

--
To unsubscribe from this list: send the line "unsubscribe netfilter" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Christoph Paasch

École Polytechnique de Louvain
Département d'ingénierie informatique

www.rollerbulls.be
--

#3 lore raw
Quoted 2 lines · Christoph Paasch

Hmmm... His rules won't match as the packets are dropped due to the default policy of the chain.

The default policy will be used if no rule matches. The question is, do any of the rules match?

Quoted 2 lines

Just add at the end of your rules a log target for all who passed the "ACCEPT" rules.

There's no log target in ebtables. But there's a log "watcher" which is like an always true matching with logging as side effect. That should be added to the rules.

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary