Generate admin password on first boot - #421
Conversation
d287c0c to
6efffc3
Compare
|
Example output on first boot: |
|
I disagree with the approach here. This changes how the database gets created on five dialects in order to do something that doesn't need to touch database creation at all. The install path is the least testable code in the product and the least forgiving, because a database that comes out wrong can't be repaired from inside the running product. As written, this deletes the seed row from five dialect scripts and adds a hand-written INSERT that runs during migration, and only Derby has actually been exercised. None of that is necessary. Leave the scripts and the migrator exactly as they are, and check afterwards on every startup. Try to log in as admin/admin. If that fails, do nothing. If it succeeds and The database then gets created exactly the way it is today, by code that already works on all five, and the new code only reads state and reacts to it. If it has a bug, the install is still fine and the fix is an ordinary patch. It also widens what this fixes. Inside the For the login attempt, the part you want is the credential check inside Warning rather than rotating on an existing install is deliberate. A rotation would write a live admin credential into Three smaller things are worth picking up. @jonbartels this was force-pushed past your RandomStringUtils comment, so it needs a re-review. |
6efffc3 to
3cd6b4f
Compare
I disagree with your disagreement. The "admin" hashed password in the seed script is the issue. Anything that leaves a valid password in the DB for any period is a problem.
The problem is not someone who knowingly configures the system to use the password "admin", the problem is that the prompt to change it is enforced on the client side, and that it is a well-known value for any period of time. The installer and first run cannot allow a well-known password to create an auth session. The server must authenticate the admin performing initial setup.
My goal (and the vulnerability) have nothing to do with a user being configured to a particular value. The vuln is of the setup procedure leaving the system where a network attacker is able to take over control before the actual admin can complete setup.
Again: the bug is with the setup process, not with an upgrade or migration.
I don't understand this comment.
This is the status quo. I do not view this as an issue.
Fixed. |
Also: I had tested this with #294, which exercises this on each run against every database. It passed. It would be nice if this were the default for all PR's to be tested so. I agree it would be nice to avoid the direct write, but short of adding another operation, I did not see a clean way to do so, and this is very mundane SQL. |
If this succeeds and there is no prior login generate a conformant password. So there's a vulnerability that is available on an initial engine for split second while a new password is generated by the engine itself. If admin/admin succeeds and there is a prior login, write a conspicuous log message. That's the plain version of what I'm saying. it works on new installs and it warns current installs. And I'm pretty sure it's less code. I didn't want to create a competing PR. I can to demonstrate the concept. To be clear, I'm trying to make the assessment continuous not just on first time run. |
3cd6b4f to
6f37ed2
Compare
|
I will back off most of my comments - but I would urge the PR to address current admin/admin creds with a loud error on startup. |
jonbartels
left a comment
There was a problem hiding this comment.
Discussed in teams. I read the code. Seems correct to me.
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net>
6f37ed2 to
d45af87
Compare
Adds log message with generated password instead of admin:admin matching MySQL, Jenkins, Gitlab, ESXi, ElasticSearch, KeyCloak, and other systems.
Allows manual configuration of generated password through new mirth.properties option.
Closes #227