Skip to content

Commit

Permalink
Use uint32 pointer for permissions field of `extensionsv1alpha1.F…
Browse files Browse the repository at this point in the history
…ile`
  • Loading branch information
plkokanov committed Nov 19, 2024
1 parent 39d6b92 commit 03ab443
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
10 changes: 5 additions & 5 deletions pkg/webhook/operatingsystemconfig/auditd.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func getAuditConfigFromConfigMap(ctx context.Context, c client.Client, decoder r

return []extensionsv1alpha1.File{{
Path: fmt.Sprintf("%s/%s", constants.AuditRulesFromOSCDir, "00_shoot_rsyslog_relp.rules"),
Permissions: ptr.To(int32(0644)),
Permissions: ptr.To(uint32(0644)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand All @@ -93,7 +93,7 @@ func getDefaultAuditRules() []extensionsv1alpha1.File {
return []extensionsv1alpha1.File{
{
Path: baseConfigRulesPath,
Permissions: ptr.To(int32(0744)),
Permissions: ptr.To(uint32(0744)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand All @@ -103,7 +103,7 @@ func getDefaultAuditRules() []extensionsv1alpha1.File {
},
{
Path: privilegeEscalationRulesPath,
Permissions: ptr.To(int32(0744)),
Permissions: ptr.To(uint32(0744)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand All @@ -113,7 +113,7 @@ func getDefaultAuditRules() []extensionsv1alpha1.File {
},
{
Path: privilegeSpecialRulesPath,
Permissions: ptr.To(int32(0744)),
Permissions: ptr.To(uint32(0744)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand All @@ -123,7 +123,7 @@ func getDefaultAuditRules() []extensionsv1alpha1.File {
},
{
Path: systemIntegrityRulesPath,
Permissions: ptr.To(int32(0744)),
Permissions: ptr.To(uint32(0744)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand Down
24 changes: 12 additions & 12 deletions pkg/webhook/operatingsystemconfig/ensurer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ auditRules: |
expectedFiles = append(expectedFiles, []extensionsv1alpha1.File{
{
Path: "/var/lib/rsyslog-relp-configurator/audit/rules.d/00_shoot_rsyslog_relp.rules",
Permissions: ptr.To(int32(0644)),
Permissions: ptr.To(uint32(0644)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand Down Expand Up @@ -344,7 +344,7 @@ func getAuditRulesFiles(useExpectedContent bool) []extensionsv1alpha1.File {
return []extensionsv1alpha1.File{
{
Path: "/var/lib/rsyslog-relp-configurator/audit/rules.d/00-base-config.rules",
Permissions: ptr.To(int32(0744)),
Permissions: ptr.To(uint32(0744)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand All @@ -354,7 +354,7 @@ func getAuditRulesFiles(useExpectedContent bool) []extensionsv1alpha1.File {
},
{
Path: "/var/lib/rsyslog-relp-configurator/audit/rules.d/10-privilege-escalation.rules",
Permissions: ptr.To(int32(0744)),
Permissions: ptr.To(uint32(0744)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand All @@ -364,7 +364,7 @@ func getAuditRulesFiles(useExpectedContent bool) []extensionsv1alpha1.File {
},
{
Path: "/var/lib/rsyslog-relp-configurator/audit/rules.d/11-privileged-special.rules",
Permissions: ptr.To(int32(0744)),
Permissions: ptr.To(uint32(0744)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand All @@ -374,7 +374,7 @@ func getAuditRulesFiles(useExpectedContent bool) []extensionsv1alpha1.File {
},
{
Path: "/var/lib/rsyslog-relp-configurator/audit/rules.d/12-system-integrity.rules",
Permissions: ptr.To(int32(0744)),
Permissions: ptr.To(uint32(0744)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand All @@ -389,7 +389,7 @@ func getRsyslogFiles(rsyslogConfig []byte, useExpectedContent bool) []extensions
return []extensionsv1alpha1.File{
{
Path: "/var/lib/rsyslog-relp-configurator/rsyslog.d/60-audit.conf",
Permissions: ptr.To(int32(0744)),
Permissions: ptr.To(uint32(0744)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand All @@ -399,7 +399,7 @@ func getRsyslogFiles(rsyslogConfig []byte, useExpectedContent bool) []extensions
},
{
Path: "/var/lib/rsyslog-relp-configurator/configure-rsyslog.sh",
Permissions: ptr.To(int32(0744)),
Permissions: ptr.To(uint32(0744)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand All @@ -409,7 +409,7 @@ func getRsyslogFiles(rsyslogConfig []byte, useExpectedContent bool) []extensions
},
{
Path: "/var/lib/rsyslog-relp-configurator/process-rsyslog-pstats.sh",
Permissions: ptr.To(int32(0744)),
Permissions: ptr.To(uint32(0744)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand All @@ -419,7 +419,7 @@ func getRsyslogFiles(rsyslogConfig []byte, useExpectedContent bool) []extensions
},
{
Path: "/etc/systemd/system/rsyslog.service.d/10-shoot-rsyslog-relp-memory-limits.conf",
Permissions: ptr.To(int32(0644)),
Permissions: ptr.To(uint32(0644)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Data: getBasedOnCondition(useExpectedContent, `[Service]
Expand All @@ -437,7 +437,7 @@ func getRsyslogTLSFiles(useExpectedContent bool) []extensionsv1alpha1.File {
return []extensionsv1alpha1.File{
{
Path: "/var/lib/rsyslog-relp-configurator/tls/ca.crt",
Permissions: ptr.To(int32(0600)),
Permissions: ptr.To(uint32(0600)),
Content: extensionsv1alpha1.FileContent{
SecretRef: &extensionsv1alpha1.FileContentSecretRef{
Name: getBasedOnCondition(useExpectedContent, "ref-rsyslog-tls", "ref-rsyslog-tls-old"),
Expand All @@ -447,7 +447,7 @@ func getRsyslogTLSFiles(useExpectedContent bool) []extensionsv1alpha1.File {
},
{
Path: "/var/lib/rsyslog-relp-configurator/tls/tls.crt",
Permissions: ptr.To(int32(0600)),
Permissions: ptr.To(uint32(0600)),
Content: extensionsv1alpha1.FileContent{
SecretRef: &extensionsv1alpha1.FileContentSecretRef{
Name: getBasedOnCondition(useExpectedContent, "ref-rsyslog-tls", "ref-rsyslog-tls-old"),
Expand All @@ -457,7 +457,7 @@ func getRsyslogTLSFiles(useExpectedContent bool) []extensionsv1alpha1.File {
},
{
Path: "/var/lib/rsyslog-relp-configurator/tls/tls.key",
Permissions: ptr.To(int32(0600)),
Permissions: ptr.To(uint32(0600)),
Content: extensionsv1alpha1.FileContent{
SecretRef: &extensionsv1alpha1.FileContentSecretRef{
Name: getBasedOnCondition(useExpectedContent, "ref-rsyslog-tls", "ref-rsyslog-tls-old"),
Expand Down
14 changes: 7 additions & 7 deletions pkg/webhook/operatingsystemconfig/rsyslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func getRsyslogFiles(rsyslogRelpConfig *rsyslog.RsyslogRelpConfig, cluster *exte
rsyslogFiles = append(rsyslogFiles, []extensionsv1alpha1.File{
{
Path: constants.RsyslogConfigFromOSCPath,
Permissions: ptr.To(int32(0744)),
Permissions: ptr.To(uint32(0744)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand All @@ -125,7 +125,7 @@ func getRsyslogFiles(rsyslogRelpConfig *rsyslog.RsyslogRelpConfig, cluster *exte
},
{
Path: constants.ConfigureRsyslogScriptPath,
Permissions: ptr.To(int32(0744)),
Permissions: ptr.To(uint32(0744)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand All @@ -135,7 +135,7 @@ func getRsyslogFiles(rsyslogRelpConfig *rsyslog.RsyslogRelpConfig, cluster *exte
},
{
Path: constants.ProcessRsyslogPstatsScriptPath,
Permissions: ptr.To(int32(0744)),
Permissions: ptr.To(uint32(0744)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: "b64",
Expand All @@ -145,7 +145,7 @@ func getRsyslogFiles(rsyslogRelpConfig *rsyslog.RsyslogRelpConfig, cluster *exte
},
{
Path: rsyslogServiceMemoryLimitsDropInPath,
Permissions: ptr.To(int32(0644)),
Permissions: ptr.To(uint32(0644)),
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Data: `[Service]
Expand Down Expand Up @@ -227,7 +227,7 @@ func getRsyslogTLSFiles(cluster *extensionscontroller.Cluster, secretRefName str
return []extensionsv1alpha1.File{
{
Path: constants.RsyslogTLSFromOSCDir + "/ca.crt",
Permissions: ptr.To(int32(0600)),
Permissions: ptr.To(uint32(0600)),
Content: extensionsv1alpha1.FileContent{
SecretRef: &extensionsv1alpha1.FileContentSecretRef{
Name: refSecretName,
Expand All @@ -237,7 +237,7 @@ func getRsyslogTLSFiles(cluster *extensionscontroller.Cluster, secretRefName str
},
{
Path: constants.RsyslogTLSFromOSCDir + "/tls.crt",
Permissions: ptr.To(int32(0600)),
Permissions: ptr.To(uint32(0600)),
Content: extensionsv1alpha1.FileContent{
SecretRef: &extensionsv1alpha1.FileContentSecretRef{
Name: refSecretName,
Expand All @@ -247,7 +247,7 @@ func getRsyslogTLSFiles(cluster *extensionscontroller.Cluster, secretRefName str
},
{
Path: constants.RsyslogTLSFromOSCDir + "/tls.key",
Permissions: ptr.To(int32(0600)),
Permissions: ptr.To(uint32(0600)),
Content: extensionsv1alpha1.FileContent{
SecretRef: &extensionsv1alpha1.FileContentSecretRef{
Name: refSecretName,
Expand Down

0 comments on commit 03ab443

Please sign in to comment.