Repository navigation
feat(server): read the initial admin password from a file #3334
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
Changes from all commits
20e1a8c
09488c2
128c0b3
7ba00bd
f7f38ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -374,7 +374,8 @@ private void loadMetaFromPD() { | |
| this.initK8sManagerIfNeeded(conf); | ||
| if (shouldBootstrapAdmin(this.authenticator, | ||
| conf.get(ServerOptions.AUTH_REMOTE_URL))) { | ||
| this.initAdminUserIfNeeded(conf.get(ServerOptions.ADMIN_PA)); | ||
| this.initAdminUserIfNeeded( | ||
| StandardAuthenticator.initialAdminPassword(conf)); | ||
|
Comment on lines
+377
to
+378
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: no test runs this call with Evidence (Linux x86_64, OpenJDK 17.0.20.1): with these two lines put back to Requested change: move the |
||
| } | ||
|
|
||
| this.createDefaultGraphSpaceIfNeeded(conf); | ||
|
|
@@ -394,6 +395,18 @@ private static boolean shouldBootstrapAdmin(HugeAuthenticator authenticator, | |
| remoteUrl.isEmpty(); | ||
| } | ||
|
|
||
| /** | ||
| * With auth.remote_url the built-in authenticator switches to a remote | ||
| * AuthManager and never creates a local admin, so the admin password, and | ||
| * a password file that may not even be mounted, must not be resolved. | ||
| * Custom authenticators keep receiving initAdminUser() as before. | ||
| */ | ||
| private static boolean usesRemoteAuth(HugeAuthenticator authenticator, | ||
| String remoteUrl) { | ||
| return authenticator instanceof StandardAuthenticator && | ||
| !remoteUrl.isEmpty(); | ||
| } | ||
|
|
||
| /** | ||
| * Creates the built-in admin account in PD metadata. With init-store | ||
| * disabled this is the only bootstrap that admin gets, and init-store's | ||
|
|
@@ -1876,14 +1889,18 @@ private void checkBackendVersionOrExit(HugeConfig config) { | |
| assert hugegraph != null; | ||
| if (!hugegraph.backendStoreFeatures().supportsPersistence()) { | ||
| hugegraph.initBackend(); | ||
| if (this.requireAuthentication()) { | ||
| String adminPassword = config.get(ServerOptions.ADMIN_PA); | ||
| if (this.requireAuthentication() && | ||
| !usesRemoteAuth(this.authenticator, | ||
| config.get(ServerOptions.AUTH_REMOTE_URL))) { | ||
| // Outside the try so a bad password file names itself | ||
| String adminPassword = | ||
| StandardAuthenticator.initialAdminPassword(config); | ||
|
arshilkxwork marked this conversation as resolved.
|
||
| try { | ||
| this.authenticator().initAdminUser(adminPassword); | ||
| } catch (Exception e) { | ||
| throw new BackendException( | ||
| "The backend store of '%s' can't " + | ||
| "initialize admin user", hugegraph.spaceGraphName()); | ||
| "initialize admin user", e, hugegraph.spaceGraphName()); | ||
| } | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.