Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Vladimir Mosgalin <mosgalin@VM10124.spb.edu>
To: netfilter@lists.netfilter.org
Subject: Dynamic change of iptables (building Wi-Fi hotspot)
Date: Sun, 4 Jul 2004 20:33:42 +0400 (MSD)	[thread overview]
Message-ID: <Pine.LNX.4.58.0407042011460.3513@localhost.localdomain> (raw)

Hello everybody.

I want to build a Wi-Fi hotspot. The linux box with wireless AP
connected to it which provides internet access to people with Wi-Fi
cards.

When people pay for time or traffic some unique username and password is
given to each. When they try to access any http website, for the first
time each of them gets a login message. After entering name & password,
they continue to work normally.

I see two ways of doing it.
1) Iptables get changed by some script each time when someone registers
or his time runs out. There is a rule
iptables -A FORWARD -p tcp --dport 80 -j DNAT --to-destination 127.0.0.1:80

Thus, everyone gets forwarded to localhost.
On localhost, apache has 404 error handler which redirects each to login
page. When they sucessfully enter username and password, script adds
line like this
iptables -I FORWARD 1 -s $ip -j ACCEPT
and now client can do whatever he wants.

When unregistering, another script removes this line.

I see two problems in this approach - I'm not sure whether changing
iptables constantly is good, and I feel a bit anxious about the fact
that several different scripts are running and doing something.

2) All traffic is redirected to tun interface, and some C program
analyzies each packed and decides whether to pass them or block them
and serve as a simple http server, offering login page. The problem is
that I need to write this program in this case, and it can be
complicated a bit, and I'm not very confident because all traffic
will have to pass through this program and it must be written really
good if I don't want to have problems.


Maybe there are other solutions (like very clever netfilter module which
can be controlled from userspace)? Or there is nothing bad in changing
iptables often?

-- 

Vladimir


             reply	other threads:[~2004-07-04 16:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-04 16:33 Vladimir Mosgalin [this message]
2004-07-04 17:03 ` Dynamic change of iptables (building Wi-Fi hotspot) Antony Stone
2004-07-04 18:10   ` Vladimir Mosgalin
2004-07-04 21:26 ` Eric Leblond

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.58.0407042011460.3513@localhost.localdomain \
    --to=mosgalin@vm10124.spb.edu \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox