-
-
Notifications
You must be signed in to change notification settings - Fork 525
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
Initialize persisted root
superuser on SQL server startup
#8690
Open
fulghum
wants to merge
7
commits into
main
Choose a base branch
from
fulghum/persist_root_superuser
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fulghum
force-pushed
the
fulghum/persist_root_superuser
branch
from
December 20, 2024 00:17
a66e815
to
0aa16c6
Compare
fulghum
force-pushed
the
fulghum/persist_root_superuser
branch
3 times, most recently
from
December 23, 2024 22:32
61fd270
to
bb27504
Compare
fulghum
force-pushed
the
fulghum/persist_root_superuser
branch
from
January 3, 2025 23:59
bb27504
to
4f7b73a
Compare
fulghum
force-pushed
the
fulghum/persist_root_superuser
branch
from
January 4, 2025 01:54
4f7b73a
to
e4b0423
Compare
fulghum
force-pushed
the
fulghum/persist_root_superuser
branch
2 times, most recently
from
January 9, 2025 00:51
776eab1
to
3864f5d
Compare
fulghum
force-pushed
the
fulghum/persist_root_superuser
branch
from
January 9, 2025 01:21
3864f5d
to
5ac80df
Compare
zachmu
reviewed
Jan 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some concerns about the security of this approach, take a look and see if you agree.
fulghum
force-pushed
the
fulghum/persist_root_superuser
branch
3 times, most recently
from
January 11, 2025 01:47
5e83d5f
to
d4d17aa
Compare
fulghum
force-pushed
the
fulghum/persist_root_superuser
branch
from
January 14, 2025 00:26
7651fc1
to
9eab71d
Compare
zachmu
approved these changes
Jan 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, seems like a good compromise
fulghum
force-pushed
the
fulghum/persist_root_superuser
branch
from
January 14, 2025 22:20
d1ef725
to
5253ec7
Compare
…h of sql-server when there are no existing privileges.
…rUser function from GMS
…terface and from YAML config
…eruser account, even if the root account was assigned a password
fulghum
force-pushed
the
fulghum/persist_root_superuser
branch
from
January 15, 2025 01:53
5253ec7
to
d38e569
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, Dolt would only create a
root
superuser on sql-server startup when no other user accounts had been created. This resulted in a behavior where users would rundolt sql-server
, create user accounts, then the next time they restart the sql-server, theroot
account would no longer be present. This behavior has surprised several customers (see #5759) and is different from MySQL's behavior, which creates a persistentroot
superuser as part of initialization.This change modifies this behavior so that a
root
superuser is created, and persisted, the first time a SQL server is started for a database, unless the--skip-root-user-initialization
flag is specified, or if an ephemeral super user is requested with the--user
option. Subsequent runs ofdolt sql-server
do not automatically create theroot
superuser – only the first timedolt sql-server
is started when there is no privileges database yet, will trigger theroot
user to be created and the privileges database to be initializedInternally, this is implemented by detecting the presence of any user account and privilege data stored to disk (by default, in the
.doltcfg/privileges.db
file). When no user account and privilege data exists, theroot
superuser initialization logic will run. This means theprivileges.db
data is now always created on the first run ofdolt sql-server
, even if the data is empty.As part of this change, the
root
superuser is now scoped tolocalhost
, instead of%
(i.e. any host). This improves the default security posture of a Dolt sql-server and better aligns with MySQL's behavior. Customers who rely on using theroot
account to connect from non-localhost hosts, will need to either log in and alter theroot
account to allow connections from the hosts they need, or they can specify theDOLT_ROOT_HOST
and/orDOLT_ROOT_PASSWORD
environment variables to override the default host (localhost) and password ("") for theroot
account when it is initialized the first time a sql-server is launched.One side effect of this change is that
dolt sql -u <user>
may work differently for some uses. Previously, if there was no user account and privilege data persisted to disk yet (i.e. the.doltcfg/privileges.db
file), then users could specify any username and password todolt sql
(e.g.dolt sql -u doesnotexist
) and they would still be logged in – user authentication was ignored since no user account and privilege data existed. Now that the user account and privilege data is always initialized when runningdolt sql-server
, customers may no longer usedolt sql --user <user>
to log in with unknown user accounts. The workaround for this is to simply rundolt sql
without the--user
option, and Dolt will use the default local account.Fixes: #5759
Depends on: dolthub/go-mysql-server#2797
Related to: dolthub/doltgresql#1113
Documentation updates: dolthub/docs#2460