Skip to content

Commit d0bd356

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/snapshot-s3
2 parents 528a559 + 7694293 commit d0bd356

34 files changed

Lines changed: 593 additions & 380 deletions

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ All notable changes to this project will be documented in this file.
66

77
### Added
88

9+
- Allow the configuration of TLS for the HTTP and TRANSPORT ports with the operator ([#55]).
910
- Add the role group as a node attribute ([#63]).
1011
- Allow adding entries to the OpenSearch keystore ([#76]).
1112

13+
[#55]: https://github.com/stackabletech/opensearch-operator/pull/55
1214
[#63]: https://github.com/stackabletech/opensearch-operator/pull/63
1315
[#76]: https://github.com/stackabletech/opensearch-operator/pull/76
1416

deploy/helm/opensearch-operator/crds/crds.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ spec:
3131
clusterConfig:
3232
default:
3333
keystore: []
34+
tls:
35+
internalSecretClass: tls
36+
serverSecretClass: tls
3437
description: Configuration that applies to all roles and role groups
3538
properties:
3639
keystore:
@@ -67,6 +70,36 @@ spec:
6770
- secretKeyRef
6871
type: object
6972
type: array
73+
tls:
74+
default:
75+
internalSecretClass: tls
76+
serverSecretClass: tls
77+
description: TLS configuration options for the server (REST API) and internal communication (transport).
78+
properties:
79+
internalSecretClass:
80+
default: tls
81+
description: |-
82+
Only affects internal communication (transport). Used for mutual verification between OpenSearch nodes.
83+
This setting controls:
84+
- Which cert the servers should use to authenticate themselves against other servers
85+
- Which ca.crt to use when validating the other server
86+
maxLength: 253
87+
minLength: 1
88+
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
89+
type: string
90+
serverSecretClass:
91+
default: tls
92+
description: |-
93+
Only affects client connections to the REST API.
94+
This setting controls:
95+
- If TLS encryption is used at all
96+
- Which cert the servers should use to authenticate themselves against the client
97+
maxLength: 253
98+
minLength: 1
99+
nullable: true
100+
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
101+
type: string
102+
type: object
70103
vectorAggregatorConfigMapName:
71104
description: |-
72105
Name of the Vector aggregator [discovery ConfigMap](https://docs.stackable.tech/home/nightly/concepts/service_discovery).
@@ -340,6 +373,14 @@ spec:
340373
type: string
341374
nullable: true
342375
type: array
376+
requestedSecretLifetime:
377+
description: |-
378+
Request secret (currently only autoTls certificates) lifetime from the secret operator, e.g. `7d`, or `30d`.
379+
This can be shortened by the `maxCertificateLifetime` setting on the SecretClass issuing the TLS certificate.
380+
381+
Defaults to 1d.
382+
nullable: true
383+
type: string
343384
resources:
344385
default:
345386
cpu:
@@ -689,6 +730,14 @@ spec:
689730
type: string
690731
nullable: true
691732
type: array
733+
requestedSecretLifetime:
734+
description: |-
735+
Request secret (currently only autoTls certificates) lifetime from the secret operator, e.g. `7d`, or `30d`.
736+
This can be shortened by the `maxCertificateLifetime` setting on the SecretClass issuing the TLS certificate.
737+
738+
Defaults to 1d.
739+
nullable: true
740+
type: string
692741
resources:
693742
default:
694743
cpu:

docs/modules/opensearch/examples/getting_started/opensearch.yaml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ spec:
1414
opensearch.yml:
1515
plugins.security.allow_default_init_securityindex: "true"
1616
plugins.security.restapi.roles_enabled: all_access
17-
plugins.security.ssl.transport.enabled: "true"
18-
plugins.security.ssl.transport.pemcert_filepath: /stackable/opensearch/config/tls/tls.crt
19-
plugins.security.ssl.transport.pemkey_filepath: /stackable/opensearch/config/tls/tls.key
20-
plugins.security.ssl.transport.pemtrustedcas_filepath: /stackable/opensearch/config/tls/ca.crt
21-
plugins.security.ssl.http.enabled: "true"
22-
plugins.security.ssl.http.pemcert_filepath: /stackable/opensearch/config/tls/tls.crt
23-
plugins.security.ssl.http.pemkey_filepath: /stackable/opensearch/config/tls/tls.key
24-
plugins.security.ssl.http.pemtrustedcas_filepath: /stackable/opensearch/config/tls/ca.crt
2517
podOverrides:
2618
spec:
2719
containers:
@@ -30,25 +22,8 @@ spec:
3022
- name: security-config
3123
mountPath: /stackable/opensearch/config/opensearch-security
3224
readOnly: true
33-
- name: tls
34-
mountPath: /stackable/opensearch/config/tls
35-
readOnly: true
3625
volumes:
3726
- name: security-config
3827
secret:
3928
secretName: opensearch-security-config
4029
defaultMode: 0o660
41-
- name: tls
42-
ephemeral:
43-
volumeClaimTemplate:
44-
metadata:
45-
annotations:
46-
secrets.stackable.tech/class: tls
47-
secrets.stackable.tech/scope: node,pod,service=simple-opensearch,service=simple-opensearch-nodes-default,service=simple-opensearch-nodes-default-headless
48-
spec:
49-
storageClassName: secrets.stackable.tech
50-
accessModes:
51-
- ReadWriteOnce
52-
resources:
53-
requests:
54-
storage: "1"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
= Security
2+
:description: Configure TLS encryption for OpenSearch with the Stackable Operator.
3+
4+
== TLS
5+
6+
The internal and client communication at the REST API can be encrypted with TLS.
7+
This requires the xref:secret-operator:index.adoc[Secret Operator] to be running in the Kubernetes cluster providing certificates.
8+
The used certificates can be changed in a cluster-wide config and are configured using xref:secret-operator:secretclass.adoc[SecretClasses].
9+
TLS encryption on the REST API may be disabled, while it is always enabled for the internal communication between nodes using the `transport` port.
10+
11+
[source,yaml]
12+
----
13+
---
14+
apiVersion: opensearch.stackable.tech/v1alpha1
15+
kind: OpenSearchCluster
16+
metadata:
17+
name: opensearch
18+
spec:
19+
image:
20+
productVersion: 3.1.0
21+
clusterConfig:
22+
tls:
23+
serverSecretClass: tls # <1>
24+
internalSecretClass: opensearch-internal-tls # <2>
25+
nodes:
26+
config:
27+
requestedSecretLifetime: 7d # <3>
28+
roleGroups:
29+
default:
30+
replicas: 3
31+
----
32+
<1> The `spec.clusterConfig.tls.serverSecretClass` refers to the client-to-server encryption at the REST API.
33+
Defaults to the `tls` SecretClass and can be disabled by setting `serverSecretClass` to `null`.
34+
<2> The `spec.clusterConfig.tls.internalSecretClass` refers to the internal encryption between OpenSearch nodes using mTLS (transport).
35+
Defaults to the `tls` SecretClass and can't be disabled.
36+
<3> The lifetime for autoTls certificates generated by the secret operator.
37+
Only a lifetime up to the `maxCertificateLifetime` setting in the SecretClass is applied.
38+
39+
Important: The operator sets the configuration `plugins.security.nodes_dn` to `["CN=generated certificate for pod"]` which provides weak authentication between nodes.
40+
If you want to increase security and use certificates which identify the OpenSearch nodes specifically, you must also adapt the `plugins.security.nodes_dn` setting via configOverrides.

docs/modules/opensearch/partials/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
** xref:opensearch:usage-guide/opensearch-dashboards.adoc[]
1212
** xref:opensearch:usage-guide/scaling.adoc[]
1313
** xref:opensearch:usage-guide/keystore.adoc[]
14+
** xref:opensearch:usage-guide/security.adoc[]
1415
** xref:opensearch:usage-guide/operations/index.adoc[]
1516
*** xref:opensearch:usage-guide/operations/cluster-operations.adoc[]
1617
*** xref:opensearch:usage-guide/operations/pod-placement.adoc[]

rust/operator-binary/src/controller.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ pub struct ValidatedOpenSearchConfig {
134134
pub listener_class: ListenerClassName,
135135
pub logging: ValidatedLogging,
136136
pub node_roles: NodeRoles,
137+
pub requested_secret_lifetime: Duration,
137138
pub resources: OpenSearchNodeResources,
138139
pub termination_grace_period_seconds: i64,
139140
}
@@ -169,6 +170,7 @@ pub struct ValidatedCluster {
169170
pub uid: Uid,
170171
pub role_config: GenericRoleConfig,
171172
pub role_group_configs: BTreeMap<RoleGroupName, OpenSearchRoleGroupConfig>,
173+
pub tls_config: v1alpha1::OpenSearchTls,
172174
pub keystores: Vec<v1alpha1::OpenSearchKeystore>,
173175
}
174176

@@ -182,6 +184,7 @@ impl ValidatedCluster {
182184
uid: impl Into<Uid>,
183185
role_config: GenericRoleConfig,
184186
role_group_configs: BTreeMap<RoleGroupName, OpenSearchRoleGroupConfig>,
187+
tls_config: v1alpha1::OpenSearchTls,
185188
keystores: Vec<v1alpha1::OpenSearchKeystore>,
186189
) -> Self {
187190
let uid = uid.into();
@@ -199,6 +202,7 @@ impl ValidatedCluster {
199202
uid,
200203
role_config,
201204
role_group_configs,
205+
tls_config,
202206
keystores,
203207
}
204208
}
@@ -379,6 +383,7 @@ mod tests {
379383
kvp::LabelValue,
380384
product_logging::spec::AutomaticContainerLogConfig,
381385
role_utils::GenericRoleConfig,
386+
shared::time::Duration,
382387
};
383388
use uuid::uuid;
384389

@@ -504,6 +509,7 @@ mod tests {
504509
),
505510
]
506511
.into(),
512+
v1alpha1::OpenSearchTls::default(),
507513
vec![],
508514
)
509515
}
@@ -524,6 +530,8 @@ mod tests {
524530
vector_container: None,
525531
},
526532
node_roles: NodeRoles(node_roles.to_vec()),
533+
requested_secret_lifetime: Duration::from_str("1d")
534+
.expect("should be a valid duration"),
527535
resources: OpenSearchNodeResources::default(),
528536
termination_grace_period_seconds: 120,
529537
},

rust/operator-binary/src/controller/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ mod tests {
6868
kvp::LabelValue,
6969
product_logging::spec::AutomaticContainerLogConfig,
7070
role_utils::GenericRoleConfig,
71+
shared::time::Duration,
7172
};
7273
use uuid::uuid;
7374

@@ -197,6 +198,7 @@ mod tests {
197198
),
198199
]
199200
.into(),
201+
v1alpha1::OpenSearchTls::default(),
200202
vec![],
201203
)
202204
}
@@ -217,6 +219,8 @@ mod tests {
217219
vector_container: None,
218220
},
219221
node_roles: NodeRoles(node_roles.to_vec()),
222+
requested_secret_lifetime: Duration::from_str("1d")
223+
.expect("should be a valid duration"),
220224
resources: OpenSearchNodeResources::default(),
221225
termination_grace_period_seconds: 120,
222226
},

0 commit comments

Comments
 (0)