All of lore.kernel.org
 help / color / mirror / Atom feed
* Dabase BAcked IPTables
@ 2013-06-28 15:01 Nick Khamis
  2013-06-28 15:12 ` Ricardo Klein
  2013-06-28 23:19 ` /dev/rob0
  0 siblings, 2 replies; 15+ messages in thread
From: Nick Khamis @ 2013-06-28 15:01 UTC (permalink / raw)
  To: netfilter

Hello Everyone,

Is it possible to have a MySQL backed IPTables? What we are trying to
accomplish is having our clients supply us with a mac address (or ip),
and we would let them through our core network. This would be done
automatically on our website i.e.:

* User logs into the website, and provides mac address
* We insert the record in the database as an allow rule...
* Restart iptables?

Kind Regards,

Nick.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Dabase BAcked IPTables
  2013-06-28 15:01 Dabase BAcked IPTables Nick Khamis
@ 2013-06-28 15:12 ` Ricardo Klein
  2013-06-29 18:19   ` Jozsef Kadlecsik
  2013-06-28 23:19 ` /dev/rob0
  1 sibling, 1 reply; 15+ messages in thread
From: Ricardo Klein @ 2013-06-28 15:12 UTC (permalink / raw)
  To: Nick Khamis; +Cc: netfilter

I think someone is already working in a ipset module for that.
We need that here too...


--
Att...

Ricardo Felipe Klein
klein.rfk@gmail.com


On Fri, Jun 28, 2013 at 12:01 PM, Nick Khamis <symack@gmail.com> wrote:
> Hello Everyone,
>
> Is it possible to have a MySQL backed IPTables? What we are trying to
> accomplish is having our clients supply us with a mac address (or ip),
> and we would let them through our core network. This would be done
> automatically on our website i.e.:
>
> * User logs into the website, and provides mac address
> * We insert the record in the database as an allow rule...
> * Restart iptables?
>
> Kind Regards,
>
> Nick.
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Dabase BAcked IPTables
  2013-06-28 15:01 Dabase BAcked IPTables Nick Khamis
  2013-06-28 15:12 ` Ricardo Klein
@ 2013-06-28 23:19 ` /dev/rob0
  2013-06-29  0:00   ` Ricardo Klein
  2013-06-29  0:05   ` Nick Khamis
  1 sibling, 2 replies; 15+ messages in thread
From: /dev/rob0 @ 2013-06-28 23:19 UTC (permalink / raw)
  To: netfilter

On Fri, Jun 28, 2013 at 11:01:10AM -0400, Nick Khamis wrote:
> Is it possible to have a MySQL backed IPTables?

No, network packets need to be handled in real time. Your SQL query 
would take too long.

> What we are trying to accomplish is having our clients supply us 
> with a mac address (or ip), and we would let them through our core 
> network. This would be done automatically on our website i.e.:
> 
> * User logs into the website, and provides mac address
> * We insert the record in the database as an allow rule...

Sounds like a job for ipset(8).

> * Restart iptables?

Restart? What does that mean? iptables is not a daemon.
-- 
  http://rob0.nodns4.us/ -- system administration and consulting
  Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Dabase BAcked IPTables
  2013-06-28 23:19 ` /dev/rob0
@ 2013-06-29  0:00   ` Ricardo Klein
  2013-06-29  0:05   ` Nick Khamis
  1 sibling, 0 replies; 15+ messages in thread
From: Ricardo Klein @ 2013-06-29  0:00 UTC (permalink / raw)
  To: netfilter

Rob,

do you know the actual status of ipset "mac only" module? Someone has
told me that it is being developed...
I tried to make this work with mac_ip module and using "0.0.0.0/0" to
match the mac address with any ip, but, it didnt worked...
--
Att...

Ricardo Felipe Klein
klein.rfk@gmail.com


On Fri, Jun 28, 2013 at 8:19 PM, /dev/rob0 <rob0@gmx.co.uk> wrote:
> On Fri, Jun 28, 2013 at 11:01:10AM -0400, Nick Khamis wrote:
>> Is it possible to have a MySQL backed IPTables?
>
> No, network packets need to be handled in real time. Your SQL query
> would take too long.
>
>> What we are trying to accomplish is having our clients supply us
>> with a mac address (or ip), and we would let them through our core
>> network. This would be done automatically on our website i.e.:
>>
>> * User logs into the website, and provides mac address
>> * We insert the record in the database as an allow rule...
>
> Sounds like a job for ipset(8).
>
>> * Restart iptables?
>
> Restart? What does that mean? iptables is not a daemon.
> --
>   http://rob0.nodns4.us/ -- system administration and consulting
>   Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Dabase BAcked IPTables
  2013-06-28 23:19 ` /dev/rob0
  2013-06-29  0:00   ` Ricardo Klein
@ 2013-06-29  0:05   ` Nick Khamis
  2013-06-29  0:28     ` /dev/rob0
  1 sibling, 1 reply; 15+ messages in thread
From: Nick Khamis @ 2013-06-29  0:05 UTC (permalink / raw)
  To: netfilter

On 6/28/13, /dev/rob0 <rob0@gmx.co.uk> wrote:
> On Fri, Jun 28, 2013 at 11:01:10AM -0400, Nick Khamis wrote:
>> Is it possible to have a MySQL backed IPTables?
>
> No, network packets need to be handled in real time. Your SQL query
> would take too long.
>
>> What we are trying to accomplish is having our clients supply us
>> with a mac address (or ip), and we would let them through our core
>> network. This would be done automatically on our website i.e.:
>>
>> * User logs into the website, and provides mac address
>> * We insert the record in the database as an allow rule...
>
> Sounds like a job for ipset(8).
>
>> * Restart iptables?
>
> Restart? What does that mean? iptables is not a daemon.
> --
>   http://rob0.nodns4.us/ -- system administration and consulting
>   Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

How did I overlook ipset? By restart I mean ./iptables && iptables-save

Kind Regards,

Nick.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Dabase BAcked IPTables
  2013-06-29  0:05   ` Nick Khamis
@ 2013-06-29  0:28     ` /dev/rob0
  2013-06-29  1:21       ` Nick Khamis
  0 siblings, 1 reply; 15+ messages in thread
From: /dev/rob0 @ 2013-06-29  0:28 UTC (permalink / raw)
  To: netfilter

On Fri, Jun 28, 2013 at 08:05:44PM -0400, Nick Khamis wrote:
> On 6/28/13, /dev/rob0 <rob0@gmx.co.uk> wrote:
> > On Fri, Jun 28, 2013 at 11:01:10AM -0400, Nick Khamis wrote:
> >> What we are trying to accomplish is having our clients supply
> >> us with a mac address (or ip), and we would let them through
> >> our core network. This would be done automatically on our
> >> website i.e.:
> >>
> >> * User logs into the website, and provides mac address
> >> * We insert the record in the database as an allow rule...
> >
> > Sounds like a job for ipset(8).
> >
> >> * Restart iptables?
> >
> > Restart? What does that mean? iptables is not a daemon.
> 
> How did I overlook ipset? By restart I mean ./iptables && 
> iptables-save

I'm still not sure what that means; is ./iptables a script? (Not 
using the one in $PATH for a reason?) And iptables-save(8) merely 
writes the rules to stdout.

When you update your ipset, any rule referring to that set uses the
new set right away. There would be no point in dumping and then 
reloading your ruleset.


P.S. to Ricardo: No, sorry, I don't know about it. But for this 
purpose a MAC address would not be needed. "User logs into the 
website," this cannot be done without an IP address.
-- 
  http://rob0.nodns4.us/ -- system administration and consulting
  Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Dabase BAcked IPTables
  2013-06-29  0:28     ` /dev/rob0
@ 2013-06-29  1:21       ` Nick Khamis
  2013-06-29 14:47         ` Eliezer Croitoru
  0 siblings, 1 reply; 15+ messages in thread
From: Nick Khamis @ 2013-06-29  1:21 UTC (permalink / raw)
  To: netfilter

Ooops, I realized how many blanks I am leaving in my messages. The
website is only used to allow the user to enter their mac address in
order to have access to our services (not HTTP).

Yes, ./iptables.sh is the ruleset script.

>> When you update your ipset, any rule referring to that set uses the
>> new set right away. There would be no point in dumping and then
>> reloading your ruleset.

Hmm, this covers adding *new* mac or even ip addresses however, how
would delete/modify existing entries dynamically.

Kind Regards.

Nick.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Dabase BAcked IPTables
  2013-06-29  1:21       ` Nick Khamis
@ 2013-06-29 14:47         ` Eliezer Croitoru
  0 siblings, 0 replies; 15+ messages in thread
From: Eliezer Croitoru @ 2013-06-29 14:47 UTC (permalink / raw)
  To: Nick Khamis; +Cc: netfilter

The internet works on IP not on mac....
it's like "I want to buy a car who don't move"
OK NP just buy something else then a car...

ipset is the tool and you would need couple security levels in order to 
prevent spoofing and defending aginst Some malicious attempts on this 
site..

Eliezer

On 06/29/2013 04:21 AM, Nick Khamis wrote:
> Ooops, I realized how many blanks I am leaving in my messages. The
> website is only used to allow the user to enter their mac address in
> order to have access to our services (not HTTP).
>
> Yes, ./iptables.sh is the ruleset script.
>
>>> When you update your ipset, any rule referring to that set uses the
>>> new set right away. There would be no point in dumping and then
>>> reloading your ruleset.
>
> Hmm, this covers adding *new* mac or even ip addresses however, how
> would delete/modify existing entries dynamically.
>
> Kind Regards.
>
> Nick.
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Dabase BAcked IPTables
  2013-06-28 15:12 ` Ricardo Klein
@ 2013-06-29 18:19   ` Jozsef Kadlecsik
  2013-06-29 20:10     ` Andrew Beverley
  0 siblings, 1 reply; 15+ messages in thread
From: Jozsef Kadlecsik @ 2013-06-29 18:19 UTC (permalink / raw)
  To: Ricardo Klein; +Cc: Nick Khamis, netfilter

On Fri, 28 Jun 2013, Ricardo Klein wrote:

> I think someone is already working in a ipset module for that.
> We need that here too...

I'd be fairly surprised at such a module...

> On Fri, Jun 28, 2013 at 12:01 PM, Nick Khamis <symack@gmail.com> wrote:
> >
> > Is it possible to have a MySQL backed IPTables? What we are trying to
> > accomplish is having our clients supply us with a mac address (or ip),
> > and we would let them through our core network. This would be done
> > automatically on our website i.e.:
> >
> > * User logs into the website, and provides mac address
> > * We insert the record in the database as an allow rule...
> > * Restart iptables?

That's pretty similar to a captive portal, which is quite simple to setup: 
you need a small webpage written say in PHP (IP and MAC can be gathered 
directly if the webserver is on the same LAN) and a bitmap:ip,mac type of 
set with timeout, and some static iptables rules. It's almost trivial if 
the things run on the gateway.

Best regards,
Jozsef
-
E-mail  : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.mta.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
          H-1525 Budapest 114, POB. 49, Hungary

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Dabase BAcked IPTables
  2013-06-29 18:19   ` Jozsef Kadlecsik
@ 2013-06-29 20:10     ` Andrew Beverley
  2013-06-29 20:39       ` Nick Khamis
  0 siblings, 1 reply; 15+ messages in thread
From: Andrew Beverley @ 2013-06-29 20:10 UTC (permalink / raw)
  To: Jozsef Kadlecsik; +Cc: Ricardo Klein, Nick Khamis, netfilter

On Sat, 2013-06-29 at 20:19 +0200, Jozsef Kadlecsik wrote:
> > > * User logs into the website, and provides mac address
> > > * We insert the record in the database as an allow rule...
> > > * Restart iptables?
> 
> That's pretty similar to a captive portal, which is quite simple to setup: 
> you need a small webpage written say in PHP (IP and MAC can be gathered 
> directly if the webserver is on the same LAN) and a bitmap:ip,mac type of 
> set with timeout, and some static iptables rules. It's almost trivial if 
> the things run on the gateway.

And an example is here:

http://www.andybev.com/index.php/Using_iptables_and_PHP_to_create_a_captive_portal

Except it does not use ipset, which would be a *much* better way of
implementing it ;-)



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Dabase BAcked IPTables
  2013-06-29 20:10     ` Andrew Beverley
@ 2013-06-29 20:39       ` Nick Khamis
  2013-06-29 21:00         ` Neal Murphy
  0 siblings, 1 reply; 15+ messages in thread
From: Nick Khamis @ 2013-06-29 20:39 UTC (permalink / raw)
  To: Andrew Beverley; +Cc: Jozsef Kadlecsik, Ricardo Klein, netfilter

I love you guys!!! I am sorry that I have left out important details
that left you speculating. We offer a SIP phone service to our
clients. In netfilter speak that's:

-A UDP -p udp -m udp --sport 5060 ---dport 5080 -j ACCEPT :)

Anyone can use our SIP server however, they will first need to create
an account through our website, and provide the mac of the device that
will be connecting to us. The website does not have to capture their
info.

Why we prefer mac is because the device will not be static, it will be
on the move hopping on different networks all happy and stuff :)....

Andrew, that is kind of what we are looking for but as you mentioned
ipset would be a much better way of doing it. Until this post I did
not know of ipset, will have to educate myself regarding it.

What is unclear at this moment is, do we have mac support, or is it
called *ip*set for a reason? Secondly, can we update and remove
existing entries in our config.

Kind Regards,

Nick.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Dabase BAcked IPTables
  2013-06-29 20:39       ` Nick Khamis
@ 2013-06-29 21:00         ` Neal Murphy
  2013-06-29 23:12           ` Nick Khamis
  0 siblings, 1 reply; 15+ messages in thread
From: Neal Murphy @ 2013-06-29 21:00 UTC (permalink / raw)
  To: netfilter

On Saturday, June 29, 2013 04:39:06 PM Nick Khamis wrote:
> I love you guys!!! I am sorry that I have left out important details
> that left you speculating. We offer a SIP phone service to our
> clients. In netfilter speak that's:
> 
> -A UDP -p udp -m udp --sport 5060 ---dport 5080 -j ACCEPT :)
> 
> Anyone can use our SIP server however, they will first need to create
> an account through our website, and provide the mac of the device that
> will be connecting to us. The website does not have to capture their
> info.
> 
> Why we prefer mac is because the device will not be static, it will be
> on the move hopping on different networks all happy and stuff :)....
> 
> Andrew, that is kind of what we are looking for but as you mentioned
> ipset would be a much better way of doing it. Until this post I did
> not know of ipset, will have to educate myself regarding it.
> 
> What is unclear at this moment is, do we have mac support,

The MAC address is only used on local links. The MAC address of a packet 
arriving at your firewall or perimeter router is that of the router at the 
other (ISP) end of your link. The only exception would be if the higher 
protocol (SIP) includes the MAC address; but that's another ball of wax.

Does SIP handle roaming? If so, you'd almost need a SIP helper to track and 
update the client's IP.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Dabase BAcked IPTables
  2013-06-29 21:00         ` Neal Murphy
@ 2013-06-29 23:12           ` Nick Khamis
  2013-06-30 12:13             ` Dash Four
  0 siblings, 1 reply; 15+ messages in thread
From: Nick Khamis @ 2013-06-29 23:12 UTC (permalink / raw)
  To: neal.p.murphy; +Cc: netfilter

>> The MAC address is only used on local links. The MAC address of a packet
>> arriving at your firewall or perimeter router is that of the router at the
>> other (ISP) end of your link.

Our client application adds a P-Assertion to the SIP message
indicating the mac of
the requesting client. Now, I am not sure how we can tie that into
"--src" of IPTables.
As you rightfully pointed out, the source of the arriving packet will
be irrelevant.
Thanks for pointing that out.

We can always manage this on our SIP servers, maybe that's the better
place for it?
If possible it would be nice to keep firewalling to IPTables...

>> Does SIP handle roaming? If so, you'd almost need a SIP helper to track and
>> update the client's IP.

We handle roaming logic using our proxies.

Kind Regards,

N.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Dabase BAcked IPTables
  2013-06-29 23:12           ` Nick Khamis
@ 2013-06-30 12:13             ` Dash Four
  2013-06-30 13:27               ` Nick Khamis
  0 siblings, 1 reply; 15+ messages in thread
From: Dash Four @ 2013-06-30 12:13 UTC (permalink / raw)
  Cc: netfilter


Nick Khamis wrote:
>>> The MAC address is only used on local links. The MAC address of a packet
>>> arriving at your firewall or perimeter router is that of the router at the
>>> other (ISP) end of your link.
>>>       
>
> Our client application adds a P-Assertion to the SIP message
> indicating the mac of
> the requesting client. Now, I am not sure how we can tie that into
> "--src" of IPTables.
>   
If you need to capture embedded MAC addresses in that header you would 
need to analyse the SIP packet - not a trivial thing to do by any means. 
Even then, what's stopping, say, an adversary from crafting a packet 
with a "legitimate" MAC address embedded in that header.

Even if you match IP and MAC addresses together, that won't be 100% 
secure as these could be easily forged.

Since your clients are using an application you provide, why don't you 
secure the signalling using PKI - that way you could distribute a 
certificate with the client. The server on your side of the connection 
won't accept it unless a secure handshake has been established - job done.

OK, that won't prevent you from somebody ddos-ing you, but you could 
easily protect yourself from this using standard iptables tools.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Dabase BAcked IPTables
  2013-06-30 12:13             ` Dash Four
@ 2013-06-30 13:27               ` Nick Khamis
  0 siblings, 0 replies; 15+ messages in thread
From: Nick Khamis @ 2013-06-30 13:27 UTC (permalink / raw)
  To: Dash Four; +Cc: netfilter

>> why don't you secure the signalling using PKI

I think this is the smarter way of doing it.

>> The server on your side of the connection won't accept it unless a secure handshake has >> been established - job done.

I am familiar with PKI and SSH handshake. In this scenario what would
be responsible for securing the handshake? Can we use iptables to
match public/private keys and establish a secure connection? We really
like to abstract outwards the different services (i.e., leave SIP
related doings to the SIP server, and handshake securing to OpenVPN?).

>> OK, that won't prevent you from somebody ddos-ing you, but you could easily protect
>> yourself from this using standard iptables tools.

I think with PKI, and standard iptables ddos is less of an issue?

Guys, thank you so much! And thank you iptables for making our
networks a little more secure, and the internet a little more
bearable!

Kind Regards,

Nick.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-06-30 13:27 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-28 15:01 Dabase BAcked IPTables Nick Khamis
2013-06-28 15:12 ` Ricardo Klein
2013-06-29 18:19   ` Jozsef Kadlecsik
2013-06-29 20:10     ` Andrew Beverley
2013-06-29 20:39       ` Nick Khamis
2013-06-29 21:00         ` Neal Murphy
2013-06-29 23:12           ` Nick Khamis
2013-06-30 12:13             ` Dash Four
2013-06-30 13:27               ` Nick Khamis
2013-06-28 23:19 ` /dev/rob0
2013-06-29  0:00   ` Ricardo Klein
2013-06-29  0:05   ` Nick Khamis
2013-06-29  0:28     ` /dev/rob0
2013-06-29  1:21       ` Nick Khamis
2013-06-29 14:47         ` Eliezer Croitoru

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.