Skip to content

Commit

Permalink
disable external redis using acl username auth
Browse files Browse the repository at this point in the history
Signed-off-by: yminer <yminer@vmware.com>
  • Loading branch information
MinerYang committed Jul 5, 2023
1 parent 1efe944 commit 8c46d98
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
2 changes: 0 additions & 2 deletions make/harbor.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ _version: 2.8.0
# # <host_sentinel1>:<port_sentinel1>,<host_sentinel2>:<port_sentinel2>,<host_sentinel3>:<port_sentinel3>
# host: redis:6379
# password:
# # Redis AUTH command was extended in Redis 6, it is possible to use it in the two-arguments AUTH <username> <password> form.
# # username:
# # sentinel_master_set must be set to support redis+sentinel
# #sentinel_master_set:
# # db_index 0 is for core, it's unchangeable
Expand Down
8 changes: 0 additions & 8 deletions make/photon/prepare/migrations/version_2_8_0/harbor.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,6 @@ external_redis:
# <host_sentinel1>:<port_sentinel1>,<host_sentinel2>:<port_sentinel2>,<host_sentinel3>:<port_sentinel3>
host: {{ external_redis.host }}
password: {{ external_redis.password }}
# Redis AUTH command was extended in Redis 6, it is possible to use it in the two-arguments AUTH <username> <password> form.
{% if external_redis.username is defined %}
username: {{ external_redis.username }}
{% else %}
# username:
{% endif %}
# sentinel_master_set must be set to support redis+sentinel
#sentinel_master_set:
# db_index 0 is for core, it's unchangeable
Expand All @@ -411,8 +405,6 @@ external_redis:
# # <host_sentinel1>:<port_sentinel1>,<host_sentinel2>:<port_sentinel2>,<host_sentinel3>:<port_sentinel3>
# host: redis:6379
# password:
# # Redis AUTH command was extended in Redis 6, it is possible to use it in the two-arguments AUTH <username> <password> form.
# # username:
# # sentinel_master_set must be set to support redis+sentinel
# #sentinel_master_set:
# # db_index 0 is for core, it's unchangeable
Expand Down
3 changes: 1 addition & 2 deletions make/photon/prepare/utils/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,8 @@ def get_redis_url(db, redis=None):
kwargs['db_part'] = db and ("/%s" % db) or ""
kwargs['sentinel_part'] = kwargs.get('sentinel_master_set', None) and ("/" + kwargs['sentinel_master_set']) or ''
kwargs['password_part'] = quote(str(kwargs.get('password', None)), safe='') and (':%s@' % quote(str(kwargs['password']), safe='')) or ''
kwargs['username_part'] = kwargs.get('username', None) or ''

return "{scheme}://{username_part}{password_part}{host}{sentinel_part}{db_part}".format(**kwargs) + get_redis_url_param(kwargs)
return "{scheme}://{password_part}{host}{sentinel_part}{db_part}".format(**kwargs) + get_redis_url_param(kwargs)


def get_redis_url_param(redis=None):
Expand Down

0 comments on commit 8c46d98

Please # to comment.