Add super user privilege #97
Merged
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.
This PR introduces new
UserPrivilegeofSuperUser, this privilege can be obtained through hidden!claimownercommand. For the security, the command requires two things to be true:SuperUserexists.SuperUserprivilege.Since SuperUser is one of the highest roles, it can't be given to anyone else using API or Bancho commands, so if you want to transfer
SuperUserto another account, addDEMOTE_SUPERUSER_ON_STARTUP_USE_THIS_IF_SOMEONE_STOLEN_YOUR_SUPERUSER_ACCOUNT=truein the.envfor your environment at startup. It will demote previous user who hadSuperUserand print new secret key in console.Also, all
Developerprivileged commands/actions now requireSuperUserinstead. To this, onlySuperUserwill not be kicked from the server if the maintenance mode will be enabled.This PR should help self-hosters who don't have direct DB access or don't have the knowledge to get initial privileges for the superuser account.