Apache directive for authenticated users? The Next CEO of Stack OverflowWebDAV on CentOS - getting 403 error when attempt to uploadDjango running on Apache+WSGI and apache SSL proxyingApache Directive for Allow FromNeed to disable an Apache site for users temporarilyActive Directory problems while trying to perfom compare operationApache mod_setenvif Server_AddrRedirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About Mod_Rewrite Rules but Were Afraid to AskApache httpd with LDAP error in CentOSScriptAlias makes requests match too many Location blocks. What is going on?
Can Sri Krishna be called 'a person'?
That's an odd coin - I wonder why
Are British MPs missing the point, with these 'Indicative Votes'?
Why can't we say "I have been having a dog"?
Ising model simulation
Cannot restore registry to default in Windows 10?
How to pronounce fünf in 45
Free fall ellipse or parabola?
Incomplete cube
How can I prove that a state of equilibrium is unstable?
Car headlights in a world without electricity
Can a PhD from a non-TU9 German university become a professor in a TU9 university?
Traveling with my 5 year old daughter (as the father) without the mother from Germany to Mexico
How to compactly explain secondary and tertiary characters without resorting to stereotypes?
Strange use of "whether ... than ..." in official text
A hang glider, sudden unexpected lift to 25,000 feet altitude, what could do this?
Read/write a pipe-delimited file line by line with some simple text manipulation
What steps are necessary to read a Modern SSD in Medieval Europe?
Calculate the Mean mean of two numbers
Is it possible to create a QR code using text?
Planeswalker Ability and Death Timing
What happens if you break a law in another country outside of that country?
My ex-girlfriend uses my Apple ID to login to her iPad, do I have to give her my Apple ID password to reset it?
Can this transistor (2N2222) take 6 V on emitter-base? Am I reading the datasheet incorrectly?
Apache directive for authenticated users?
The Next CEO of Stack OverflowWebDAV on CentOS - getting 403 error when attempt to uploadDjango running on Apache+WSGI and apache SSL proxyingApache Directive for Allow FromNeed to disable an Apache site for users temporarilyActive Directory problems while trying to perfom compare operationApache mod_setenvif Server_AddrRedirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About Mod_Rewrite Rules but Were Afraid to AskApache httpd with LDAP error in CentOSScriptAlias makes requests match too many Location blocks. What is going on?
Using Apache 2.2, I would like to use mod_rewrite to redirect un-authenticated users to use https, if they are on http.. Is there a directive or condition one can test for whether a user is (not) authenticated?
For example, I could have set up the restricted /foo
location on my server:-
<Location "/foo/">
Order deny,allow
# Deny everyone, until authenticated...
Deny from all
# Authentication mechanism
AuthType Basic
AuthName "Members only"
# AuthBasicProvider ...
# ... Other authentication stuff here.
# Users must be valid.
Require valid-user
# Logged-in users authorised to view child URLs:
Satisfy any
# If not SSL, respond with HTTP-redirect
RewriteCond $HTTPS off
RewriteRule /foo/?(.*)$ https://$SERVER_NAME/foo/$2 [R=301,L]
# SSL enforcement.
SSLOptions FakeBasicAuth StrictRequire
SSLRequireSSL
SSLRequire %SSL_CIPHER_USEKEYSIZE >= 128
</Location>
The problem here is that every file, in every subfolder, will be encrypted. This is quite unnecessary, but I see no reason to disallow it. What I would like is the RewriteRule
to only be triggered during authentication. If a user is already authorised to view a folder, then I don't want the RewriteRule
to be triggered. Is this possible?
EDIT:
I am not using any front-end HTML here. This is only using Apache's built-in directory browsing interface and its in-built authentication mechanisms. My <Directory>
config is:
<Directory ~ "/foo/">
Order allow,deny
Allow from all
AllowOverride None
Options +Indexes +FollowSymLinks +Includes +MultiViews
IndexOptions +FancyIndexing
IndexOptions +XHTML
IndexOptions NameWidth=*
IndexOptions +TrackModified
IndexOptions +SuppressHTMLPreamble
IndexOptions +FoldersFirst
IndexOptions +IgnoreCase
IndexOptions Type=text/html
</Directory>
apache-2.2 mod-rewrite mod-auth
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
Using Apache 2.2, I would like to use mod_rewrite to redirect un-authenticated users to use https, if they are on http.. Is there a directive or condition one can test for whether a user is (not) authenticated?
For example, I could have set up the restricted /foo
location on my server:-
<Location "/foo/">
Order deny,allow
# Deny everyone, until authenticated...
Deny from all
# Authentication mechanism
AuthType Basic
AuthName "Members only"
# AuthBasicProvider ...
# ... Other authentication stuff here.
# Users must be valid.
Require valid-user
# Logged-in users authorised to view child URLs:
Satisfy any
# If not SSL, respond with HTTP-redirect
RewriteCond $HTTPS off
RewriteRule /foo/?(.*)$ https://$SERVER_NAME/foo/$2 [R=301,L]
# SSL enforcement.
SSLOptions FakeBasicAuth StrictRequire
SSLRequireSSL
SSLRequire %SSL_CIPHER_USEKEYSIZE >= 128
</Location>
The problem here is that every file, in every subfolder, will be encrypted. This is quite unnecessary, but I see no reason to disallow it. What I would like is the RewriteRule
to only be triggered during authentication. If a user is already authorised to view a folder, then I don't want the RewriteRule
to be triggered. Is this possible?
EDIT:
I am not using any front-end HTML here. This is only using Apache's built-in directory browsing interface and its in-built authentication mechanisms. My <Directory>
config is:
<Directory ~ "/foo/">
Order allow,deny
Allow from all
AllowOverride None
Options +Indexes +FollowSymLinks +Includes +MultiViews
IndexOptions +FancyIndexing
IndexOptions +XHTML
IndexOptions NameWidth=*
IndexOptions +TrackModified
IndexOptions +SuppressHTMLPreamble
IndexOptions +FoldersFirst
IndexOptions +IgnoreCase
IndexOptions Type=text/html
</Directory>
apache-2.2 mod-rewrite mod-auth
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
Using Apache 2.2, I would like to use mod_rewrite to redirect un-authenticated users to use https, if they are on http.. Is there a directive or condition one can test for whether a user is (not) authenticated?
For example, I could have set up the restricted /foo
location on my server:-
<Location "/foo/">
Order deny,allow
# Deny everyone, until authenticated...
Deny from all
# Authentication mechanism
AuthType Basic
AuthName "Members only"
# AuthBasicProvider ...
# ... Other authentication stuff here.
# Users must be valid.
Require valid-user
# Logged-in users authorised to view child URLs:
Satisfy any
# If not SSL, respond with HTTP-redirect
RewriteCond $HTTPS off
RewriteRule /foo/?(.*)$ https://$SERVER_NAME/foo/$2 [R=301,L]
# SSL enforcement.
SSLOptions FakeBasicAuth StrictRequire
SSLRequireSSL
SSLRequire %SSL_CIPHER_USEKEYSIZE >= 128
</Location>
The problem here is that every file, in every subfolder, will be encrypted. This is quite unnecessary, but I see no reason to disallow it. What I would like is the RewriteRule
to only be triggered during authentication. If a user is already authorised to view a folder, then I don't want the RewriteRule
to be triggered. Is this possible?
EDIT:
I am not using any front-end HTML here. This is only using Apache's built-in directory browsing interface and its in-built authentication mechanisms. My <Directory>
config is:
<Directory ~ "/foo/">
Order allow,deny
Allow from all
AllowOverride None
Options +Indexes +FollowSymLinks +Includes +MultiViews
IndexOptions +FancyIndexing
IndexOptions +XHTML
IndexOptions NameWidth=*
IndexOptions +TrackModified
IndexOptions +SuppressHTMLPreamble
IndexOptions +FoldersFirst
IndexOptions +IgnoreCase
IndexOptions Type=text/html
</Directory>
apache-2.2 mod-rewrite mod-auth
Using Apache 2.2, I would like to use mod_rewrite to redirect un-authenticated users to use https, if they are on http.. Is there a directive or condition one can test for whether a user is (not) authenticated?
For example, I could have set up the restricted /foo
location on my server:-
<Location "/foo/">
Order deny,allow
# Deny everyone, until authenticated...
Deny from all
# Authentication mechanism
AuthType Basic
AuthName "Members only"
# AuthBasicProvider ...
# ... Other authentication stuff here.
# Users must be valid.
Require valid-user
# Logged-in users authorised to view child URLs:
Satisfy any
# If not SSL, respond with HTTP-redirect
RewriteCond $HTTPS off
RewriteRule /foo/?(.*)$ https://$SERVER_NAME/foo/$2 [R=301,L]
# SSL enforcement.
SSLOptions FakeBasicAuth StrictRequire
SSLRequireSSL
SSLRequire %SSL_CIPHER_USEKEYSIZE >= 128
</Location>
The problem here is that every file, in every subfolder, will be encrypted. This is quite unnecessary, but I see no reason to disallow it. What I would like is the RewriteRule
to only be triggered during authentication. If a user is already authorised to view a folder, then I don't want the RewriteRule
to be triggered. Is this possible?
EDIT:
I am not using any front-end HTML here. This is only using Apache's built-in directory browsing interface and its in-built authentication mechanisms. My <Directory>
config is:
<Directory ~ "/foo/">
Order allow,deny
Allow from all
AllowOverride None
Options +Indexes +FollowSymLinks +Includes +MultiViews
IndexOptions +FancyIndexing
IndexOptions +XHTML
IndexOptions NameWidth=*
IndexOptions +TrackModified
IndexOptions +SuppressHTMLPreamble
IndexOptions +FoldersFirst
IndexOptions +IgnoreCase
IndexOptions Type=text/html
</Directory>
apache-2.2 mod-rewrite mod-auth
apache-2.2 mod-rewrite mod-auth
edited Dec 7 '12 at 2:40
Alex Leach
asked Dec 6 '12 at 0:31
Alex LeachAlex Leach
6921813
6921813
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You seem to be confused how Basic Authentication works. Basic Authentication requires a password lookup for every request e.g. loading a html page with 100 images requires handling of at least 100 authentication requests. Specifically, if SSL/TLS is not used, then the credentials are passed as plaintext and could be intercepted. Enabling https only for a login page makes sense when you use cookie based authentication (e.g. http://finesec.com/sitedefensor.html)
That would explain the number of authentication requests I have in my logs.. I've setLogLevel = debug
and am using a departmental LDAP backend. I have no web UI though; this is merely for directory browsing, akin to FTP. I'll add my<Directory>
config, but there's no custom HTML or login page involved
– Alex Leach
Dec 7 '12 at 2:37
Aren't Basic auths all in the Headers? And the re-directs too, right? In this instance, I'd like to keep it that way, without having to write any extraneous HTML or CGI scripts...
– Alex Leach
Dec 7 '12 at 2:50
Yes, authorization header is used to pass base64 encoded username and password e.g. Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== (username: alladin, password: open sesame). Directory indexing requires a password lookup for each file in a directory e.g. browsing a directory that has 1000 files requires handling of at least 1000 authentication requests (1000 ldap queries).
– FINESEC
Dec 7 '12 at 12:56
I'd hope the last 999 auth requests would use the LDAP cache, which seems generous enough under default settings. Still, would be nice if it only needed to authorise a user once per session. Only just seen mod_session... Do you think that could help me out here?
– Alex Leach
Dec 7 '12 at 13:50
Possibly, that's for Apache 2.4 tho.
– FINESEC
Dec 7 '12 at 14:15
add a comment |
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f455524%2fapache-directive-for-authenticated-users%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You seem to be confused how Basic Authentication works. Basic Authentication requires a password lookup for every request e.g. loading a html page with 100 images requires handling of at least 100 authentication requests. Specifically, if SSL/TLS is not used, then the credentials are passed as plaintext and could be intercepted. Enabling https only for a login page makes sense when you use cookie based authentication (e.g. http://finesec.com/sitedefensor.html)
That would explain the number of authentication requests I have in my logs.. I've setLogLevel = debug
and am using a departmental LDAP backend. I have no web UI though; this is merely for directory browsing, akin to FTP. I'll add my<Directory>
config, but there's no custom HTML or login page involved
– Alex Leach
Dec 7 '12 at 2:37
Aren't Basic auths all in the Headers? And the re-directs too, right? In this instance, I'd like to keep it that way, without having to write any extraneous HTML or CGI scripts...
– Alex Leach
Dec 7 '12 at 2:50
Yes, authorization header is used to pass base64 encoded username and password e.g. Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== (username: alladin, password: open sesame). Directory indexing requires a password lookup for each file in a directory e.g. browsing a directory that has 1000 files requires handling of at least 1000 authentication requests (1000 ldap queries).
– FINESEC
Dec 7 '12 at 12:56
I'd hope the last 999 auth requests would use the LDAP cache, which seems generous enough under default settings. Still, would be nice if it only needed to authorise a user once per session. Only just seen mod_session... Do you think that could help me out here?
– Alex Leach
Dec 7 '12 at 13:50
Possibly, that's for Apache 2.4 tho.
– FINESEC
Dec 7 '12 at 14:15
add a comment |
You seem to be confused how Basic Authentication works. Basic Authentication requires a password lookup for every request e.g. loading a html page with 100 images requires handling of at least 100 authentication requests. Specifically, if SSL/TLS is not used, then the credentials are passed as plaintext and could be intercepted. Enabling https only for a login page makes sense when you use cookie based authentication (e.g. http://finesec.com/sitedefensor.html)
That would explain the number of authentication requests I have in my logs.. I've setLogLevel = debug
and am using a departmental LDAP backend. I have no web UI though; this is merely for directory browsing, akin to FTP. I'll add my<Directory>
config, but there's no custom HTML or login page involved
– Alex Leach
Dec 7 '12 at 2:37
Aren't Basic auths all in the Headers? And the re-directs too, right? In this instance, I'd like to keep it that way, without having to write any extraneous HTML or CGI scripts...
– Alex Leach
Dec 7 '12 at 2:50
Yes, authorization header is used to pass base64 encoded username and password e.g. Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== (username: alladin, password: open sesame). Directory indexing requires a password lookup for each file in a directory e.g. browsing a directory that has 1000 files requires handling of at least 1000 authentication requests (1000 ldap queries).
– FINESEC
Dec 7 '12 at 12:56
I'd hope the last 999 auth requests would use the LDAP cache, which seems generous enough under default settings. Still, would be nice if it only needed to authorise a user once per session. Only just seen mod_session... Do you think that could help me out here?
– Alex Leach
Dec 7 '12 at 13:50
Possibly, that's for Apache 2.4 tho.
– FINESEC
Dec 7 '12 at 14:15
add a comment |
You seem to be confused how Basic Authentication works. Basic Authentication requires a password lookup for every request e.g. loading a html page with 100 images requires handling of at least 100 authentication requests. Specifically, if SSL/TLS is not used, then the credentials are passed as plaintext and could be intercepted. Enabling https only for a login page makes sense when you use cookie based authentication (e.g. http://finesec.com/sitedefensor.html)
You seem to be confused how Basic Authentication works. Basic Authentication requires a password lookup for every request e.g. loading a html page with 100 images requires handling of at least 100 authentication requests. Specifically, if SSL/TLS is not used, then the credentials are passed as plaintext and could be intercepted. Enabling https only for a login page makes sense when you use cookie based authentication (e.g. http://finesec.com/sitedefensor.html)
answered Dec 6 '12 at 10:38
FINESECFINESEC
1,26178
1,26178
That would explain the number of authentication requests I have in my logs.. I've setLogLevel = debug
and am using a departmental LDAP backend. I have no web UI though; this is merely for directory browsing, akin to FTP. I'll add my<Directory>
config, but there's no custom HTML or login page involved
– Alex Leach
Dec 7 '12 at 2:37
Aren't Basic auths all in the Headers? And the re-directs too, right? In this instance, I'd like to keep it that way, without having to write any extraneous HTML or CGI scripts...
– Alex Leach
Dec 7 '12 at 2:50
Yes, authorization header is used to pass base64 encoded username and password e.g. Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== (username: alladin, password: open sesame). Directory indexing requires a password lookup for each file in a directory e.g. browsing a directory that has 1000 files requires handling of at least 1000 authentication requests (1000 ldap queries).
– FINESEC
Dec 7 '12 at 12:56
I'd hope the last 999 auth requests would use the LDAP cache, which seems generous enough under default settings. Still, would be nice if it only needed to authorise a user once per session. Only just seen mod_session... Do you think that could help me out here?
– Alex Leach
Dec 7 '12 at 13:50
Possibly, that's for Apache 2.4 tho.
– FINESEC
Dec 7 '12 at 14:15
add a comment |
That would explain the number of authentication requests I have in my logs.. I've setLogLevel = debug
and am using a departmental LDAP backend. I have no web UI though; this is merely for directory browsing, akin to FTP. I'll add my<Directory>
config, but there's no custom HTML or login page involved
– Alex Leach
Dec 7 '12 at 2:37
Aren't Basic auths all in the Headers? And the re-directs too, right? In this instance, I'd like to keep it that way, without having to write any extraneous HTML or CGI scripts...
– Alex Leach
Dec 7 '12 at 2:50
Yes, authorization header is used to pass base64 encoded username and password e.g. Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== (username: alladin, password: open sesame). Directory indexing requires a password lookup for each file in a directory e.g. browsing a directory that has 1000 files requires handling of at least 1000 authentication requests (1000 ldap queries).
– FINESEC
Dec 7 '12 at 12:56
I'd hope the last 999 auth requests would use the LDAP cache, which seems generous enough under default settings. Still, would be nice if it only needed to authorise a user once per session. Only just seen mod_session... Do you think that could help me out here?
– Alex Leach
Dec 7 '12 at 13:50
Possibly, that's for Apache 2.4 tho.
– FINESEC
Dec 7 '12 at 14:15
That would explain the number of authentication requests I have in my logs.. I've set
LogLevel = debug
and am using a departmental LDAP backend. I have no web UI though; this is merely for directory browsing, akin to FTP. I'll add my <Directory>
config, but there's no custom HTML or login page involved– Alex Leach
Dec 7 '12 at 2:37
That would explain the number of authentication requests I have in my logs.. I've set
LogLevel = debug
and am using a departmental LDAP backend. I have no web UI though; this is merely for directory browsing, akin to FTP. I'll add my <Directory>
config, but there's no custom HTML or login page involved– Alex Leach
Dec 7 '12 at 2:37
Aren't Basic auths all in the Headers? And the re-directs too, right? In this instance, I'd like to keep it that way, without having to write any extraneous HTML or CGI scripts...
– Alex Leach
Dec 7 '12 at 2:50
Aren't Basic auths all in the Headers? And the re-directs too, right? In this instance, I'd like to keep it that way, without having to write any extraneous HTML or CGI scripts...
– Alex Leach
Dec 7 '12 at 2:50
Yes, authorization header is used to pass base64 encoded username and password e.g. Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== (username: alladin, password: open sesame). Directory indexing requires a password lookup for each file in a directory e.g. browsing a directory that has 1000 files requires handling of at least 1000 authentication requests (1000 ldap queries).
– FINESEC
Dec 7 '12 at 12:56
Yes, authorization header is used to pass base64 encoded username and password e.g. Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== (username: alladin, password: open sesame). Directory indexing requires a password lookup for each file in a directory e.g. browsing a directory that has 1000 files requires handling of at least 1000 authentication requests (1000 ldap queries).
– FINESEC
Dec 7 '12 at 12:56
I'd hope the last 999 auth requests would use the LDAP cache, which seems generous enough under default settings. Still, would be nice if it only needed to authorise a user once per session. Only just seen mod_session... Do you think that could help me out here?
– Alex Leach
Dec 7 '12 at 13:50
I'd hope the last 999 auth requests would use the LDAP cache, which seems generous enough under default settings. Still, would be nice if it only needed to authorise a user once per session. Only just seen mod_session... Do you think that could help me out here?
– Alex Leach
Dec 7 '12 at 13:50
Possibly, that's for Apache 2.4 tho.
– FINESEC
Dec 7 '12 at 14:15
Possibly, that's for Apache 2.4 tho.
– FINESEC
Dec 7 '12 at 14:15
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f455524%2fapache-directive-for-authenticated-users%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown