Revert "Add simple master key provider for secret encryption"

This reverts commit d4e84c0433.
This commit is contained in:
Jason Song
2022-12-22 11:45:06 +08:00
parent b54f148164
commit 88e813d1ca
12 changed files with 0 additions and 305 deletions

View File

@ -216,8 +216,6 @@ var (
HMACKey string `ini:"HMAC_KEY"`
Allways bool
}{}
MasterKeyProvider string
MasterKey []byte
// UI settings
UI = struct {
@ -977,19 +975,6 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
PasswordCheckPwn = sec.Key("PASSWORD_CHECK_PWN").MustBool(false)
SuccessfulTokensCacheSize = sec.Key("SUCCESSFUL_TOKENS_CACHE_SIZE").MustInt(20)
// Master key provider configuration
MasterKeyProvider = sec.Key("MASTER_KEY_PROVIDER").MustString("plain")
switch MasterKeyProvider {
case "plain":
tempSalt := []byte{'g', 'i', 't', 'e', 'a'}
MasterKey = []byte(sec.Key("MASTER_KEY").MustString(SecretKey))
MasterKey = pbkdf2.Key(MasterKey, tempSalt, 4096, 32, sha1.New)
case "none":
default:
log.Fatal("invalid master key provider type: %v", MasterKeyProvider)
return
}
InternalToken = loadSecret(sec, "INTERNAL_TOKEN_URI", "INTERNAL_TOKEN")
if InstallLock && InternalToken == "" {
// if Gitea has been installed but the InternalToken hasn't been generated (upgrade from an old release), we should generate