Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Mack" <RAGAN_DAVIS@colstate.edu>
To: netfilter@newkirk.us, netfilter@lists.netfilter.org
Subject: Re: need some help solving problem
Date: Mon, 31 Mar 2003 10:22:34 -0500	[thread overview]
Message-ID: <3E8816E9.23197.30E614@localhost> (raw)
In-Reply-To: <200303291355.47578.netfilter@newkirk.us>

This seems to work great!  Thanks for the advice.  The only weirdness I saw was 
that if someone requests "www.somewhere.com/subweb", then they get a page not 
found error.  But, this was the case with my original dnat code, too.  I guess it's 
looking for the path "/subweb" on the document root of the web site that I'm 
redirecting them too, and since it's not there, it give an error.  But, using your limit 
and state match suggestion, this should rarely happen and I doubt I'll have too many 
complaints about it.  Nevertheless, I am going to look into your web proxy 
suggestion.  I am currently using Squid for another application, so maybe this will 
serve the purpose.  Have you ever used Squid, and if so, do you have any 
suggestions as to how I'd configure Squid to do this?

Thanks for the help!
mack

On 29 Mar 2003 at 13:55, Joel Newkirk wrote:

> On Saturday 29 March 2003 12:50 pm, Mack wrote:
> > Hi!
> 
> Hi! :^)
> 
> > I currently have a rule in my iptables firewall script like this:
> >
> > iptables -t nat -A PREROUTING -p tcp -s 1.2.3.4 --dport http -j DNAT
> > --to 5.6.7.8:80
> >
> > This successfully "redirects" a client trying to go to
> > www.somewhere.com and sends them to a web site on my webserver, and
> > displays the default web page for that web site.  This works fine.
> > However, this happens on every request from the client.  Is there a
> > way to have the prerouting happen only once, and then not happen
> > after that?  I'd like to redirect them to a web page that contains
> > news or important imformation.  Once they've visited this page, I'd
> > like for them to not see it again until later (if ever).  I was
> > looking at the "-m recent" extension, but I'm not sure if this will
> > work.
> >
> > Any ideas/suggestions?
> 
> Two ways come to mind.  The first is redirect everything to a proxy,
> and handle this there.  (that's the better solution.) The second is
> using the limit match.
> 
> iptables -t nat -A PREROUTING -s 1.2.3.4 -p tcp --dport 80 -m limit
> --limit 2/d --limit-burst 1 -m state --state NEW -j DNAT --to 5.6.7.8
> 
> This will redirect them to 5.6.7.8, then not do it again for 12 hours.
>  You can match 1/d or whatever frequency you want, just make the limit
> what you need, and keep burst at 1, for this purpose.  (with burst set
> to 3, for instance, then the first three attempts would match)  The
> minimum frequency is 1/d.
> 
> Be aware that this could also match an attempt to retrieve an image
> inlined in a web document already loading, or other similarly
> problematic outcomes...  With a proxy you could set up to do this in a
> more precise and effective fashion.  (recent match would suffer the
> same problem as limit)
> 
> > many thanks,
> > mack
> 
> j
> 




      reply	other threads:[~2003-03-31 15:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-29 17:50 need some help solving problem Mack
2003-03-29 18:55 ` Joel Newkirk
2003-03-31 15:22   ` Mack [this message]

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=3E8816E9.23197.30E614@localhost \
    --to=ragan_davis@colstate.edu \
    --cc=netfilter@lists.netfilter.org \
    --cc=netfilter@newkirk.us \
    /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