-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: TLS support #55
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
base: main
Are you sure you want to change the base?
Changes from all commits
d45f8fb
c489b44
ffa0585
aaa560f
4d7496c
7f805b8
c6db525
1c3e672
bbbdbb6
1aeb4db
ab42f5a
97681a3
815d243
95986a5
910a58d
9252b06
beb2aff
383e358
25745d1
bcb5542
8257b95
bd86ebc
36120a8
0294f91
cb97dee
7c6e1d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is not referenced in nav.adoc. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||||
| = Security | ||||||
| :description: Configure TLS encryption, authentication, and Open Policy Agent (OPA) authorization for Kafka with the Stackable Operator. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is OpenSearch, not Kafka. |
||||||
|
|
||||||
| == TLS | ||||||
|
|
||||||
| The internal and client communication at the REST API can be encrypted with TLS. This requires the xref:secret-operator:index.adoc[Secret Operator] to be running in the Kubernetes cluster providing certificates. | ||||||
| The used certificates can be changed in a cluster-wide config. TLS encryption on the REST API may be disabled, while it is always enabled for the internal communication between nodes using the `transport` port. | ||||||
|
Comment on lines
+6
to
+7
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Write a single sentence per line. see https://docs.stackable.tech/home/stable/contributor/docs/style-guide/#_highlights Please adapt the whole document. |
||||||
|
|
||||||
| [source,yaml] | ||||||
| ---- | ||||||
| --- | ||||||
| apiVersion: opensearch.stackable.tech/v1alpha1 | ||||||
| kind: OpenSearchCluster | ||||||
| metadata: | ||||||
| name: opensearch | ||||||
| spec: | ||||||
| image: | ||||||
| productVersion: 3.1.0 | ||||||
| clusterConfig: | ||||||
| tls: | ||||||
| serverSecretClass: tls # <1> | ||||||
| internalSecretClass: opensearch-internal-tls # <2> | ||||||
| nodes: | ||||||
| config: | ||||||
| requestedSecretLifetime: 7d # <3> | ||||||
| roleGroups: | ||||||
| default: | ||||||
| replicas: 3 | ||||||
| ---- | ||||||
| <1> The `spec.clusterConfig.tls.serverSecretClass` refers to the client-to-server encryption at the REST API. Defaults to the `tls` SecretClass and can be disabled by setting `serverSecretClass` to `null`. | ||||||
| <2> The `spec.clusterConfig.tls.internalSecretClass` refers to the internal encryption between OpenSearch nodes using mTLS (transport). Defaults to the `tls` SecretClass` and can't be disabled. | ||||||
| <3> The lifetime for autoTls certificates generated by the secret operator. | ||||||
| Only a lifetime up to the `maxCertificateLifetime` setting in the SecretClass is applied. | ||||||
|
|
||||||
| The `tls` secret is deployed from the xref:secret-operator:index.adoc[Secret Operator] and looks like this: | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| [source,yaml] | ||||||
| ---- | ||||||
| --- | ||||||
| apiVersion: secrets.stackable.tech/v1alpha1 | ||||||
| kind: SecretClass | ||||||
| metadata: | ||||||
| name: tls | ||||||
| spec: | ||||||
| backend: | ||||||
| autoTls: | ||||||
| ca: | ||||||
| secret: | ||||||
| name: secret-provisioner-tls-ca | ||||||
| namespace: default | ||||||
| autoGenerate: true | ||||||
| maxCertificateLifetime: 15d | ||||||
| ---- | ||||||
|
|
||||||
| You can create your own secrets and reference them e.g. in the `spec.clusterConfig.tls.serverSecretClass` or `spec.clusterConfig.tls.internalSecretClass` to use different certificates. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You cannot just reference the secrets. You have to create a SecretClass which references them and then use the SecretClass in the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is important to mention that the operator sets |
||||||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -30,7 +30,7 @@ use validate::validate; | |||||||||||
| use crate::{ | ||||||||||||
| crd::{ | ||||||||||||
| NodeRoles, | ||||||||||||
| v1alpha1::{self}, | ||||||||||||
| v1alpha1::{self, OpenSearchTls}, | ||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| }, | ||||||||||||
| framework::{ | ||||||||||||
| ClusterName, ControllerName, HasName, HasUid, ListenerClassName, NameIsValidLabelValue, | ||||||||||||
|
|
@@ -131,6 +131,7 @@ pub struct ValidatedOpenSearchConfig { | |||||||||||
| pub listener_class: ListenerClassName, | ||||||||||||
| pub logging: ValidatedLogging, | ||||||||||||
| pub node_roles: NodeRoles, | ||||||||||||
| pub requested_secret_lifetime: Duration, | ||||||||||||
| pub resources: OpenSearchNodeResources, | ||||||||||||
| pub termination_grace_period_seconds: i64, | ||||||||||||
| } | ||||||||||||
|
|
@@ -166,9 +167,11 @@ pub struct ValidatedCluster { | |||||||||||
| pub uid: Uid, | ||||||||||||
| pub role_config: GenericRoleConfig, | ||||||||||||
| pub role_group_configs: BTreeMap<RoleGroupName, OpenSearchRoleGroupConfig>, | ||||||||||||
| pub tls_config: OpenSearchTls, | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| impl ValidatedCluster { | ||||||||||||
| #[allow(clippy::too_many_arguments)] | ||||||||||||
| pub fn new( | ||||||||||||
| image: ResolvedProductImage, | ||||||||||||
| product_version: ProductVersion, | ||||||||||||
|
|
@@ -177,6 +180,7 @@ impl ValidatedCluster { | |||||||||||
| uid: impl Into<Uid>, | ||||||||||||
| role_config: GenericRoleConfig, | ||||||||||||
| role_group_configs: BTreeMap<RoleGroupName, OpenSearchRoleGroupConfig>, | ||||||||||||
| tls_config: OpenSearchTls, | ||||||||||||
| ) -> Self { | ||||||||||||
| let uid = uid.into(); | ||||||||||||
| ValidatedCluster { | ||||||||||||
|
|
@@ -193,6 +197,7 @@ impl ValidatedCluster { | |||||||||||
| uid, | ||||||||||||
| role_config, | ||||||||||||
| role_group_configs, | ||||||||||||
| tls_config, | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
|
@@ -372,13 +377,17 @@ mod tests { | |||||||||||
| kvp::LabelValue, | ||||||||||||
| product_logging::spec::AutomaticContainerLogConfig, | ||||||||||||
| role_utils::GenericRoleConfig, | ||||||||||||
| shared::time::Duration, | ||||||||||||
| }; | ||||||||||||
| use uuid::uuid; | ||||||||||||
|
|
||||||||||||
| use super::{Context, OpenSearchRoleGroupConfig, ValidatedCluster, ValidatedLogging}; | ||||||||||||
| use crate::{ | ||||||||||||
| controller::{OpenSearchNodeResources, ValidatedOpenSearchConfig}, | ||||||||||||
| crd::{NodeRoles, v1alpha1}, | ||||||||||||
| crd::{ | ||||||||||||
| NodeRoles, | ||||||||||||
| v1alpha1::{self, OpenSearchTls}, | ||||||||||||
| }, | ||||||||||||
|
Comment on lines
+387
to
+390
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| framework::{ | ||||||||||||
| ClusterName, ListenerClassName, NamespaceName, OperatorName, ProductVersion, | ||||||||||||
| RoleGroupName, builder::pod::container::EnvVarSet, | ||||||||||||
|
|
@@ -494,6 +503,7 @@ mod tests { | |||||||||||
| ), | ||||||||||||
| ] | ||||||||||||
| .into(), | ||||||||||||
| OpenSearchTls::default(), | ||||||||||||
| ) | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
|
@@ -513,6 +523,8 @@ mod tests { | |||||||||||
| vector_container: None, | ||||||||||||
| }, | ||||||||||||
| node_roles: NodeRoles(node_roles.to_vec()), | ||||||||||||
| requested_secret_lifetime: Duration::from_str("1d") | ||||||||||||
| .expect("should be a valid duration"), | ||||||||||||
| resources: OpenSearchNodeResources::default(), | ||||||||||||
| termination_grace_period_seconds: 120, | ||||||||||||
| }, | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -68,6 +68,7 @@ mod tests { | |||||||||||
| kvp::LabelValue, | ||||||||||||
| product_logging::spec::AutomaticContainerLogConfig, | ||||||||||||
| role_utils::GenericRoleConfig, | ||||||||||||
| shared::time::Duration, | ||||||||||||
| }; | ||||||||||||
| use uuid::uuid; | ||||||||||||
|
|
||||||||||||
|
|
@@ -77,7 +78,10 @@ mod tests { | |||||||||||
| ContextNames, OpenSearchNodeResources, OpenSearchRoleGroupConfig, ValidatedCluster, | ||||||||||||
| ValidatedContainerLogConfigChoice, ValidatedLogging, ValidatedOpenSearchConfig, | ||||||||||||
| }, | ||||||||||||
| crd::{NodeRoles, v1alpha1}, | ||||||||||||
| crd::{ | ||||||||||||
| NodeRoles, | ||||||||||||
| v1alpha1::{self, OpenSearchTls}, | ||||||||||||
| }, | ||||||||||||
|
Comment on lines
+81
to
+84
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| framework::{ | ||||||||||||
| ClusterName, ControllerName, ListenerClassName, NamespaceName, OperatorName, | ||||||||||||
| ProductName, ProductVersion, RoleGroupName, builder::pod::container::EnvVarSet, | ||||||||||||
|
|
@@ -191,6 +195,7 @@ mod tests { | |||||||||||
| ), | ||||||||||||
| ] | ||||||||||||
| .into(), | ||||||||||||
| OpenSearchTls::default(), | ||||||||||||
| ) | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
|
@@ -210,6 +215,8 @@ mod tests { | |||||||||||
| vector_container: None, | ||||||||||||
| }, | ||||||||||||
| node_roles: NodeRoles(node_roles.to_vec()), | ||||||||||||
| requested_secret_lifetime: Duration::from_str("1d") | ||||||||||||
| .expect("should be a valid duration"), | ||||||||||||
| resources: OpenSearchNodeResources::default(), | ||||||||||||
| termination_grace_period_seconds: 120, | ||||||||||||
| }, | ||||||||||||
|
|
||||||||||||
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.