Remote web server authentication fails after app restart
I have enabled the remote web server with authentication. This worked properly upon initial setup, but if the app is shut down and restarted, the credentials are no longer accepted and I must reset the password. Stopping and restarting the web server does not solve the issue.
After a quick code inspect and test, it looks like the webserver is started with the hashed value from the config as its password; not an unhashed value. Upon app restart, if I enter the hashed value as the password, everything works.
The issue is that storing a SHA256 hash in the config file is uni-directional. There is no way to go back to the password from the hashed value. This needs to be changed to be some form of encryption and not a simple hash.
I have the same issue. Unfortunatley, even when putting the password into the config manually and making the config read-only, a new config is generated and the read only version changed to .backup. I wanted to use LHM for monitoring remote devices on my network and i dont like the idea of having anything run without even basic authentication, even if its not exposed. So this is a breaking bug for me and renders the feature useless. I'd much rather just have a plain text password stored. (Basic auth transmits the password in encoded plain text anyways.)
I am not a professional, but my impression is, that the stored value from the config is hashed again before beeing compared to the entered password. So when initially setting the passsword this works, because the input is plain text but on restart, the stored hash is hashed again. I think adding a check whether the password is 64 bytes and if it is, skipping the hashing, should be a quick fix.
if (value.Length == 64) { PasswordSHA256 = value; } else { PasswordSHA256 = ComputeSHA256(value); }
I am dealing with this same issue and would like to see the hashing as bi-directional.
hi. issue still exists. System double hashs. if a password is set lhm reads the current hash from config and when you close lhm it will hash the hash. Thats BS. Please fix it.
This is a problem, guys.
I enabled authentication and used the admin/admin login and password for testing. At first, I didn’t understand why I was getting a 401. Here is an example:
curl -u "admin:admin" "http://192.168.228.10:8085/data.json"
<HTML><HEAD><TITLE>401 Unauthorized</TITLE></HEAD> <BODY><H4>401 Unauthorized</H4> Authorization required.</BODY></HTML>
Then I saw the following line in the configuration file: <add key="authenticationPassword" value="hash" />
and decided to try using the hash instead of the password. It worked. I received the data. BUT after rebooting the PC and/or restarting the application, the hash was updated and I stopped receiving the data:
curl -u "admin:8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918" "http://192.168.228.10:8085/data.json"
<HTML><HEAD><TITLE>401 Unauthorized</TITLE></HEAD> <BODY><H4>401 Unauthorized</H4> Authorization required.</BODY></HTML>
I was surprised to see that the password hash in the configuration file had been updated.
Authentication loses all meaning if I have to retrieve a new hash every time. Maybe the authentication method should be reworked?
LHM version 0.9.6
It seems that it's already fixed in 95e97cf96b3305e493f1a3535307a2f99ca046d5 but not released yet as of v0.9.6. Tested compiling from source from the latest commit and the bug is indeed gone.