LinuxQuestions.org
Review your favorite Linux distribution.
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 04-01-2009, 04:43 AM   #1
Winanjaya
Member
 
Registered: Sep 2003
Posts: 209

Rep: Reputation: 32
Question how to reject connections which come from unknown mac address?


Dear All,

I have a file (list_macs) that contains list of mac addresses, how to reject connections which come from unknown mac address?

please help

thanks & regards
Winanjaya
 
Old 04-01-2009, 04:56 AM   #2
datopdog
Member
 
Registered: Feb 2008
Location: JHB South Africa
Distribution: Centos, Kubuntu, Cross LFS, OpenSolaris
Posts: 806

Rep: Reputation: 41
use iptables for that.
 
Old 04-01-2009, 05:07 AM   #3
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Assuming that list_macs contains one MAC address per line (and nothing else), here's an example:
Code:
MAC_LIST=`cat /etc/list_macs`
for i in $MAC_LIST; do
  iptables -A INPUT -i eth0 -m mac --mac-source $i -j ACCEPT
done
iptables -A INPUT -i eth0 -j REJECT
Keep in mind MACs only work inside Ethernet LANs.
 
Old 04-01-2009, 08:57 PM   #4
Winanjaya
Member
 
Registered: Sep 2003
Posts: 209

Original Poster
Rep: Reputation: 32
Hi..
but how to store it into /etc/sysconfig/iptables ?

please advise

thanks & regards
Winanjaya
 
Old 04-02-2009, 05:48 AM   #5
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Quote:
Originally Posted by Winanjaya View Post
but how to store it into /etc/sysconfig/iptables ?
If you're on a Red Hat-based distro, use:
Code:
service iptables save
Otherwise, use:
Code:
iptables-save > /etc/sysconfig/iptables
 
Old 04-05-2009, 01:46 AM   #6
Winanjaya
Member
 
Registered: Sep 2003
Posts: 209

Original Poster
Rep: Reputation: 32
Can I use "deny unknown-clients" options in /etc/dhcpd.conf for this? .. I meant I don;t want my dhcp server give IP to unknown clients


deny unknown-clients;
option domain-name-servers 172.16.1.3;
default-lease-time 600;
max-lease-time 7200;

...
...
...

host appio-wireless {
hardware ethernet 00:90:4B:6D:97:59 ;
}
host appio-wired {
hardware ethernet 00:90:3D:93:AD:3E ;
}


please help

thanks & regards
Winanjaya
 
Old 04-05-2009, 09:40 AM   #7
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
If you're using ISC DHCP, iptables wouldn't work anyways since ISC DHCP uses a RAW socket. At least, that's how it worked last time I used ISC DHCP. Someone please correct me if things have changed. And yes, it's very common to specify in dhcpd.conf the MACs you wish to provide service to. Keep in mind that MACs are easily sniffed/spoofed, though.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Sendmail 550 5.1.1 Reject Unknown User Nullivex Linux - Server 3 01-29-2009 01:56 AM
Asking for an unknown IP address from a known MAC address jf.argentino Linux - Networking 6 06-01-2008 07:23 AM
Apache won't accept or reject incoming internet connections but accepts on local lan zenchess Linux - Networking 3 06-10-2006 09:06 AM
reject certain mac-adresses ekkins Linux - Networking 1 06-19-2005 06:14 PM
how to get ip address, broadcast address, mac address of a machine sumeshstar Programming 2 03-12-2005 04:33 AM


All times are GMT -5. The time now is 09:43 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration