-
Notifications
You must be signed in to change notification settings - Fork 332
TLS connections to Cassandra #3587
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
Merged
Merged
Changes from all commits
Commits
Show all changes
98 commits
Select commit
Hold shift + click to select a range
63d45f1
Add option to configure TLS connections to Cassandra in schema-migrat…
supersven 313ad58
WIP: Cassandra SSL in spar
supersven 094c33d
Cassandra SSL in brig
supersven b04c80c
Cassandra SSL for galley
supersven 494e1f3
Add some TODOs
supersven 9d53612
Configure C* TLS in more places
supersven be94e10
Add option to enable TLS to more C* inits
supersven 88d79c6
Set vpFailIfNoPeerCert
supersven 64ad952
WIP: Scratch out TLS/C* in service Helm charts
supersven b76a345
Some Helm fixes
supersven e777a8e
Fix useTLS in Helm charts
supersven 86fcb92
Default to no cert in brig-index
supersven 6d63b84
Fix: If cert is not set, use Nothing not empty string
supersven 39e4051
WIP: Teach cassandra-migrations TLS
supersven a1d5b89
GHC option -threaded for brig-schema and galley-schema
supersven 0156d04
k8ssandra-test: Add client encryption options
supersven 3d4251c
More Helming...
supersven a01386a
Helming SSL support for the check-cluster-job
supersven 1ec0d60
check-cluster-job: Fix cqlsh command line args
supersven 449f06c
Fix cassandra-secret yaml files (wrong context)
supersven 85bf11d
brig: Add some debug logs for TLS cert file path
supersven 47e7efa
Make galley-migrate-data -threaded
supersven 480a5db
Happy Helming
supersven 4d63cd3
Formatting
supersven 3c0e036
spar-data-migrate: Get the TLS cert file per target database
supersven 2f429c0
Happy helming: Give spar-migrate-data access to certs for both cassan…
supersven 471dc48
Happy helming: Fix check-cluster-job
supersven 9fb06a9
Delete trace logs
supersven 3cbf8b2
Provide one function to create C* connections for services
supersven 68a84bb
Use defInitCassandra to reduce duplication
supersven a22f268
Use defInitCassandra; reduce duplication
supersven 9a319a1
Use defInitCassandra
supersven 7d0813d
use defInitCassandra to reduce duplication
supersven 52a1678
Refactor to use one way to create the SSLContext
supersven e8af935
--use-tls is gone
supersven 4d6d8e8
Remove --use-tls from Helm charts
supersven b4808b5
Remove useTLS from test config files
supersven b7305a2
Remove useTLS from Helm charts
supersven 0d018e3
Re-generate nix files
supersven 5c8a926
Cleanup
supersven 8c8551b
Cleaup: Delete obsolete option from values
supersven d1613a6
Remove Debug.Trace
supersven c61cfe0
Federator's HTTP SSL does not belong to the C* story
supersven edd806e
Add changelog
supersven 6e2dd1c
setMaxStreams isn't needed
supersven ceb0e8f
Use common Helm structure to set certs
supersven 7666a3b
Rename tlsCert -> tlsCa
supersven 6c020ae
Take the CA string unencoded
supersven 64ba281
Let K8ssandra create the Java KeysStores
supersven c86ffe7
Accept empty tlsCa
supersven c9305c3
Generate key pair in K8s as Secret
supersven 68b90b6
Fix secret handling in case a CA PEM string is provided
supersven 70950ad
Add debug trace logs for SSL cert / integration
supersven e13319e
Helm: Cassandra SSL for integration tests
supersven 2283d87
Debug log in integration-integration.yaml
supersven bf8a5cd
Helm: Ensure integration has cassandra certs
supersven dd94bc3
integration-tests: Deploy TLS secured cassandra
supersven bf64d06
Clean up debug tracing: set -x
supersven d007819
Replace trace logs with print statements
supersven c684cf0
Add documentation
supersven 12251e7
More docs
supersven 0ad93e6
Remove self-signed cert from test setup
supersven 169e016
Deal with strange Helm value punning
supersven 05badb2
Provide environments for integration testing
supersven 7fb9f58
Consider profile when destorying the Helmfile env
supersven 24bd91d
Hi CI
supersven ee094de
Improve changelog
supersven 82b5e7e
Better name: useCassandraCA -> useCassandraTLS
supersven 3cca3e7
Add comments
supersven b0859dc
Add comments about cassandra secrets
supersven cfc3e71
Unify comments about TLS in values.yaml(s)
supersven fe39cff
cassandra-migrations: Specific config wins over general one
supersven cd6ddbc
Typo
supersven 43ce742
Useless formatting
supersven 4b5fe84
Fix wrong secret reference
supersven cddd925
Better TLS comment
supersven dc58869
Better comment
supersven f818180
Requiring the databases-ephemeral should be fine
supersven afb253b
Cleanup
supersven b942703
Hi CI
supersven e1778bc
Update charts/elasticsearch-index/templates/migrate-data.yaml
supersven 801603a
Update charts/integration/templates/integration-integration.yaml
supersven b32027d
Rename: tls-certificate-file -> tls-ca-certificate-file
supersven ac26d93
Simplify certFilePath selection expression
supersven d3e0446
Default cannot be shown for option --tls-ca-certificate-file
supersven eba57b5
Update docs/src/developer/reference/config-options.md
supersven 124cd3c
Fix missing import for `for`
supersven 3a5313a
Move Cassandra Options
supersven dde9690
Use CassandraOpts to hand over connection parameters
supersven a2ac6e0
More descriptive variable name
supersven b0f94b9
Avoid type annotations by using monomorphic print function
supersven a4e898b
Remove superfluous log line
supersven cc10ae3
Cleanup --replication-factor expression
supersven 10a7d4a
Allow newline to prevent negative wrapping
supersven a436d1e
New line to guard against line concatenating
supersven 765ebc1
Use trust-manager to sync TLS CA secret
supersven a826252
Typo
supersven 54489cd
Simplify name of trust-manager sync'ed secret
supersven File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Allow the configuration of TLS-secured connections to Cassandra. TLS is used | ||
| when a certificate is provided. This is either done with | ||
| `--tls-ca-certificate-file` for cli commands or the configuration attribute | ||
| `cassandra.tlsCa` for services. In Helm charts, the certificate is provided as | ||
| literal PEM string; either as attribute `cassandra.tlsCa` (analog to service | ||
| configuration) or by a reference to a secret (`cassandra.tlsCaSecretRef`.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| {{/* Secret for the provided Cassandra TLS CA. */}} | ||
| {{- if not (empty .Values.config.cassandra.tlsCa) }} | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: brig-cassandra | ||
| labels: | ||
| app: brig | ||
| chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
| release: "{{ .Release.Name }}" | ||
| heritage: "{{ .Release.Service }}" | ||
| type: Opaque | ||
| data: | ||
| ca.pem: {{ .Values.config.cassandra.tlsCa | b64enc | quote }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
charts/cassandra-migrations/templates/cassandra-certs.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| {{- if ne (trim (include "tlsCaBrig" .)) "" }} | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: brig-cassandra-cert | ||
| labels: | ||
| app: cassandra-migrations | ||
| chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
| release: "{{ .Release.Name }}" | ||
| heritage: "{{ .Release.Service }}" | ||
| annotations: | ||
| "helm.sh/hook": pre-install,pre-upgrade,post-install,post-upgrade | ||
| "helm.sh/hook-weight": "0" | ||
| "helm.sh/hook-delete-policy": hook-succeeded,hook-failed | ||
| type: Opaque | ||
| data: | ||
| ca.pem: {{ include "tlsCaBrig" . | b64enc | quote }} | ||
| {{- end}} | ||
| {{- if ne (trim (include "tlsCaGalley" .)) "" }} | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: galley-cassandra-cert | ||
| labels: | ||
| app: cassandra-migrations | ||
| chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
| release: "{{ .Release.Name }}" | ||
| heritage: "{{ .Release.Service }}" | ||
| annotations: | ||
| "helm.sh/hook": pre-install,pre-upgrade,post-install,post-upgrade | ||
| "helm.sh/hook-weight": "0" | ||
| "helm.sh/hook-delete-policy": hook-succeeded,hook-failed | ||
| type: Opaque | ||
| data: | ||
| ca.pem: {{ include "tlsCaGalley" . | b64enc | quote }} | ||
| {{- end}} | ||
| {{- if ne (trim (include "tlsCaGundeck" .)) "" }} | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: gundeck-cassandra-cert | ||
| labels: | ||
| app: cassandra-migrations | ||
| chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
| release: "{{ .Release.Name }}" | ||
| heritage: "{{ .Release.Service }}" | ||
| annotations: | ||
| "helm.sh/hook": pre-install,pre-upgrade | ||
| "helm.sh/hook-weight": "0" | ||
| "helm.sh/hook-delete-policy": hook-succeeded,hook-failed | ||
| type: Opaque | ||
| data: | ||
| ca.pem: {{ include "tlsCaGundeck" . | b64enc | quote }} | ||
| {{- end}} | ||
| {{- if ne (trim (include "tlsCaSpar" .)) "" }} | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: spar-cassandra-cert | ||
| labels: | ||
| app: cassandra-migrations | ||
| chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
| release: "{{ .Release.Name }}" | ||
| heritage: "{{ .Release.Service }}" | ||
| annotations: | ||
| "helm.sh/hook": pre-install,pre-upgrade,post-install,post-upgrade | ||
| "helm.sh/hook-weight": "0" | ||
| "helm.sh/hook-delete-policy": hook-succeeded,hook-failed | ||
| type: Opaque | ||
| data: | ||
| ca.pem: {{ include "tlsCaSpar" . | b64enc | quote }} | ||
| {{- end}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why do we use a secret here? We should only ever mount the public key of the CA in brig right?
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.
I had two cases in mind when I wrote this:
An example how the secret for option 2 is created is here: https://github.com/wireapp/wire-server/pull/3587/files#diff-cfb107a0e0fc7fa1bc14d95f399d0fbba15b1a7689d2d2785056ac2cb9bd2851R9
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.
I think the secret created by the cert-manager will contain the private key of the CA. I would say it shouldn't be available to any of the haskell services.
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.
I've now addressed this concern in: cf27c38
Now we can use
trust-managerto create and synchronize a secret that contains only the CA certificate and not the private key(s).