LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 01-26-2010, 06:46 PM   #16
beadyallen
Member
 
Registered: Mar 2008
Location: UK
Distribution: Fedora, Gentoo
Posts: 209

Rep: Reputation: 36

Hi paddyjoesoap.
I've not used DD-WRT, but if you installed OpenWRT onto the router, vlan setup is very easy (I would guess that DD-WRT can be coaxed to do the same). You can easily configure as many as you want (one for each ethernet port on the WRT). The default setup is to make two, one for the internal LAN and one for WAN. The LAN vlan is the bridged with the wireless ethernet.

I commonly do exactly what you want, in that I specify one port as an 'admin' port when messing around with the firewall on such devices. It prevents you from getting locked out and having to reflash the device. e.g. I might have an internal network of 192.168.1.0/24 on ports 1,2 and 3, port 4 might be assigned an ip of 10.10.10.10 that I leave alone in any firewall configurations.

I would however point out that VLANS shouldn't really be used for security. Since the vlans are software based, it's potentially possible for an attacker to create specially crafted packets that will hop across the vlans (the vlan id is just an extra few bytes tagged onto a packet).

By all means set up the vlans, but you should bear in mind that your main security should be on the wireless. Using WPA2 and a good (20+ random characters) wireless password would mean it'd be easier for an attacker to break into the building to get physical access than try to hack the wireless.

Hope that helps.
 
Old 01-27-2010, 02:24 AM   #17
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
After looking at the diagram you should be able to set up some iptables rules on the vlan0 or directly on the br0 to firewall the inter LAN communication. Try the log rule I provided or something like this

Code:
iptables -I FORWARD -s br0 -j LOG --log-ip-options
iptables -I FORWARD -d br0 -j LOG --log-ip-options
I'll wait till the weekend and see how it goes.
 
Old 02-01-2010, 02:59 AM   #18
paddyjoesoap
LQ Newbie
 
Registered: Jan 2010
Posts: 14

Original Poster
Rep: Reputation: 0
Hi zhjim,

I didn't get a chance to deploy those firewall rules at the weekend.

I didn't find any central repository for the firewall rules to modify. I posted to the dd-wrt forum and didn't receive a constructive response.

The issue, I have is that, if I add those rules via the Administration-Console tab in the Web GUI I have no way to remove them later (I don't know there rule index etc).

It appears that DD-WRT hard codes the default rules with its C-code.

This has all sorts of complications as it means it becomes highly likely that my own rules will unintentionally restrict or relax the default dd-wrt rule-set. I am talking here about rule conflicts due to the inappropriate rule order/indexing.

I'll need to dig a little deeper into this issue next weekend, but just sticking my own rules before the default dd-wrt rule-set (as suggested in the dd-wrt forum) is not a good thing to do: http://www.mnlab.cs.depaul.edu/pubs/noms06-mining.pdf

I'll keep you posted on any developments.

Cheers,
Paddy.
 
Old 02-01-2010, 04:18 AM   #19
paddyjoesoap
LQ Newbie
 
Registered: Jan 2010
Posts: 14

Original Poster
Rep: Reputation: 0
Just came across Open-Wrt and it appears it allows you to add your own rules in a user defined script and also, but not recommended, the modification of the default rule-set.

http://wiki.openwrt.org/oldwiki/openwrtdocs/iptables

I may replace dd-wrt with open-wrt at the weekend and start playing around with this.

I'll post back as to the reconfigurability of open-wrt soon.

cheers,
Paddie.
 
Old 02-01-2010, 05:48 AM   #20
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
In my opinion we are at the step to see which chain the interlan packages take so we should be able to just insert our rule at the top and when done with following the way we would delete them.

Add rules
Code:
iptables -I FORWARD -i br0 -j LOG --log-ip-options
(Note the -I for Insertion. Without a number after the chain name it's put first in line)

Remove rules
Code:
iptables -D FORWARD 1
No sticky fingers no nothing

here two links from dd-wrt forum that at least prove to me that we are able to follow this thing like if it was on a normal linux system.

Enable syslog to get us the info
http://www.dd-wrt.com/wiki/index.php...ng_with_DD-WRT

Connect to router and log into shell
http://www.dd-wrt.com/wiki/index.php...e_Command_Line


The link you provided for openwrt seems to be easy to adopt ones own firewalls. And it's clearly explained. Go ahead

Cheers Zhjim
 
Old 02-10-2010, 09:34 AM   #21
paddyjoesoap
LQ Newbie
 
Registered: Jan 2010
Posts: 14

Original Poster
Rep: Reputation: 0
laptop = 192.168.2.145 and is connected to the DD-WRT by WiFi
printer = 192.168.2.108 and is connected to the DD-WRT by LAN-PORT

Code:
iptables -I FORWARD -i br0 -j LOG --log-ip-options
Will only capture packets that leave the WAN interface for the internet.
for example
Code:
Feb 10 15:17:29 tier2router user.warn kernel: IN=br0 OUT=vlan1 SRC=192.168.2.145 DST=87.248.210.254 LEN=52 TOS=0x00 PREC=0x00 TTL=63 ID=59937 DF PROTO=TCP SPT=45324 DPT=80 WINDOW=226 RES=0x00 ACK URGP=0 
Feb 10 15:17:29 tier2router user.warn kernel: IN=br0 OUT=vlan1 SRC=192.168.2.145 DST=87.248.210.254 LEN=52 TOS=0x00 PREC=0x00 TTL=63 ID=30735 DF PROTO=TCP SPT=45326 DPT=80 WINDOW=192 RES=0x00 ACK URGP=0
Tried the following. It records traffic in the opposite direction.
Code:
iptables -I FORWARD -i vlan1 -j LOG --log-ip-options
Code:
Feb 10 15:19:42 tier2router user.warn kernel: IN=vlan1 OUT=br0 SRC=87.248.210.254 DST=192.168.2.145 LEN=52 TOS=0x00 PREC=0x00 TTL=54 ID=53033 DF PROTO=TCP SPT=80 DPT=45521 WINDOW=12466 RES=0x00 ACK URGP=0
If I try and ping my printer, no logging occurs.

Tried also
Code:
iptables -I FORWARD -i vlan0 -j LOG --log-ip-options
Does not capture any logs from the Internet or from pinging the printer.

Code:
iptables -I FORWARD -i vlano -j LOG --log-ip-options
 
Old 02-22-2010, 10:11 AM   #22
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Sorry for the late reply but I had been ill the last two weeks

Anyway. I'd go without any -i or -o options just plain
Code:
iptables -I FORWARD -j LOG --log-prefix "forward: " --log-ip-options
Maybe extend this even further
Code:
iptables -I FORWARd -j LOG --log-prefix "forward: " --log-ip-options
iptables -I INPUT -j LOG --log-prefix "input: " --log-ip-options
iptables -t nat -I FORWARD -j LOG --log-prefix "nat in: " --log-ip-options
I once wrote a bit of a script to setup logging for each Chain inside each table.
Code:
#!/bin/bash
SSH=22
#SOURCE
BROAD=$(ip addr show dev eth0 | grep "inet " | awk '{print $4}')


function tables(){
OPTION=$1
        for i in $(cat /proc/net/ip_tables_names); do
                for x in $(iptables -L -v -t $i | grep 'Chain' | awk '{print $2}'); do
                        echo iptables -t $i -$OPTION $x -p icmp -j LOG --log-prefix="$i $x "
                done
        done
}

function start(){
        echo "setting up path"
        tables I
}
function stop(){
        echo "Deleting path"
        tables D
}

case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        *)
                echo "Usage $0 start | stop"
esac
It contains some minor faults to mislead the light ones
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables rules to NAT or FORWARD packets between LAN clients templeton Linux - Networking 5 11-28-2010 09:00 AM
[SOLVED] Iptables: LAN clients cannot access internet Sum1 Linux - Security 28 09-20-2009 11:42 PM
How to configure LAN (1 server and 10 clients)with Fedora 4 anthoniraj Linux - Networking 1 09-01-2006 11:38 PM
stopping ftp on certain internal clients with iptables dlm4444 Linux - Security 2 03-17-2004 02:33 AM
Port forward blocking internal lan clients dulaus Linux - Security 1 06-06-2003 06:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration