Skip to content

Commit d5bfa7e

Browse files
authored
security: set sticky bits on world-writable directories (#5971)
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
1 parent 67bc6e3 commit d5bfa7e

File tree

6 files changed

+23
-5
lines changed

6 files changed

+23
-5
lines changed

charts/kube-ovn-v2/templates/agent/agent-daemonset.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ spec:
5555
command:
5656
- sh
5757
- -xec
58-
- iptables -V
58+
- |
59+
chmod +t /usr/local/sbin
60+
iptables -V
5961
securityContext:
6062
allowPrivilegeEscalation: true
6163
capabilities:

charts/kube-ovn-v2/templates/ovs-ovn/ovs-ovn-daemonset.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ spec:
6161
- sh
6262
- -xec
6363
- |
64+
chmod +t /usr/local/sbin
6465
chown -R nobody: /var/run/ovn /var/log/ovn /etc/openvswitch /var/run/openvswitch /var/log/openvswitch
6566
iptables -V
6667
{{- if not .Values.ovsOvn.disableModulesManagement }}

charts/kube-ovn/templates/ovncni-ds.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ spec:
3939
command:
4040
- sh
4141
- -xec
42-
- iptables -V
42+
- |
43+
chmod +t /usr/local/sbin
44+
iptables -V
4345
securityContext:
4446
allowPrivilegeEscalation: true
4547
capabilities:

charts/kube-ovn/templates/ovsovn-ds.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ spec:
4848
- sh
4949
- -xec
5050
- |
51+
chmod +t /usr/local/sbin
5152
chown -R nobody: /var/run/ovn /var/log/ovn /etc/openvswitch /var/run/openvswitch /var/log/openvswitch
5253
iptables -V
5354
{{- if not .Values.DISABLE_MODULES_MANAGEMENT }}

dist/images/install.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4300,6 +4300,7 @@ spec:
43004300
- sh
43014301
- -xec
43024302
- |
4303+
chmod +t /usr/local/sbin
43034304
chown -R nobody: /var/run/ovn /var/log/ovn /etc/openvswitch /var/run/openvswitch /var/log/openvswitch
43044305
iptables -V
43054306
/usr/share/openvswitch/scripts/ovs-ctl load-kmod
@@ -4902,7 +4903,9 @@ spec:
49024903
command:
49034904
- sh
49044905
- -xec
4905-
- iptables -V
4906+
- |
4907+
chmod +t /usr/local/sbin
4908+
iptables -V
49064909
securityContext:
49074910
allowPrivilegeEscalation: true
49084911
capabilities:

pkg/controller/vpc_egress_gateway.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,12 @@ func (c *Controller) reconcileVpcEgressGatewayWorkload(gw *kubeovnv1.VpcEgressGa
463463
Name: "init",
464464
Image: image,
465465
ImagePullPolicy: corev1.PullIfNotPresent,
466-
Command: []string{"bash", "/kube-ovn/init-vpc-egress-gateway.sh"},
467-
Env: initEnv,
466+
Command: []string{
467+
"bash",
468+
"-exc",
469+
"chmod +t /usr/local/sbin && bash /kube-ovn/init-vpc-egress-gateway.sh",
470+
},
471+
Env: initEnv,
468472
SecurityContext: &corev1.SecurityContext{
469473
Privileged: ptr.To(true),
470474
},
@@ -491,6 +495,11 @@ func (c *Controller) reconcileVpcEgressGatewayWorkload(gw *kubeovnv1.VpcEgressGa
491495
MountPath: "/usr/local/sbin",
492496
}},
493497
}},
498+
SecurityContext: &corev1.PodSecurityContext{
499+
SeccompProfile: &corev1.SeccompProfile{
500+
Type: corev1.SeccompProfileTypeRuntimeDefault,
501+
},
502+
},
494503
Volumes: []corev1.Volume{{
495504
Name: "usr-local-sbin",
496505
VolumeSource: corev1.VolumeSource{

0 commit comments

Comments
 (0)