-
Notifications
You must be signed in to change notification settings - Fork 741
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
Update rp_filter only when /proc is write accessible #901
Conversation
pkg/networkutils/network.go
Outdated
if err != nil { | ||
return errors.Wrapf(err, "failed to configure %s RPF check", primaryIntf) | ||
if n.procSys.IsPathWriteAccessible(primaryIntfRPFilter) { | ||
// Setting RPF will be removed from aws-node when we bump our major version. |
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.
Bump "major" or "minor" version? Do you mean v1.7.0?
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 meant when we do 1.7.0
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!
@@ -42,3 +45,8 @@ func (p *procSys) Get(key string) (string, error) { | |||
func (p *procSys) Set(key, value string) error { | |||
return ioutil.WriteFile(p.path(key), []byte(value), 0644) | |||
} | |||
|
|||
// IsPathWriteAccessible verifies if aws-node pod can write to the specified path | |||
func (p *procSys) IsPathWriteAccessible(key string) bool { |
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 encourages TOCTOU (time of check is not time of use) race attacks btw. A more robust pattern is to just attempt the real Set
and see if the error result is "permission denied" (os/error.IsPermission(err)
in golang).
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.
oops looks like I missed this :/ Here TOCTOU is not possible because when aws-node starts up it will either have /proc accessible or not depending on privileged flag. It won't change during the execution. Please correct me if otherwise.
Issue #, if available: #796
Description of changes:
This change is required to remove privileged permission for aws-node pods.
Once this is merged, in the next release we can remove privileged permission for aws-node and perform the operation through init container as described in the Issue link above.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.