Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility for apache 2.4 out of the box #5

Closed
wants to merge 3 commits into from

Conversation

endelwar
Copy link
Contributor

Using .htaccess as is on Apache 2.4 make it halt with error 500 because Order directive is deprecated in favour of Require.
This patch checks existence of mod_authz_host module, available in Apache 2.3 and later and uses the right directive supported by Apache

Using .htaccess as is on Apache 2.4 make it halt with error 500 because `Order` directive is deprecated in favour of `Require`.
This patch check esistence of `mod_authz_host` module, available in Apache 2.3 and later and uses the right directive supported by Apache
@alrra
Copy link
Member

alrra commented Oct 1, 2013

@endelwar the solution won't work for both Apache v2.2.x and v2.4.x because Apache 2.2.x has the Allow, Deny, and Satisfy directives under the "same" module: mod_authz_host.c :(

Also relevant to this issue: http://httpd.apache.org/docs/trunk/upgrading.html#access

mod_version should be compiled statically in major distribution and it is available from Apache version 2.0.56
@endelwar
Copy link
Contributor Author

endelwar commented Oct 1, 2013

@alrra yes, that's right, same module name, different functions :(
I've tested the mod_version presence on ubuntu 12.04, debian 6 and debian 7: it's statically compiled so it should be present in major distribution. We should get an httpd -M or apachectl -M from different installation (linux, osx, freebsd, windows) and different version to be 100% sure of this.

mod_authz_core.c is only available on Apache >= 2.3
@endelwar
Copy link
Contributor Author

endelwar commented Oct 1, 2013

Eventually we can check for mod_authz_core, that not exists in apache < 2.3

@alrra
Copy link
Member

alrra commented Oct 1, 2013

we can check for mod_authz_core

@endelwar yes, that seems to be a better solution as mod_authz_core has the "base" status, while mod_version has only the "extension" status.

Base
A module labeled as having "Base" status is compiled and loaded into the server by default, and is therefore normally available unless you have taken steps to remove the module from your configuration.

Extension
A module with "Extension" status is not normally compiled and loaded into the server. To enable the module and its functionality, you may need to change the server build configuration files and re-compile Apache.


# Apache < 2.3
<IfModule !mod_authz_core.c>
    Order allow,deny
    Deny from all
    Satisfy All
</IfModule>

# Apache ≥ 2.3
<IfModule mod_authz_core.c>
    Require all denied
</IfModule>           

Tested the above in Apache/2.2.24 and Apache/2.4.6.


@endelwar can you merge the commits into one and provide a more detail commit message ? Thanks!

@alrra alrra closed this in 231ecf8 Oct 1, 2013
alrra pushed a commit that referenced this pull request Oct 1, 2013
As of Apache v2.3, the `Order`, `Allow` & `Deny` directives are replaced
by `Require`, making the Apache v2.2.x configuration not compatible with
Apache v2.3+: http://httpd.apache.org/docs/trunk/upgrading.html#access.

This patch enables the correct syntax for both Apache v2.2.x & v2.3+, by
checking for the presence of the `mod_authz_core` base module (available
only in Apache v2.3 and later).

See also: http://httpd.apache.org/docs/2.4/mod/mod_authz_core.html

Close #5 and #6.
@alrra
Copy link
Member

alrra commented Oct 1, 2013

@endelwar thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants