Skip to content

Commit

Permalink
add support for TLS redis connection (#2308)
Browse files Browse the repository at this point in the history
  • Loading branch information
finchr authored Sep 17, 2024
1 parent 57b8ebc commit f4ee9f3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions deepfence_server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ COPY deepfence_server/entrypoint.sh /entrypoint.sh
RUN apt update && \
apt install -y \
bash \
ca-certificates \
curl \
wget \
netcat-traditional \
Expand Down
2 changes: 2 additions & 0 deletions deepfence_utils/directory/directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,12 @@ func initRedis() RedisConfig {
redisDBNumber = 0
}
}
redisTLSConfig := os.Getenv("DEEPFENCE_REDIS_TLS")
return RedisConfig{
Endpoint: redisEndpoint,
Password: redisPassword,
Database: redisDBNumber,
TLSConfig: redisTLSConfig,
}
}

Expand Down
5 changes: 5 additions & 0 deletions deepfence_utils/directory/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ func newRedisClient(endpoints DBConfigs) (*redis.Client, error) {
if endpoints.Redis.Password != "" {
redisOptions.Password = endpoints.Redis.Password
}
if endpoints.Redis.TLSConfig != "" {
redisOptions.TLSConfig = &tls.Config{
MinVersion: tls.VersionTLS12,
}
}
return redis.NewClient(redisOptions), nil
}

Expand Down

0 comments on commit f4ee9f3

Please sign in to comment.