Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make sure AuthName works in all browsers?

The code below appears to show the text "HELLO WORLD" just fine in Firefox, IE, Safari, but not in Chrome.

<Files wp-login.php>
AuthType basic
AuthName "HELLO WORLD"
AuthBasicProvider file
AuthUserFile /home/.htpasswd
Require valid-user
</Files>
ErrorDocument 401 "Authentication required"

How can I make sure AuthName works in all browsers?

like image 362
IMB Avatar asked Mar 17 '16 15:03

IMB


People also ask

What tells Apache which file to use to find the user accounts and passwords?

We will use the htpasswd utility provided in the core Apache package. The password file can be stored anywhere on your hard drive. In our example we will create our htpasswd file in /etc/htpasswd. Note that the location of the htpasswd file can be anywhere you want on your local drive.

Is Apache authentication secure?

Apache supports one other authentication method: AuthType Digest . This method is implemented by mod_auth_digest and is much more secure. Most recent browsers support Digest authentication.

How do I password protect Apache with basic authentication?

The htpasswd command will allow us to create a password file that Apache can use to authenticate users. We will create a hidden file for this purpose called . htpasswd within our /etc/apache2 configuration directory. The first time we use this utility, we need to add the -c option to create the specified passwdfile.


1 Answers

The AuthName directive sets the realm parameter in the corresponding header, something like:

WWW-Authenticate: Basic realm="HELLO WORLD"

I found a Chromium ticket from October 2015 that reports a man in the middle attack related to HTTP authentication: Issue 544244 - HTTP basic auth credentials prompt should make the origin stand out more. During the discussion it was pointed out that text in realm can not be trusted and can be used in phishing attacks to trick users into revealing passwords to third-parties. I'm not a security expert but I understand that a proxy can inject headers —and usually does— thus the issue.

Apparent, the realm was removed form the authentication dialogue as a result of this and changes were eventually ported to Chrome. You can see the Do not show untrustworthy strings in the basic auth dialog code review for further details.

like image 128
Álvaro González Avatar answered Sep 18 '22 18:09

Álvaro González