You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by JM Fraser <jm...@cybertrex.co.uk> on 2005/01/13 03:01:25 UTC

[users@httpd] How to create a "hosts deny" list for Apache

I need to start barring certain IP's from accessing my webserver. How can I
add this function into Apache which would be updated by a file where I
could add addresses?


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to create a "hosts deny" list for Apache

Posted by Dick Davies <ra...@hellooperator.net>.
* JM Fraser <jm...@cybertrex.co.uk> [0139 10:39]:
> Eric, do you have an example script that I could modify, or a site where I
> could get info? I don't want to end up terminating all httpd requests in
> error!

http://httpd.apache.org/docs-2.0/howto/auth.html#whatotherneatstuffcanido

(read the whole page, but that's the bit you need). 
> 
> On 3:12:53 January 13, 2005 Eric Ladner <er...@gmail.com> wrote:
> > You could store a .htaccess file at the top level and add hosts to the
> > deny there via a script.
> >
> > Eric
> >
> > On Thu, 13 Jan 2005 02:01:25 +0000, JM Fraser <jm...@cybertrex.co.uk>
> > >  wrote: I need to start barring certain IP's from accessing my
> > >  webserver. How can I add this function into Apache which would be
> > >  updated by a file where I could add addresses?

-- 
'This must be Thursday. I never could get the hang of Thursdays.'
		-- Arthur Dent
Rasputin :: Jack of All Trades - Master of Nuns

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to create a "hosts deny" list for Apache

Posted by JM Fraser <jm...@cybertrex.co.uk>.
Will investigate further. Thanks.


On 17:52:01 January 13, 2005 Dick Davies <ra...@hellooperator.net> wrote:
> * JM Fraser <jm...@cybertrex.co.uk> [0128 12:28]:
> >  This is exactly what I intend. Can I also port this over to a Mysql
> >  database which would be easier to update?
>
> http://www.diegonet.com/support/mod_auth_mysql.shtml
>
> but in that case, don't bother with the htaccess, you just define
> (I imagine, wouldn't touch mysql with a ten foot pole) a select to run
> each time a request comes in - if it finds a match of the credentials,
> in comes the user.
>
> --
> 'A little rudeness and disrespect can elevate a meaningless
> interaction into a battle of wills and add drama to an otherwise dull
> day.'         -- Calvin discovers Usenet
> Rasputin :: Jack of All Trades - Master of Nuns
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to create a "hosts deny" list for Apache

Posted by Dick Davies <ra...@hellooperator.net>.
* JM Fraser <jm...@cybertrex.co.uk> [0128 12:28]:
> This is exactly what I intend. Can I also port this over to a Mysql
> database which would be easier to update?

http://www.diegonet.com/support/mod_auth_mysql.shtml

but in that case, don't bother with the htaccess, you just define
(I imagine, wouldn't touch mysql with a ten foot pole) a select to run
each time a request comes in - if it finds a match of the credentials,
in comes the user.
 
-- 
'A little rudeness and disrespect can elevate a meaningless interaction
into a battle of wills and add drama to an otherwise dull day.'
		-- Calvin discovers Usenet
Rasputin :: Jack of All Trades - Master of Nuns

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to create a "hosts deny" list for Apache

Posted by "Ivan Barrera A." <Br...@Ivn.cl>.
For that, you must make a script which will dump the database to the 
file every x minutes.

JM Fraser wrote:
> This is exactly what I intend. Can I also port this over to a Mysql
> database which would be easier to update?
> 
> 
> On 12:18:36 January 13, 2005 Dick Davies <ra...@hellooperator.net> wrote:
> 
>>* JM Fraser <jm...@cybertrex.co.uk> [0113 11:13]:
>>
>>> Eric, could I have a .htaccess file with:
>>>
>>> Order deny,allow
>>> Allow From All
>>> Deny From /tmp/hosts_deny
>>>
>>>
>>> For example. This way all hosts listed in this "hosts_deny" file
>>> will be denied access but everyone else will get thru? Will I have
>>> to setup a specific directive around this?
>>>
>>
>>Why don't you just put the ranges you're going to specify in
>>/tmp/hosts_deny into the .htaccess (prefixed by 'Deny From', of
>>course)?
>>Apache will read a .htaccess for each request (that's the point of
>>them), so you can just edit the .htaccess file to add/remove
>>changes without needing to restart apache (I'm assuming thats why you
>>want a separate file).
>>
>>
>>> On 11:05:31 January 13, 2005 Grand Apeiron <Gr...@gmx.net>
>>>
>>>> wrote: On Thu, 2005-01-13 at 10:38 +0000, JM Fraser wrote:
>>>>
>>>>>  Eric, do you have an example script that I could modify, or a
>>>>>  site where I could get info? I don't want to end up
>>>>>  terminating all httpd requests in error!
>>>>
>>>> You only need a script if you want to modify the access list in
>>>> an automatic way.
>>>> The basic thing to deny/allow access to your site is the
>>>> .htaccess file itself.
>>>>
>>>> To deny access to everyone by default and only allow access for
>>>> some specific hosts/subnets your .htaccess file would look like:
>>>>
>>>> Order deny,allow
>>>>
>>>> Deny From All
>>>> Allow From x.x.x.x
>>>> Allow From x.x.x.x
>>>>
>>>>
>>>> So, one "Allow From" line for every host or subnet you want to
>>>> allow your site.
>>>>
>>>> You may read the documentation for the <Directory> directive in
>>>> the apache2 docs.
>>>>
>>>>
>>>> Grand Apeiron
>>>>
>>>> --
>>>> If I would be a tapeworm, I would prefer penguins.
>>>>
>>>>
>>>> -----------------------------------------------------------------
>>>>----
>>>> The official User-To-User support forum of the Apache HTTP Server
>>>> Project. See <URL:http://httpd.apache.org/userslist.html> for
>>>> more info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache
>>>>.org
>>>>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>>
>>>
>>>
>>> -------------------------------------------------------------------
>>>--
>>> The official User-To-User support forum of the Apache HTTP Server
>>> Project. See <URL:http://httpd.apache.org/userslist.html> for more
>>> info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>
>>
>>--
>>'With that big new contract, I've been able to make those government
>>mandated upgrades you've all been suing me about.'
>>        -- Prof. Farnsworth
>>Rasputin :: Jack of All Trades - Master of Nuns
>>
>>---------------------------------------------------------------------
>>The official User-To-User support forum of the Apache HTTP Server
>>Project. See <URL:http://httpd.apache.org/userslist.html> for more
>>info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>For additional commands, e-mail: users-help@httpd.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to create a "hosts deny" list for Apache

Posted by JM Fraser <jm...@cybertrex.co.uk>.
This is exactly what I intend. Can I also port this over to a Mysql
database which would be easier to update?


On 12:18:36 January 13, 2005 Dick Davies <ra...@hellooperator.net> wrote:
> * JM Fraser <jm...@cybertrex.co.uk> [0113 11:13]:
> >  Eric, could I have a .htaccess file with:
> >
> >  Order deny,allow
> >  Allow From All
> >  Deny From /tmp/hosts_deny
> >
> >
> >  For example. This way all hosts listed in this "hosts_deny" file
> >  will be denied access but everyone else will get thru? Will I have
> >  to setup a specific directive around this?
> >
>
> Why don't you just put the ranges you're going to specify in
> /tmp/hosts_deny into the .htaccess (prefixed by 'Deny From', of
> course)?
> Apache will read a .htaccess for each request (that's the point of
> them), so you can just edit the .htaccess file to add/remove
> changes without needing to restart apache (I'm assuming thats why you
> want a separate file).
>
> >  On 11:05:31 January 13, 2005 Grand Apeiron <Gr...@gmx.net>
> > >  wrote: On Thu, 2005-01-13 at 10:38 +0000, JM Fraser wrote:
> > > >   Eric, do you have an example script that I could modify, or a
> > > >   site where I could get info? I don't want to end up
> > > >   terminating all httpd requests in error!
> > >
> > >  You only need a script if you want to modify the access list in
> > >  an automatic way.
> > >  The basic thing to deny/allow access to your site is the
> > >  .htaccess file itself.
> > >
> > >  To deny access to everyone by default and only allow access for
> > >  some specific hosts/subnets your .htaccess file would look like:
> > >
> > >  Order deny,allow
> > >
> > >  Deny From All
> > >  Allow From x.x.x.x
> > >  Allow From x.x.x.x
> > >
> > >
> > >  So, one "Allow From" line for every host or subnet you want to
> > >  allow your site.
> > >
> > >  You may read the documentation for the <Directory> directive in
> > >  the apache2 docs.
> > >
> > >
> > >  Grand Apeiron
> > >
> > >  --
> > >  If I would be a tapeworm, I would prefer penguins.
> > >
> > >
> > >  -----------------------------------------------------------------
> > > ----
> > >  The official User-To-User support forum of the Apache HTTP Server
> > >  Project. See <URL:http://httpd.apache.org/userslist.html> for
> > >  more info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache
> > > .org
> > >     "   from the digest: users-digest-unsubscribe@httpd.apache.org
> > >  For additional commands, e-mail: users-help@httpd.apache.org
> > >
> >
> >
> >  -------------------------------------------------------------------
> > --
> >  The official User-To-User support forum of the Apache HTTP Server
> >  Project. See <URL:http://httpd.apache.org/userslist.html> for more
> >  info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> >     "   from the digest: users-digest-unsubscribe@httpd.apache.org
> >  For additional commands, e-mail: users-help@httpd.apache.org
> >
>
> --
> 'With that big new contract, I've been able to make those government
> mandated upgrades you've all been suing me about.'
>         -- Prof. Farnsworth
> Rasputin :: Jack of All Trades - Master of Nuns
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project. See <URL:http://httpd.apache.org/userslist.html> for more
> info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to create a "hosts deny" list for Apache

Posted by Dick Davies <ra...@hellooperator.net>.
* JM Fraser <jm...@cybertrex.co.uk> [0113 11:13]:
> Eric, could I have a .htaccess file with:
> 
> Order deny,allow
> Allow From All
> Deny From /tmp/hosts_deny
> 
> 
> For example. This way all hosts listed in this "hosts_deny" file will be
> denied access but everyone else will get thru? Will I have to setup a
> specific directive around this?
> 

Why don't you just put the ranges you're going to specify in /tmp/hosts_deny
into the .htaccess (prefixed by 'Deny From', of course)?

Apache will read a .htaccess for each request (that's the point of them),
so you can just edit the .htaccess file to add/remove
changes without needing to restart apache (I'm assuming thats why you want a
separate file).
 
> On 11:05:31 January 13, 2005 Grand Apeiron <Gr...@gmx.net> wrote:
> > On Thu, 2005-01-13 at 10:38 +0000, JM Fraser wrote:
> > >  Eric, do you have an example script that I could modify, or a site
> > >  where I could get info? I don't want to end up terminating all
> > >  httpd requests in error!
> >
> > You only need a script if you want to modify the access list in an
> > automatic way.
> > The basic thing to deny/allow access to your site is the .htaccess
> > file itself.
> >
> > To deny access to everyone by default and only allow access for some
> > specific hosts/subnets your .htaccess file would look like:
> >
> > Order deny,allow
> >
> > Deny From All
> > Allow From x.x.x.x
> > Allow From x.x.x.x
> >
> >
> > So, one "Allow From" line for every host or subnet you want to allow
> > your site.
> >
> > You may read the documentation for the <Directory> directive in the
> > apache2 docs.
> >
> >
> > Grand Apeiron
> >
> > --
> > If I would be a tapeworm, I would prefer penguins.
> >
> >
> > ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache HTTP Server
> > Project. See <URL:http://httpd.apache.org/userslist.html> for more
> > info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> >    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

-- 
'With that big new contract, I've been able to make those government mandated
upgrades you've all been suing me about.'
		-- Prof. Farnsworth
Rasputin :: Jack of All Trades - Master of Nuns

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to create a "hosts deny" list for Apache

Posted by JM Fraser <jm...@cybertrex.co.uk>.
Nice one Eric, will look at this also! cheers.


On 20:53:38 January 13, 2005 Eric Ladner <er...@gmail.com> wrote:
> No, you can't do that, but you could have a file that you create
> yourself in /tmp/hosts_deny, then write a script that produces the
> .htaccess file automatically.
>
> Something like (in bash or ksh, as an example):
>
> $webroot="/where/your/doc/root/is"
> $htaccess="$webroot/.htaccess"
>
> echo > $htaccess <<EOF
> AuthUserFile /dev/null
> AuthGroupFile /dev/null
> AuthName MyAuthName
> AuthType Basic
>
> <Limit GET>
>   order allow,deny
>   allow from all
> EOF
>
> cat /tmp/hosts_deny | while read line
> do
>     echo "  deny from $line" >> $htaccess
> done
>
> echo "</Limit>" >> $htaccess
>
> I haven't check this for complete syntactic correcness, but it should
> be close.  No comments from the peanut gallery on my coding style,
> either.  :P
>
> E
>
> On Thu, 13 Jan 2005 11:13:13 +0000, JM Fraser <jm...@cybertrex.co.uk>
> >  wrote: Eric, could I have a .htaccess file with:
> >
> >  Order deny,allow
> >  Allow From All
> >  Deny From /tmp/hosts_deny
> >
> >  For example. This way all hosts listed in this "hosts_deny" file
> >  will be denied access but everyone else will get thru? Will I have
> >  to setup a specific directive around this?
> >
> >
> >  On 11:05:31 January 13, 2005 Grand Apeiron <Gr...@gmx.net>
> > >  wrote: On Thu, 2005-01-13 at 10:38 +0000, JM Fraser wrote:
> > > >   Eric, do you have an example script that I could modify, or a
> > > >   site where I could get info? I don't want to end up
> > > >   terminating all httpd requests in error!
> > >
> > >  You only need a script if you want to modify the access list in
> > >  an automatic way.
> > >  The basic thing to deny/allow access to your site is the
> > >  .htaccess file itself.
> > >
> > >  To deny access to everyone by default and only allow access for
> > >  some specific hosts/subnets your .htaccess file would look like:
> > >
> > >  Order deny,allow
> > >
> > >  Deny From All
> > >  Allow From x.x.x.x
> > >  Allow From x.x.x.x
> > >
> > >
> > >  So, one "Allow From" line for every host or subnet you want to
> > >  allow your site.
> > >
> > >  You may read the documentation for the <Directory> directive in
> > >  the apache2 docs.
> > >
> > >
> > >  Grand Apeiron
> > >
>
>
> --
> Eric Ladner
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project. See <URL:http://httpd.apache.org/userslist.html> for more
> info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to create a "hosts deny" list for Apache

Posted by Joshua Slive <js...@gmail.com>.
On Thu, 13 Jan 2005 14:53:38 -0600, Eric Ladner <er...@gmail.com> wrote:
> AuthUserFile /dev/null
> AuthGroupFile /dev/null
> AuthName MyAuthName
> AuthType Basic
> 
> <Limit GET>

Skip all these lines.  They are unnecessary and possibly a security
risk.  See the docs on the <Limit> directive for more details.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to create a "hosts deny" list for Apache

Posted by Eric Ladner <er...@gmail.com>.
No, you can't do that, but you could have a file that you create
yourself in /tmp/hosts_deny, then write a script that produces the
.htaccess file automatically.

Something like (in bash or ksh, as an example):

$webroot="/where/your/doc/root/is"
$htaccess="$webroot/.htaccess"

echo > $htaccess <<EOF
AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName MyAuthName
AuthType Basic

<Limit GET>
  order allow,deny
  allow from all
EOF

cat /tmp/hosts_deny | while read line
do
    echo "  deny from $line" >> $htaccess
done

echo "</Limit>" >> $htaccess

I haven't check this for complete syntactic correcness, but it should
be close.  No comments from the peanut gallery on my coding style,
either.  :P

E

On Thu, 13 Jan 2005 11:13:13 +0000, JM Fraser <jm...@cybertrex.co.uk> wrote:
> Eric, could I have a .htaccess file with:
> 
> Order deny,allow
> Allow From All
> Deny From /tmp/hosts_deny
> 
> For example. This way all hosts listed in this "hosts_deny" file will be
> denied access but everyone else will get thru? Will I have to setup a
> specific directive around this?
> 
> 
> On 11:05:31 January 13, 2005 Grand Apeiron <Gr...@gmx.net> wrote:
> > On Thu, 2005-01-13 at 10:38 +0000, JM Fraser wrote:
> > >  Eric, do you have an example script that I could modify, or a site
> > >  where I could get info? I don't want to end up terminating all
> > >  httpd requests in error!
> >
> > You only need a script if you want to modify the access list in an
> > automatic way.
> > The basic thing to deny/allow access to your site is the .htaccess
> > file itself.
> >
> > To deny access to everyone by default and only allow access for some
> > specific hosts/subnets your .htaccess file would look like:
> >
> > Order deny,allow
> >
> > Deny From All
> > Allow From x.x.x.x
> > Allow From x.x.x.x
> >
> >
> > So, one "Allow From" line for every host or subnet you want to allow
> > your site.
> >
> > You may read the documentation for the <Directory> directive in the
> > apache2 docs.
> >
> >
> > Grand Apeiron
> >


-- 
Eric Ladner

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to create a "hosts deny" list for Apache

Posted by JM Fraser <jm...@cybertrex.co.uk>.
Eric, could I have a .htaccess file with:

Order deny,allow
Allow From All
Deny From /tmp/hosts_deny


For example. This way all hosts listed in this "hosts_deny" file will be
denied access but everyone else will get thru? Will I have to setup a
specific directive around this?




On 11:05:31 January 13, 2005 Grand Apeiron <Gr...@gmx.net> wrote:
> On Thu, 2005-01-13 at 10:38 +0000, JM Fraser wrote:
> >  Eric, do you have an example script that I could modify, or a site
> >  where I could get info? I don't want to end up terminating all
> >  httpd requests in error!
>
> You only need a script if you want to modify the access list in an
> automatic way.
> The basic thing to deny/allow access to your site is the .htaccess
> file itself.
>
> To deny access to everyone by default and only allow access for some
> specific hosts/subnets your .htaccess file would look like:
>
> Order deny,allow
>
> Deny From All
> Allow From x.x.x.x
> Allow From x.x.x.x
>
>
> So, one "Allow From" line for every host or subnet you want to allow
> your site.
>
> You may read the documentation for the <Directory> directive in the
> apache2 docs.
>
>
> Grand Apeiron
>
> --
> If I would be a tapeworm, I would prefer penguins.
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project. See <URL:http://httpd.apache.org/userslist.html> for more
> info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to create a "hosts deny" list for Apache

Posted by Grand Apeiron <Gr...@gmx.net>.
On Thu, 2005-01-13 at 10:38 +0000, JM Fraser wrote:
> Eric, do you have an example script that I could modify, or a site where I
> could get info? I don't want to end up terminating all httpd requests in
> error!

You only need a script if you want to modify the access list in an
automatic way.
The basic thing to deny/allow access to your site is the .htaccess file
itself.

To deny access to everyone by default and only allow access for some
specific hosts/subnets your .htaccess file would look like:

Order deny,allow

Deny From All
Allow From x.x.x.x
Allow From x.x.x.x


So, one "Allow From" line for every host or subnet you want to allow
your site.

You may read the documentation for the <Directory> directive in the
apache2 docs.


Grand Apeiron

-- 
If I would be a tapeworm, I would prefer penguins.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to create a "hosts deny" list for Apache

Posted by JM Fraser <jm...@cybertrex.co.uk>.
Eric, do you have an example script that I could modify, or a site where I
could get info? I don't want to end up terminating all httpd requests in
error!


On 3:12:53 January 13, 2005 Eric Ladner <er...@gmail.com> wrote:
> You could store a .htaccess file at the top level and add hosts to the
> deny there via a script.
>
> Eric
>
> On Thu, 13 Jan 2005 02:01:25 +0000, JM Fraser <jm...@cybertrex.co.uk>
> >  wrote: I need to start barring certain IP's from accessing my
> >  webserver. How can I add this function into Apache which would be
> >  updated by a file where I could add addresses?
> >
> >  -------------------------------------------------------------------
> > --
> >  The official User-To-User support forum of the Apache HTTP Server
> >  Project. See <URL:http://httpd.apache.org/userslist.html> for more
> >  info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> >     "   from the digest: users-digest-unsubscribe@httpd.apache.org
> >  For additional commands, e-mail: users-help@httpd.apache.org
> >
> >
>
>
> --
> Eric Ladner
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project. See <URL:http://httpd.apache.org/userslist.html> for more
> info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to create a "hosts deny" list for Apache

Posted by Eric Ladner <er...@gmail.com>.
You could store a .htaccess file at the top level and add hosts to the
deny there via a script.

Eric

On Thu, 13 Jan 2005 02:01:25 +0000, JM Fraser <jm...@cybertrex.co.uk> wrote:
> I need to start barring certain IP's from accessing my webserver. How can I
> add this function into Apache which would be updated by a file where I
> could add addresses?
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 


-- 
Eric Ladner

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org