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

password hashes in config file #25

Open
meganuke20 opened this issue Jun 16, 2014 · 1 comment
Open

password hashes in config file #25

meganuke20 opened this issue Jun 16, 2014 · 1 comment

Comments

@meganuke20
Copy link

Please add perhaps set passwords in config file as hashes, analogy linux passwords encryption.

@asuras-coding
Copy link

if you are using basic auth you can simply modify your basic-auth.js
add these lines after "app.use(express.basicAuth/function/user, pass) {"

var crypto = require('crypto');
var hash = crypto.createHash('md5').update(pass).digest('hex');

replace "pass" with "hash"

function body should look like this

var crypto = require('crypto');
var hash = crypto.createHash('md5').update(pass).digest('hex');
for (var i in config.basic_auth_users) {
var cred = config.basic_auth_users[i];
if ((cred["user"] === user) && (cred["password"] === hash)){
return true;
}
}
return false;

now you have to store md5-hashes in your config file. I don't know if you have to add this for every authentification method or if there is a central point to edit, but this works for basic auth.

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

2 participants