Secure Logging
There will always be a vulnerability that we can't account for. Right now, if the system is compromised, the admin will likely never know how. That also means we as developers will have a hard time figuring that out.
We can't exactly secure PHP. At least, it is complicated for us to do and even more complicated for the user to implement. It would require jails for files which we want the system to be able to read/write/execute but not outside of those directories, except when we want to do mods. Which pretty much means it's impossible for us to implement this.
We can do a better job at security on the database though. We can also implement this with ease and minimal effort for the administrator. I'm not talking about locking down the database for everything. For instance, there is no way we can keep a malicious script from accessing the user's password while still having it able to update it.
What we can do is log everything that happens in the admin panel and not allow that log to be destroyed. The admin_log table should contain every action, not just ones that do changes. Every page that is accessed and every thing that is changed would be logged. There would be no way to turn this off without modifying the code. The regular database user must not have permissions to do anything but INSERT/SELECT on this table. This table should be allowed to be in a separate database with a separate database connection using a separate database user. This separation should make it easier for admins to understand the separation and not make a mistake. We should also document it and even test it in the admin panel and installation.
You might be concerned about the size of this table. How often does an admin visit the admin panel? Maybe once a day? If that. If they do, how many pages do they access? A dozen or so? So, a few dozen bytes. We could normalize it like crazy to save space. That would require more tables though. The admin could still prune the log. Just not with Elkarte or with the Elk db user(s).
Re: Secure Logging
Reply #2 –
Documentation would be a necessity but having another database is not. You just need to make sure your users don't have the grants for the whole database.
Yes, it would need to log what the setting is changed to. It doesn't need to log before though. You would just see it looking like that on the screen.
You can't "keep only the last" because the whole idea is that the user has no ability to remove data.
Re: Secure Logging
Reply #4 –
Ultimately, the best way to do this is with a separate authentication service. The application would ask that service the question "does the password XyZ match the user 123?" This authentication service would run completely separate from the main application and would only be accessed via a HTTP request. It could run on a separate server or container or virtual machine or just a jailed Apache process. So long as the main application can't access the authentication service's code.
The service could also handle brute-force checking since it would live on its own. It could handle logging the attempts, but that should only happen as another call to another service. It needs to handle authentication very quickly and without giving the user the ability to make changes.
Not sure it makes sense to be RESTful because you'd be GETting a confirmation of authentication by putting the password and id in the GET request. Then again... it does.
The database would be simple: id, password_hash, salt. Then another table for brute force checks which would be: id, request_ip, request_time.
Once you create a user (POST) it would create a salt for the user's password. Once the user is created, you cannot change the salt. The salt is only to store the user's password in the database. If the database gets compromised, the attacker would need to get past this layer in order to find the user's password. GET requests should also salt the passwords in the request string. A settings file would contain that salt and it would be per site/application.
Re: Secure Logging
Reply #9 –
Interesting tool.
I guess it technically could be integrated. But of course that's just my guts feeling based on what they have public on their website.
Re: Secure Logging
Reply #11 –
I think we are talking about two different things here: you about "log in" (i.e. the authentication), and the topic about "logging" (i.e. write logs of (admin) actions).
And please, try to open new topics to ask/suggest different things (like the guests one).