Skip to content
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

fix: change redis username from redis5 to default #4031

Merged
merged 2 commits into from
May 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions internal/security/secretstore/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,23 +363,23 @@ func (b *Bootstrap) BootstrapHandler(ctx context.Context, _ *sync.WaitGroup, _ s
// Redis 5.x only supports a single shared password. When Redis 6 is released, this can be updated
// to a per service password.

redis5Pair, err := getDBCredential("security-bootstrapper-redis", cred, "redisdb")
redisCredentials, err := getDBCredential("security-bootstrapper-redis", cred, "redisdb")
if err != nil {
if err != errNotFound {
lc.Error("failed to determine if Redis credentials already exist or not: %w", err)
os.Exit(1)
}

lc.Info("Generating new password for Redis DB")
redis5Password, err := cred.GeneratePassword(ctx)
defaultPassword, err := cred.GeneratePassword(ctx)
if err != nil {
lc.Error("failed to generate redis5 password")
lc.Error("failed to generate default password")
os.Exit(1)
}

redis5Pair = UserPasswordPair{
User: "redis5",
Password: redis5Password,
redisCredentials = UserPasswordPair{
User: "default",
Password: defaultPassword,
}
} else {
lc.Info("Redis DB credentials exist, skipping generating new password")
Expand All @@ -400,7 +400,7 @@ func (b *Bootstrap) BootstrapHandler(ctx context.Context, _ *sync.WaitGroup, _ s

// add credentials to service path if specified and they're not already there
if len(service) != 0 {
err = addServiceCredential(lc, "redisdb", cred, service, redis5Pair)
err = addServiceCredential(lc, "redisdb", cred, service, redisCredentials)
if err != nil {
lc.Error(err.Error())
os.Exit(1)
Expand All @@ -410,13 +410,13 @@ func (b *Bootstrap) BootstrapHandler(ctx context.Context, _ *sync.WaitGroup, _ s

// security-bootstrapper-redis uses the path /v1/secret/edgex/security-bootstrapper-redis/ and go-mod-bootstrap
// with append the DB type (redisdb)
err = addDBCredential(lc, "security-bootstrapper-redis", cred, "redisdb", redis5Pair)
err = addDBCredential(lc, "security-bootstrapper-redis", cred, "redisdb", redisCredentials)
if err != nil {
lc.Error(err.Error())
os.Exit(1)
}

err = ConfigureSecureMessageBus(configuration.SecureMessageBus, redis5Pair, lc)
err = ConfigureSecureMessageBus(configuration.SecureMessageBus, redisCredentials, lc)
if err != nil {
lc.Errorf("failed to configure for Secure Message Bus: %s", err.Error())
os.Exit(1)
Expand Down