-
Notifications
You must be signed in to change notification settings - Fork 94
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
THREESCALE 9308 HeadCrab Vulnerability (Redis) #968
Conversation
Looks like it happens for redis-system:
|
Applied and tested: https://github.com/valerymo/3scale-operator/pull/5/files -
|
TODO - retest Upgrade from 2.14 to PR |
c868d3f
to
91c2d43
Compare
06790dc
to
41b2e03
Compare
pkg/reconcilers/configmap.go
Outdated
|
||
slaveOfString := "rename-command SLAVEOF \"\"" | ||
if !strings.Contains(existingString, slaveOfString) { | ||
newString := existingString + "\n" + slaveOfString |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be:
existingString = existingString + "\n" + <RENAME_COMMAND> in both, REPLICAOF and SLAVEOF.
Otherwise we are going to need 2 reconciles for both to be applied if both are missing.
41b2e03
to
8143ef5
Compare
@@ -515,15 +515,15 @@ spec: | |||
- name: RELATED_IMAGE_SYSTEM_MEMCACHED | |||
value: memcached:1.5 | |||
- name: RELATED_IMAGE_BACKEND_REDIS | |||
value: quay.io/centos7/redis-6-centos7:latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make these changes in another PR, please. They are not related to this PR issue
pkg/3scale/amp/component/redis.go
Outdated
} | ||
} | ||
|
||
func (redis *Redis) buildConfigMapTypeMeta() metav1.TypeMeta { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is my own leftoever, can you please remove it? thnx
pkg/reconcilers/configmap.go
Outdated
|
||
replicaOfString := "rename-command REPLICAOF \"\"" | ||
if !strings.Contains(existingString, replicaOfString) { | ||
newString := existingString + "\n" + replicaOfString |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will leave this up to you. I would not do this. I would not "modify" a file concatenating strings. It's error prone. If the rename-command REPLICAOF \"\"
is not there, the file is invalid and hence, the operator updates it entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the idea was to append to the existing config if not present rather than fully replace it. This allows for a custom configuration to continue. It's not clear from the documentation if edits to the configuration are allowed / supported but we don't prevent a user from doing so, so we can assume at least some customers have done so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM then
e520709
to
77d8642
Compare
77d8642
to
65cef0a
Compare
existing.Data[fieldName] = desired.Data[fieldName] | ||
updated = true | ||
} else { | ||
existingString := existingVal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of interest, what is this doing?
Jira: https://issues.redhat.com/browse/THREESCALE-9308
This PR is recreated from #954, that was closed because of significant changes in master
rename-command REPLICAOF ""
rename-command SLAVEOF ""
rename-command
records removed or not found inredis-config
config map - controller will restore them.Tests Preparation - files
Validation
cd .../3scale-operator and run 3scale installation:
redis-config
ConfigMap has required changes:Expected behavior as in example below
Notes: Internally, within redis system, the
slaveof
andreplicaof
commands will be disabled.So the only way to enable it would be changing the configuration
See next item - that operator is controllilng
redis-config
config map and will restore records that prevening HeadCrab Vulnerability.Check that
redis-config
config map changes are revertedrename-command REPLICAOF ""
or/andrename-command SLAVEOF ""
Check Upgrade
Following validation was done
Create Images/Indexes for master and for branch of PR
Install master ; check that redis-config CM does Not contain rename-command for REPLICAOF and SLAVEOF
Regression testing
PR does not prevent changes to other settings in the reids configuration (not REPLICAOF or SLAVEOF)
Make sure it works as expected:
redis-config
configuration map, edit one or more entries/definitions.redis-config
configuration map and make sure the changes are in place.Wrong formatting of redis configuration
In Redis, if the configuration file (redis.conf) contains a setting with an incorrect name or syntax, Redis will typically treat it as an error. Redis expects the configuration file to be correctly formatted with valid configuration directives.
If there's a typo or an unrecognized setting name in the configuration file, Redis will log an error when starting up. - -- try change one or
rename-command
or other settings name, or add something liketest
inredis-config
config map. Expected behavior: