LINUXsecure_LOGO
Issues on Linux and Security
 
-->
 
 
 
 
 
 
 
home
button BRIDGING --> Bridge
 

Just under construction, version 0.2, first version 2004/04/30, last update 2004/05/03

Bridging, Transparent Firewalls and Intrusion Prevention

Contents
  1. What is Bridging?
  2. Installing a Bridge
  3. Configuring a Bridge
  4. What is a Bridging Firewall?
  5. Installing a Bridging Ebtables Firewall
  6. Configuring a Bridging Ebtables Firewall
  7. Installing a Bridging Iptables Firewall
  8. Configuring a Bridging Iptables Firewall
  9. What is an Intrusion Prevention System?
  10. Installing an Intrusion Prevention System
  11. Configuring an Intrusion Prevention System

What is Bridging?

A bridge is a network device, that connects two network segments of any network type (ethernet, token ring etc.) transparently to form one subnet. Transparency means, that you do not have to tell any component (computer, application etc.) that there is a new device between them. So, no configuration on them is needed. And your bridge is really stealthy, because it does not need any IP address.

You can easily build a bridge using a computer with at least two network interfaces. Here, in this section, I want to decribe howto setup a bridge using Linux (here wirth kernel 2.4.24), because based on the transparency characteristics of a bridge, you can build security enhancing network devices like bridging (transparent) firewalls and intrusion prevention systems.

Installing a Bridge

There are two things to do. First, you have to install the bridge-utils. Under gentoo you just type:

emerge bridge-utils

If your distribution is not shiped with bridge-utils, then you can download them from sourceforge. You can configure, compile and install bridge-utils the standard way.

The second thing to do is to prepare the kernel. Fortunately, you have to activate all drivers you need to run your box properly. In addition, you have to active (this depends on the development status of the kernel features):

  • Code maturity level options --> Prompt development and/or incomplete code/drivers
  • Networking options --> 802.1d Ethernet Bridging

Then simply recompile and install your new kernel. Reboot. If you are using modules, then load them!

Configuring a Bridge

Configuring a bridge a really straightforward. See table 1.

Table 1: Configuring the Bridge
$ ifconfig eth0 0.0.0.0 up
$ ifconfig eth1 0.0.0.0 up
$ brctl addbr br0
$ brctl addif br0 eth0
$ brctl addif br0 eth1
$ ifconfig br0 0.0.0.0 up

Now you have a network device, that forwards traffic between two network segments transparently. But what do the commands in table 1 do exactly? With the first two lines, you bring the two ethernet interfaces eth0 and eth1 up, without assigning an IP address to them. The 0.0.0.0 garantees, thet even if an IP address was assigned at startup, it will be overwritten. In the third line a new device, here a bridge, called br0 is created. Lines 4 and 5 add the two interfaces eth0 and eth1 to our bridge br0. In the last line, we bring our bridge br0 up. Again, we assign no IP address to it.

What is a Bridging Firewall?

A bridging firewall is also often called a transparent firewall and some benefits come with its' design:

  1. Zero configuration. From a networking standpoint, there are virtually no changes. How can this be? Easy, the bridging firewall is plugged in-line with the network it is protecting. This means you can put it between two routers, or a router and a switch. You could even put it in front of a single machine. While it might be placed exactly where it should be if it were acting as a gateway or router, it's not. Remember, it merely moves frames after inspecting them between interfaces. This means that there's no need to make any changes to your existing network. It is completely transparent. No subnetting headaches or configuration updates are required with this device.
  2. Performance. Because they are simpler devices, there's less processing overhead. This cost cutting either boosts the capabilities of the machines or allows for deeper examination of the data.
  3. Stealth. A key aspect of this device is the fact that it operates at layer 2 of the OSI model. This means the network interfaces have no IP addresses. Such a feature carries more weight than merely ease of configuration. Without an IP address, this device is unreachable and invisible to the outside world. If it cannot be reached, how can anyone attack it? No network probes, denial of service floods or firewalking on this machine. Your attackers won't even know it's in place, silently inspecting everything they send.

The are two possibilities to realize a bridging firewall: with ebtables or with iptables. In ebtables the focus is more on OSI layer 2-3, where in iptables it is more on ISO layer 3-4. Ebtables might be more suitable in scenarios, where the bridge connects two network segments within one subnet, where iptables might be more suitable where the bridge is placed before a router that connects the subnet to another net.

Installing a Bridging Ebtables Firewall?

First of all you need a bridge. Above I have decribed how to install and configure it. Secondly you have to install the ebtables packages. Under gentoo just do a

emerge ebtables

But keep in mind, that this package is masked. If this package is not shipped with your distribution, then download it from sourceforge. You can configure, compile and install ebtables the standard way. ebtables can be seen as a replacement for iptables. But it uses other tables within the kernel.

The next step is to enhance the kernel with the ebtables-brnf-patch (not necessary for kernel 2.6, because it is already in there). You can download it from sourceforge. Decompress it and the patch your kernel with the corresponding version of ebtables-brnf:

patch -p1 <patch_file

Within the kernel you have to activate:

  • Networking options --> Network packet filtering (replaces ipchains)
  • Networking options --> 802.1d Ethernet Bridging
  • Networking options --> 802.1d Ethernet Bridging --> Bridge: ebtables (NEW)
Then a list of options for ebtables pops up. you can select, for simplicity, all of them. Then simply recompile, and install your new kernel. Reboot. If you are using modules, then load them!

Configuring a Bridging Ebtables Firewall?

The bridge is now running and the kernel already prepared for configuring a firewall via ebtables. The best is always to have a real life example to show how it works. My example will be based on the following environment:

  1. There is a NAT-Router with the IP address 192.168.1.1 playin the role of a gateway all clients within the subnet 192.168.1.0/24 and connection them to the internet
  2. On the NAT-Router runs an DNS forwarder, so that he is the DNS server for all clients in the subnet.
  3. The subnet 192.168.1.0/24 is divided into two parts. The clients within the first part of the subnet are directly connected to the NAT router via a switch. The clients of the second part of the subnet are connected with the first part of the subnet via our new bridge.
  4. There is a client in the second part of the subnet with the IP address 192.168.1.52. This client wants to surf the WWW. So it has to pass the bridge and the NAT router.

Table 2: Configuring the Bridging Ebtables Firewall
$ ebtables -P FORWARD DROP
$ ebtables -A FORWARD -p 0x806 -j ACCEPT
$ ebtables -A FORWARD -p 0x800 --ip-dst 192.168.1.52 --ip-proto tcp --ip-sport 80 -j ACCEPT
$ ebtables -A FORWARD -p 0x800 --ip-src 192.168.1.52 --ip-proto tcp --ip-dport 80 -j ACCEPT
$ ebtables -A FORWARD -p 0x800 --ip-src 192.168.1.52 --ip-dst 192.168.1.1 --ip-proto udp --ip-dport 53 -j ACCEPT
$ ebtables -A FORWARD -p 0x800 --ip-src 192.168.1.1 --ip-dst 192.168.1.52 --ip-proto udp --ip-sport 53 -j ACCEPT

The syntax of ebtables is quite similar to the one of iptables.Because we are using briding, that has in our case a lot of similarities to routing, we have to configure only our FORWARD chain. In the first line we set our default policy to DROP, meaning, that all packages not matching any other rule, are dropped by default. The second line says, that our bridging firewall will let ARP packages pass. The parameter -p is used to specify a protocol in hex. 0x806 is ARP (Address Resolution Protocol). This is needed, because the clients within a subnet communicate based on layer 2 of the OSI model. And so they have to find the MAC addresses based on the IP addresses they know.

In the third and fourth line we grant the client 192.168.1.52 to do surf the WWW. -p 0x800 is the well known Internet Protocol (IP). --ip-dst and --ip-src give the destination and source IP respectively. --ip-proto specifies the IP protocol, here TCP. With --ip-dport and --ip-sport we specify the destination and sourceport, here port 80 (the standard port for http traffic).

The last two lines eneble the client 192.168.1.52 to do dns requests. The NAT router 192.168.1.1 serves as a DNS forwarder. In this case the source and destination addresses are well known. The IP protocol used is UDP and the port on the NAT router serving DNS is 53.

Configured this way, our bridging firewall will only let one client through and will enable him to surf in the WWW.

Installing a Bridging Iptables Firewall?

First of all you need a bridge. Above I have decribed how to install and configure it. Secondly you have to install the iptables packages. Under gentoo just do a

emerge iptables

The software is shiped with really every distribution. So you do not need to download it.

Within the kernel you have to activate at least the following options:

  • Networking options --> Network packet filtering (replaces ipchains)
  • Networking options --> IP: Netfilter Configuration --> Connection Tracking (required for masq/NAT)
  • Networking options --> IP: Netfilter Configuration --> IP tables support (required for filtering/masq/NAT)
  • Networking options --> IP: Netfilter Configuration --> Connection state match support
  • Networking options --> IP: Netfilter Configuration --> Connection tracking match support

Then simply recompile, and install your new kernel. Reboot. If you are using modules, then load them!

Configuring a Bridging Iptables Firewall?

Because iptables is well documented (and there is also a howto on linuxsecure) I will not go into detail here. I will only show a very small example here that uses connection tracking. The bridged iptables firewall will only let connections from client 192.168.1.52 out (willforward them) but no connections in. See table 3 for details.

Table 3: Configuring the Bridging Iptables Firewall
$ iptables -P FORWARD DROP
$ iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
$ iptables -A FORWARD -s 192.168.1.52 -m state --state NEW -j ACCEPT

The first line in table 3 configures the default policy. Any traffic, that is not matched by a rule is dropped. The next two lines tell iptables to let only packets in that belong to an existing connection or are related to it. As configured in line 3, new connections can only be established from client 192.168.1.52.

What is an Intrusion Prevention System?

I have already written a few lines about Intrusion Detection System (IDS) here One big point about flexible responses I have made there, is that despite the practicability of flexible responses, it is not fast/reliable enough. So If you want it, then you have to implement IDS with flexible response (or something similar) onto a router. A bridge is very similar to a router. It is a single entry or exit point to a network segment. So all traffic going in or out has to go through it. If you install an Intrusion Detection System on a bridge (or router) and if you configure it in a way, that it will not forward packages identified as containing an attack signature, then you have an Intrusion Prevention System (IPS).

Installing an Intrusion Prevention System

Here, I will show how to install an IPS on a bridge. Installing one on a router is quite the same. First, we have to set up the bridge, as shown above. Then we have to download snort_inline from sourceforge. Then just do

./configure --enable-inline
make
make install

Because snort_inline receives the network packages via iptables, we have to activate userspace queueing in the kernel:

  • Networking options --> Network packet filtering (replaces ipchains)
  • Networking options --> IP: Netfilter Configuration --> Userspace queueing via Netlink (EXPERIMENTAL) (NEW)

Then simply recompile, and install your new kernel. Reboot. If you are using modules, then load them!

Configuring an Intrusion Prevention System

The configuration of snort_inline is nearly the same as for snort, exept for the rule types. There are three new rule types, namely drop, reject, and sdrop:

  • The drop rule will tell iptables to drop the packet and log it via usual snort means.
  • The recet rule type will tell iptables to drop the packet, log it via usual snort means, and send a TCP reset if the protocol is TCP or an icmp port unreachable if the protocol is UDP.
  • The sdrop rule type will tell iptables to drop the packet. Nothing is logged.

Now we have to tell iptables to sent all packages going through the bridge to the table QUEUE, so that snort_inline can get them from there. This can be archived with the commands in table 4.

Table 4: Preparing Iptables for Snort_Inline
$ IPTABLES -P FORWARD DROP
$ IPTABLES -A FORWARD -j QUEUE

The first line is not really necessary. The second line configures netfilter to push all packages in the FORWARD chain in to the table QUEUE.

What we have to do now is to change some of the rules in a way, that network packages matching attack signatures are not only detected, but also droped, so that they will never arrive at the target host. For example, we can prohibit packages matching the ICMP PING NMAP signature by simply changing the rule

alert icmp $EXTERNAL_NET any -> $HOME_NET any (msg:"ICMP PING NMAP"; dsize: 0; itype: 8; reference:arachnids,162; classtype:attempted-recon; sid:469; rev:1;)

to

drop icmp $EXTERNAL_NET any -> $HOME_NET any (msg:"ICMP PING NMAP"; dsize: 0; itype: 8; reference:arachnids,162; classtype:attempted-recon; sid:469; rev:1;)

Within snort_inline the rule application order has changed, in order to get intrusion prevention functionality. The new rule application order is now:

->activation->dynamic->drop->sdrop->reject->alert->pass->log

To start snort in inline mode, we have to use the new switch Q, meaning, that snort will not receive packages by sniffing on the wire, but via iptables:

snort_inline -QDc /etc/snort_inline/snort.conf -l /var/log/snort_inline

where /var/log/snort_inline is the directory, where snort logs the alerts/drops.


back to top

button Whats New
[2005-02-18] mp3riot version 1.3 released
[2004-10-08] mp3riot version 1.2 is out.
[2004-04-30] Added section Bridging
[2004-01-09] working progress on mp3riot version 1.2
Michael Opdenacker has announced the availability of videosfrom this year's Embedded Linux Conference, which was held in San Francisco in April. The slides and Theora video are available for most, if not all, of the talks. Opdenacker and the Free Electrons team do the community a great service by doing the work to record and transcode the videos. "If you are interested in such talks, what about joining the European edition of the conference? It will take place in Cambridge (UK), on October 27-28, and will be colocated with the GStreamer conference (October 26). See http://www.embeddedlinuxconference.com/elc_europe10/and http://gstreamer.freedesktop.org/conference/for details."
Embedded Linux Conference videos available

Mandrivahas updated thunderbird(multiple vulnerabilities). Ubuntuhas updated wget(arbitrary code execution).
Thursday's security updates

Tiago Vignatti has put together a reporton the development X.org 1.9. In the tradition of the kernel statistics reported on LWN, and the more recent GNOME census, he ranks developers and employers based on the number of changes made to various pieces of the X.org tree during the development of 1.9 (April 2 to August 20). The statistics are broken up along functional lines into several categories: X implementation, X input drivers, user space video drivers, Pixman, X11 conformance testing, and X documentation. "Of course lines of code and changeset are far from being a good metric to see actually how the development happened. But still, it does represents something."
Vignatti: X Census (for 1.9)

The LWN.net Weekly Edition for September 2, 2010 is available.
[$] LWN.net Weekly Edition for September 2, 2010

On his blog, Harald Welte writesabout work he is doing as part of the gpl-violations.org project. "Right now I'm facing what I'd consider the most outrageous case that I've been involved so far: A manufacturer of Linux-based embedded devices (no, I will not name the company) really has the guts to go in front of court and sue another company for modifying the firmware on those devices. More specifically, the only modifications to program code are on the GPL licensed parts of the software. None of the proprietary userspace programs are touched! None of the proprietary programs are ever distributed either."If the manufacturer were to succeed with its claims, it could jeopardize many different projects that provide alternate code for devices, he says.
Welte: More GPL enforcement work again.. and a very surreal but important case

Issue 21 of the GNOME Journalis out; topics covered include simple real-time games, Grilo, and an interview with Bradley Kuhn.
GNOME Journal Issue 21 released

CentOShas updated C5: httpd(multiple vulnerabilities) and C5: kernel(privilege escalation). Debianhas updated wireshark(arbitrary code execution). Fedorahas updated socat(F13, F12: arbitrary code execution). Mandrivahas updated libgdiplus(arbitrary code execution), perl-libwww-perl(unexpected download filename), and openssl(denial of service). openSUSEhas updated acroread(multiple vulnerabilities). SUSEhas updated kernel(multiple vulnerabilities) and acroread(multiple vulnerabilities).
Security advisories for Wednesday

On her blog, Máirín Duffy describesfour archetypes of Fedora users (Caroline Casual-User, Pamela Packager, Connie Community, and Nancy Ninja) and how they relate to updates of the distribution. Fedora has been discussing its update policy for a bit and Duffy uses the user stories to present her thoughts on how to proceed. "Pamela wants updates to be constant throughout a release, no holds barred — she wants the latest Gimp and she wants it yesterday. Caroline just wants her computer to work — "please don't change a thing — it worked yesterday — if it breaks before my presentation I'm screwed!"Can both their needs be met? I think so! But it’s easy to completely miss where interests and needs can both be met when the language is so easily interpreted to mean the problem is untenable."
Duffy: A story about updates and people

[Andrew Morton and Linus Torvalds]Linus Torvalds rarely makes appearances at conferences, and it's even less common for him to get up in front of the crowd and speak. He made an exception for LinuxCon Brazil, though, where he and Andrew Morton appeared in a question and answer session led by Linux Foundation director Jim Zemlin. The resulting conversation covered many aspects of kernel development, its processes, and its history. Click below (subscribers only) for the full report from São Paulo.
[$] LinuxCon Brazil: Q&A with Linus and Andrew

The Debian Project has put up a brief noticeon the passing of longtime contributor Frans Pop. "Frans was involved in Debian as a maintainer of several packages, a supporter of the S/390 port, and one of the most involved members of the Debian Installer team. He was a Debian Listmaster, editor and release manager of the Installation Guide and the release notes, as well as a Dutch translator."
Debian Project mourns the loss of Frans Pop

The first release candidate for PostgreSQL 9.0 is available for testing. "No changes in commands, interfaces or APIs are expected between this release candidate and the final version. Applications which will deploy on 9.0 can and should test against 9.0rc1. Depending on bug reports, there may or may not be more release candidates before the final release."
PostgreSQL 9.0 Release Candidate 1

KDE has updated the Applications, Platform and Plasma Workspaces to 4.5.1. "This release will make 4.5 users life more pleasant by adding a number of important bugfixes, bringing more stability and better functionality to the Plasma Desktop, and many applications and utilities."
KDE SC 4.5.1 Released

Debianhas updated openssl(denial of service). Fedorahas updated bogofilter(F13, F12: denial of service) and php-pear-cas(F13, F12: multiple vulnerabilities). Mandrivahas updated libhx(arbitrary code execution). Ubuntuhas updated bogofilter(denial of service) and libwww-perl(unexpected download filename).
Tuesday's security updates

Many have criticized syslog-ng, a replacement for the syslog logging daemon with many additional features, for not being open enough. Syslog-ng has a closed-source commercial version and keeps the entire code base under a single copyright by requiring copyright transfer for contributions, which has been a sore spot in the eyes of many people. This may be part of the cause for syslog-ng failing to become the default system-logging daemon of modern Linux distributions. Now the project seeks to relieve these concerns and attract a wider contributor base with a new licensing model. Subscribers can click below for the full article from this week's Development page.
[$] A licensing change for syslog-ng

Over at ComputerWorld UK, Simon Phipps saysthere is nothing to celebrate in the recent announcement [PDF]that MPEG-LA will not charge royalties on "web uses"of the H.264 codec for the remaining life of the patents it administers. "First, the H.264-format video needs to be created - but that isn't free under this move. Then it needs to be served up for streaming - but that isn't free under this move. There then needs to be support for decoding it in your browser - but adding that isn't free under this move. Finally it needs to be displayed on your screen. [...] The only part of this sequence being left untaxed is the final one. Importantly, they are not offering to leave the addition of support for H.264 decoding in your browser untaxed. In particular, this means the Mozilla Foundation would have to pay to include the technology in Firefox."He also posits that MPEG-LA may try to join forces with Oracle and Paul Allen's Interval Research to create a three-way patent attack on Google—this time against WebM.
Hold The Celebrations; H.264 Is Not The Sort Of Free That Matters (ComputerWorld UK)

Adobe Flash Player and AIR (CVE-2010-2213) Multiple Unspecified Memory Corruption Vulnerabilities
Vuln: Adobe Flash Player and AIR (CVE-2010-2213) Multiple Unspecified Memory Corruption Vulnerabilities

Adobe Flash Player and AIR (CVE-2010-2216) Unspecified Memory Corruption Vulnerability
Vuln: Adobe Flash Player and AIR (CVE-2010-2216) Unspecified Memory Corruption Vulnerability

Adobe Flash Player and AIR (CVE-2010-2215) Unspecified Clickjacking Vulnerability
Vuln: Adobe Flash Player and AIR (CVE-2010-2215) Unspecified Clickjacking Vulnerability

Adobe Flash Player and AIR (CVE-2010-2214) Unspecified Memory Corruption Vulnerability
Vuln: Adobe Flash Player and AIR (CVE-2010-2214) Unspecified Memory Corruption Vulnerability

{PRL} Novell Netware OpenSSH Remote Stack Overflow
Bugtraq: {PRL} Novell Netware OpenSSH Remote Stack Overflow

Vulnerabilities in CMS WebManager-Pro
Bugtraq: Vulnerabilities in CMS WebManager-Pro

[ MDVSA-2010:169 ] mozilla-thunderbird
Bugtraq: [ MDVSA-2010:169 ] mozilla-thunderbird

[USN-982-1] Wget vulnerability
Bugtraq: [USN-982-1] Wget vulnerability

News, Infocus, Columns, Vulnerabilities, Bugtraq ...
More rss feeds from SecurityFocus

-->