Operating System - Linux
1826123 Members
4906 Online
109690 Solutions
New Discussion

Re: Trivial question -- httpd and Order statements

 
SOLVED
Go to solution
Maaz
Valued Contributor

Trivial question -- httpd and Order statements

hello All


Order allow,deny
Allow from .sales.company.com


Order statement is setting the default action... here it is Deny, and only
allowed folks are explicitly define/describe in the "Allow from" statement ...
OK and Fine.

But prblm is here (from httpd.conf)
#
# Order allow,deny
# Allow from all
#

I m trying to understand the above snippet, and failed.
Deny is the default action... but everyone is allowed via "Allow from all".
Here If I wana allowed everyone ... then why I m setting Default
Action/behaviour as "Deny" via "Order allow,deny" ... only "Allow from all" will be suffice ??? Isnt ?

Same goes here
#
# Order deny,allow
# Deny from all
# Allow from .example.com
#

Here allow is the default action ... that is only explicitly deny folks will
be refused/deneied .. is it ?
But "Deny from all" will cause everyone to be explicitly deneid ...

Plz guide me
Regards
Maaz
3 REPLIES 3
Alexander Chuzhoy
Honored Contributor
Solution

Re: Trivial question -- httpd and Order statements

below is some relevant information from
http://www.informit.com/articles/article.asp?p=29967&seqNum=4&rl=1


Access Rules Evaluation
You can have several Allow and Deny access rules. You can choose the order in which the rules are evaluated by using the Order directive. Rules that are evaluated later have higher precedence. Order accepts one argument, which can be Deny,Allow, Allow,Deny, or Mutual-Failure. Deny,Allow is the default value for the Order directive. Note that there is no space in the value.

Deny,Allow
Deny,Allow specifies that Deny directives are evaluated before Allow directives. With Deny,Allow, the client is granted access by default if there are no Allow or Deny directives or the client does not match any of the rules. If the client matches a Deny rule, it will be denied access unless it also matches an Allow rule, which will take precedence because Allow directives are evaluated last and have greater priority.

Listing 7.5 shows how to configure Apache to allow access to the /private location to clients coming from the internal network or the domain example.com and deny access to everyone else.

Listing 7.5 Sample Access Control Configuration
1:
2: Order Deny,Allow
3: Allow from 10.0.0.0/255.255.255.0 example.com
4: Deny from all
5:
Allow,Deny
Allow,Deny specifies that Allow directives are evaluated before Deny directives. With Allow,Deny, the client is denied access by default if there are no Allow or Deny directives or if the client does not match any of the rules. If the client matches an Allow rule, it will be granted access unless it also matches a Deny rule, which will take precedence.

Note that the presence of Order Allow,Deny without any Allow or Deny rules will cause all requests to the specified resource to be denied because the default behavior is to deny access.

Listing 7.6 allows access to everyone except a specific host.

Listing 7.6 Sample Access Control Configuration
1:
2: Order Allow,Deny
3: Allow from all
4: Deny from host.example.com
5: Mutual-Failure
In this case, the host will be granted access only if it matches an Allow directive and does not match any Deny directive
Sergejs Svitnevs
Honored Contributor

Re: Trivial question -- httpd and Order statements

1.
#
# Order allow,deny
# Allow from all
#


It means that Deny directives should be applied after all Allow directives (Deny would take precedence in any conflict), and that all users are allowed access to the contents of that directory.

2.
#
# Order deny,allow
# Deny from all
# Allow from .example.com
#


All hosts in the example.com domain are allowed access; all other hosts are denied access.
Maaz
Valued Contributor

Re: Trivial question -- httpd and Order statements

Very Nice help dear Alexander Chuzhoy and Sergejs Svitnevs ;)
Thanks a Million for such a promtp help

Regards
Maaz