Skip to content

Commit 2dd9b8a

Browse files
authored
Owls 91448 - Prevent insecure file system warnings by ensuring files are at a minimum of umask 027 and handle Openshift platform. (#2533) (#2543)
* Prevent insecure file system warnings by ensuring files are at a minimum of umask 027 and handle Openshift platform.
1 parent 78f98fe commit 2dd9b8a

File tree

20 files changed

+139
-13
lines changed

20 files changed

+139
-13
lines changed

documentation/staging/content/faq/security-validation.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@ Warnings may be at the level of the JDK, or that SSL is not enabled. Some warnin
2121
- For Domain in Image, create a new image with the recommended changes or use [configuration overrides]({{< relref "/userguide/managing-domains/configoverrides/_index.md" >}}).
2222

2323
- For Model in Image, supply model files with the recommended changes in its image's `modelHome` directory or use [runtime updates]({{< relref "/userguide/managing-domains/model-in-image/runtime-updates.md" >}}).
24+
25+
{{% notice note %}}
26+
For information about handling file permission warnings on the OpenShift Kubernetes Platform, see the [OpenShift chapter]({{<relref "/security/openshift.md">}}) in the Security section.
27+
{{% /notice %}}
28+

documentation/staging/content/security/openshift.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,6 @@ see [OpenShift]({{<relref "/userguide/platforms/environments#openshift">}}).
116116
#### Using a dedicated namespace
117117

118118
When the user that installs an individual instance of the operator does not have the required privileges to create resources at the Kubernetes cluster level, a dedicated namespace can be used for the operator instance and all the WebLogic domains that it manages. For more details about the `dedicated` setting, please refer to [Operator Helm configuration values]({{< relref "/userguide/managing-operators/using-helm#operator-helm-configuration-values" >}}).
119+
120+
#### Set the Helm chart property `kubernetesPlatorm` to `OpenShift`
121+
Beginning with operator version 3.3.2, set the operator `kubernetesPlatform` Helm chart property to `OpenShift`. This property accommodates OpenShift security requirements. For more information, see [Operator Helm configuration values]({{<relref "/userguide/managing-operators/using-helm#operator-helm-configuration-values">}}).

documentation/staging/content/userguide/managing-operators/using-helm.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@ Example:
9696
javaLoggingLevel: "FINE"
9797
```
9898

99+
##### `kubernetesPlatform`
100+
Specify the Kubernetes platform on which the operator is running. This setting has no default, the only valid value is OpenShift, and the setting should be left unset for other platforms. When set to `OpenShift`, the operator:
101+
- Sets the domain home file permissions in each WebLogic Server pod to work correctly in OpenShift for [Model in Image]({{< relref "/samples/domains/model-in-image/_index.md" >}}), and [Domain home in Image]({{< relref "/samples/domains/domain-home-in-image/_index.md" >}}) domains. Specifically, it sets file group permissions so that they match file user permissions.
102+
- Sets the `weblogic.SecureMode.WarnOnInsecureFileSystem` Java system property to `false` on the command line of each WebLogic Server. This flag suppresses insecure file system warnings reported in the WebLogic Server console when the WebLogic Server is in production mode. These warnings result from setting the file permissions necessary to work with restricted security context constraints on OpenShift.
103+
104+
For more information about the security requirements for running WebLogic in OpenShift, see the [OpenShift chapter]({{<relref "/security/openshift.md">}}) in the Security section.
105+
106+
Example:
107+
```yaml
108+
kubernetesPlatform: OpenShift
109+
```
99110
#### Creating the operator pod
100111

101112
##### `image`

documentation/staging/content/userguide/platforms/environments.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ Operator 2.0.1+ is certified for use on OpenShift Container Platform 3.11.43+, w
6262

6363
Operator 2.5.0+ is certified for use on OpenShift Container Platform 4.3.0+ with Kubernetes 1.16.2+.
6464

65-
When using the operator in OpenShift, a security context constraint is required to ensure that WebLogic containers run with a UNIX UID that has the correct permissions on the domain file system.
66-
This could be either the `anyuid` SCC or a custom one that you define for user/group `1000`. For more information, see [OpenShift]({{<relref "/security/openshift.md">}}) in the Security section.
65+
To accommodate OpenShift security requirements:
66+
- For security requirements to run WebLogic in OpenShift, see the [OpenShift chapter]({{<relref "/security/openshift.md">}}) in the Security section.
67+
- Beginning with operator version 3.3.2, specify the `kubernetesPlatorm` Helm chart property with value `OpenShift`. For more information, see [Operator Helm configuration values]({{<relref "/userguide/managing-operators/using-helm#operator-helm-configuration-values">}}).
6768

6869
### Important note about development-focused Kubernetes distributions
6970

kubernetes/charts/weblogic-operator/templates/_operator-cm.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ data:
4949
{{- if .tokenReviewAuthentication }}
5050
tokenReviewAuthentication: {{ .tokenReviewAuthentication | quote }}
5151
{{- end }}
52+
{{- if .kubernetesPlatform }}
53+
kubernetesPlatform: {{ .kubernetesPlatform | quote }}
54+
{{- end }}
5255
kind: "ConfigMap"
5356
metadata:
5457
labels:

kubernetes/charts/weblogic-operator/templates/_operator-dep.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ spec:
6464
value: "false"
6565
- name: "JAVA_LOGGING_LEVEL"
6666
value: {{ .javaLoggingLevel | quote }}
67+
- name: "KUBERNETES_PLATFORM"
68+
value: {{ .kubernetesPlatform | quote }}
6769
- name: "JAVA_LOGGING_MAXSIZE"
6870
value: {{ .javaLoggingFileSizeLimit | default 20000000 | quote }}
6971
- name: "JAVA_LOGGING_COUNT"

operator/src/main/java/oracle/kubernetes/operator/TuningParameters.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ static TuningParameters getInstance() {
3333

3434
FeatureGates getFeatureGates();
3535

36+
String getKubernetesPlatform();
37+
3638
class MainTuning {
3739
public final int initializationRetryDelaySeconds;
3840
public final int domainPresenceFailureRetrySeconds;

operator/src/main/java/oracle/kubernetes/operator/TuningParametersImpl.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import oracle.kubernetes.operator.logging.LoggingFactory;
1717
import oracle.kubernetes.operator.logging.MessageKeys;
1818

19+
import static oracle.kubernetes.operator.helpers.BasePodStepContext.KUBERNETES_PLATFORM_HELM_VARIABLE;
20+
1921
public class TuningParametersImpl extends ConfigMapConsumer implements TuningParameters {
2022
public static final int DEFAULT_CALL_LIMIT = 50;
2123

@@ -28,6 +30,7 @@ public class TuningParametersImpl extends ConfigMapConsumer implements TuningPar
2830
private WatchTuning watch = null;
2931
private PodTuning pod = null;
3032
private FeatureGates featureGates = null;
33+
private String kubernetesPlatform = null;
3134

3235
private TuningParametersImpl(ScheduledExecutorService executorService) {
3336
super(executorService);
@@ -95,6 +98,8 @@ private void update() {
9598
FeatureGates featureGates =
9699
new FeatureGates(generateFeatureGates(get("featureGates")));
97100

101+
String kubernetesPlatform = get(KUBERNETES_PLATFORM_HELM_VARIABLE);
102+
98103
lock.writeLock().lock();
99104
try {
100105
if (!main.equals(this.main)
@@ -109,6 +114,7 @@ private void update() {
109114
this.watch = watch;
110115
this.pod = pod;
111116
this.featureGates = featureGates;
117+
this.kubernetesPlatform = kubernetesPlatform;
112118
} finally {
113119
lock.writeLock().unlock();
114120
}
@@ -175,4 +181,14 @@ public FeatureGates getFeatureGates() {
175181
lock.readLock().unlock();
176182
}
177183
}
184+
185+
@Override
186+
public String getKubernetesPlatform() {
187+
lock.readLock().lock();
188+
try {
189+
return kubernetesPlatform;
190+
} finally {
191+
lock.readLock().unlock();
192+
}
193+
}
178194
}

operator/src/main/java/oracle/kubernetes/operator/helpers/BasePodStepContext.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939

4040
public abstract class BasePodStepContext extends StepContextBase {
4141

42+
public static final String KUBERNETES_PLATFORM_HELM_VARIABLE = "kubernetesPlatform";
43+
4244
BasePodStepContext(DomainPresenceInfo info) {
4345
super(info);
4446
}

operator/src/main/java/oracle/kubernetes/operator/helpers/JobHelper.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ List<V1EnvVar> getConfiguredEnvVars(TuningParameters tuningParameters) {
325325
addEnvVar(vars, IntrospectorJobEnvVars.ISTIO_ENABLED, Boolean.toString(isIstioEnabled()));
326326
addEnvVar(vars, IntrospectorJobEnvVars.ADMIN_CHANNEL_PORT_FORWARDING_ENABLED,
327327
Boolean.toString(isAdminChannelPortForwardingEnabled(getDomain().getSpec())));
328+
Optional.ofNullable(getKubernetesPlatform(tuningParameters))
329+
.ifPresent(v -> addEnvVar(vars, ServerEnvVars.KUBERNETES_PLATFORM, v));
330+
328331
addEnvVar(vars, IntrospectorJobEnvVars.ISTIO_READINESS_PORT, Integer.toString(getIstioReadinessPort()));
329332
addEnvVar(vars, IntrospectorJobEnvVars.ISTIO_POD_NAMESPACE, getNamespace());
330333
if (isUseOnlineUpdate()) {
@@ -391,6 +394,10 @@ List<V1EnvVar> getConfiguredEnvVars(TuningParameters tuningParameters) {
391394
return vars;
392395
}
393396

397+
private String getKubernetesPlatform(TuningParameters tuningParameters) {
398+
return tuningParameters.getKubernetesPlatform();
399+
}
400+
394401
}
395402

396403
static class DomainIntrospectorJobStep extends Step {

0 commit comments

Comments
 (0)