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

secure_satis: true does not work with BasicAuth #84

Open
NeoBlack opened this issue Feb 12, 2018 · 10 comments
Open

secure_satis: true does not work with BasicAuth #84

NeoBlack opened this issue Feb 12, 2018 · 10 comments

Comments

@NeoBlack
Copy link
Contributor

I have set secure_satis: true, the packages.json is now protected by a BasicAuth but entering the credentials does not enable the access to the files.
not in browser and also not by composer

@tyler-sommer
Copy link
Member

If you change the username/password to something extremely basic such as admin and password, does it work? I'm wondering if there is a problem when parsing the yaml configuration. Additionally, you may need to clear your cache directory.

You could also do the classic die() debugging, for example in: https://github.com/terramar-labs/packages/blob/master/src/Application.php#L56 throw a die($security['username']); in there to verify that the configuration is being read correctly.

@NeoBlack
Copy link
Contributor Author

Config is correct, $security contains the username and password from the config.yml.
after entering the data, the dialog comes back and ask again for the credentials.
I will try to setup the the tool on my local machine today, it's better for debugging.

@strausmann
Copy link

strausmann commented Feb 13, 2018

Hello Tyler, could you until the implementation of the feature (#77) add a second user?
This user can only access satis. I would like to secure satis and allow access for certain users. But would like to avoid that you log into the admin.

For me, the Basic Auth currently does not work as expected.

Many thanks,
Regards,

Bjoern

@strausmann
Copy link

Hello Tyler,

i think I have found the mistake. The password_hash() function use with the PASSWORD_DEFAULT algo a bcrypt-Algorithmus Password. But in the config.yml File is the passwort in plain-text saved.

Regards,
Bjoern

@NeoBlack
Copy link
Contributor Author

good catch @strausmann so the fix is to use an encrypted password hash (which the best idea) but will the login still works? will check it in the evening.

@NeoBlack
Copy link
Contributor Author

so, on my local system the BasicAuth for /packages.json work with a plaintext password., on my web server it does not work. on both system an encrypted password does not work.

@tyler-sommer
Copy link
Member

The password is hashed during application boot, though I agree the password should be hashed in the config file itself. This would be considered a BC break, however, so I want to avoid it if possible on the 3.x line.

The password entered during authentication is also hashed before comparison, so you should enter the plaintext password when authenticating.

I admit, though, I'm at a loss at what could be causing your issue, especially given it working locally. What does your setup look like, in both environments-- how are they different? Could it be a webserver configuration causing the problem?

@NeoBlack
Copy link
Contributor Author

It must not be a breaking change, an encrypted password (and the algorithm) can be detected by the prefix. example:

plain: password
brcypt: $2a$04$ntozz44SYhGgHBUEMSvYKOvWmVqMVC9v.PVfeDuEYzr7L.BL7r7e2

check the possible prefixes:
https://en.wikipedia.org/wiki/Bcrypt#Versioning_History

sure, the local setup is different from the server, but the server "normal" debian webserver. I will attach a PHPInfo output

@tyler-sommer
Copy link
Member

Excellent suggestion, @NeoBlack, I think that's a great way forward. There is already a utility in vendor/bin/hashpass that is shipped with nice-security. This utility could be used during a Composer post-install hook for the user.

I've opened #91 to track that feature.

However, this doesn't address your issues with authenticating. Is that still an issue?

@NeoBlack
Copy link
Contributor Author

yes it is still an issue, I had not the time yet to debug it on the server or have a deeper look into the code. Will try to check it the next days.

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

No branches or pull requests

3 participants