-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add security field to Dogu-CR and generate SecurityContext #222
base: develop
Are you sure you want to change the base?
Conversation
Still WIP, do not merge |
# Conflicts: # controllers/resource/podSpecBuilder.go
…_context_update_deployment
…_context_update_deployment
…y_context_update_deployment' into feature/221_security_context
@@ -42,6 +47,16 @@ const ( | |||
DoguLabelVersion = "dogu.version" | |||
) | |||
|
|||
// AllCapabilities are all possible values for capabilities. | |||
var AllCapabilities = func() []Capability { |
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 var would fit better in the cesapp-lib
// AppArmorProfile defines a pod or container's AppArmor settings. | ||
// +union | ||
type AppArmorProfile struct { | ||
// type indicates which kind of AppArmor profile will be applied. |
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.
// type indicates which kind of AppArmor profile will be applied. | |
// Type indicates which kind of AppArmor profile will be applied. |
// +unionDiscriminator | ||
Type AppArmorProfileType `json:"type"` | ||
|
||
// localhostProfile indicates a profile loaded on the node that should be used. |
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.
// localhostProfile indicates a profile loaded on the node that should be used. | |
// LocalhostProfile indicates a profile loaded on the node that should be used. |
}{ | ||
{"valid empty", args{&Dogu{}}, assert.NoError}, | ||
{"valid add filled", args{&Dogu{Spec: DoguSpec{Security: Security{Capabilities: Capabilities{Add: []Capability{core.AuditControl}}}}}}, assert.NoError}, | ||
{"valid add filled", args{&Dogu{Spec: DoguSpec{Security: Security{Capabilities: Capabilities{Drop: []Capability{core.AuditControl}}}}}}, assert.NoError}, |
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.
{"valid add filled", args{&Dogu{Spec: DoguSpec{Security: Security{Capabilities: Capabilities{Drop: []Capability{core.AuditControl}}}}}}, assert.NoError}, | |
{"valid drop filled", args{&Dogu{Spec: DoguSpec{Security: Security{Capabilities: Capabilities{Drop: []Capability{core.AuditControl}}}}}}, assert.NoError}, |
seccompProfile := seccompProfile(doguResource.Spec.Security.SeccompProfile) | ||
|
||
readOnlyRootFS := isReadOnlyRootFS(dogu, doguResource) | ||
// We never want those to be true and don't respect the dogu descriptor's privileged flag which is deprecated anyway. |
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.
Nice 👍 This flag was only used by the registrator dogu which is no longer needed.
SecurityContext: &corev1.SecurityContext{ | ||
Capabilities: &corev1.Capabilities{ | ||
Drop: []corev1.Capability{"ALL"}, | ||
Add: []corev1.Capability{"CHOWN"}, |
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 init container also needs DAC_OVERRIDE
.
Resolves #221