Skip to content

Fix TLS setup between SM and SM DB - #4801

Merged
Michal-Leszczynski merged 7 commits into
masterfrom
ml/1187-sm-db-tls
Mar 30, 2026
Merged

Fix TLS setup between SM and SM DB#4801
Michal-Leszczynski merged 7 commits into
masterfrom
ml/1187-sm-db-tls

Conversation

@Michal-Leszczynski

@Michal-Leszczynski Michal-Leszczynski commented Mar 25, 2026

Copy link
Copy Markdown
Collaborator

This PR:

  • configures SM DB with TLS certs when SSL_ENABLED=true is specified
  • fixes the wrong SM DB port usage on SM server startup
  • extends test Scylla TLS certs generation and adds proper host validation for SM DB
  • adds make run-server to CI so that simple errors like that are automatically caught

This PR extends db.cert with IP SANs for:

  • SM DB
  • first cluster nodes
  • second cluster nodes
    As all of those nodes use the same db.crt. In theory, SM doesn't validate first/second cluster nodes TLS certs, so their IPs are not needed there, but we plan to do it in the near future, so this is a preparation set towards that. It also aligns generation/usage of db.crt across all scylla nodes, which is nice.
    This also fixes one additional issue that we had in our SSL_ENABLED=true test env for a long time - it wasn't possible to connect to first/second cluster with cqlsh, as our cqlshrc config does validate scylla TLS certs. This was not needed for any CI tests, but was annoying when debugging manually/with AI on a local test dev env.

Fixes https://scylladb.atlassian.net/browse/CLOUD-1187

@Michal-Leszczynski
Michal-Leszczynski force-pushed the ml/1187-sm-db-tls branch 3 times, most recently from b5364ae to 4ff684a Compare March 26, 2026 15:18
@Michal-Leszczynski Michal-Leszczynski changed the title WIP: sm db tls Fix TLS setup between SM and SM DB Mar 26, 2026
@github-actions github-actions Bot added the P2 label Mar 26, 2026
@Michal-Leszczynski
Michal-Leszczynski force-pushed the ml/1187-sm-db-tls branch 2 times, most recently from 81a5b3a to 1e77961 Compare March 26, 2026 16:34
Before this commit, SSL_ENABLED test env var controlled just
the managed clusters TLS setup. This commit makes it so it
also controls SM DB TLS setup. All Scylla clusters use the
same TLS certs for simplicity. Since TLS setup is controlled
with SM DB and SM yaml configs, SM DB config is now generated
in the same way as other Scylla configs were generated (using
base file and modyfing it according to env vars). On the other
hand, since SM config is small enough, it is still hardcoded.

Additionally, this commit wraps IP addresses in SM config in
quotes to ensure their correct parsing.
This was missed in the past, as our CI does not run SM
DB discovery and configuration as in the prod env.
Even though main the TLS CQL connection established by SM
later on worked fine, SM startup used to fail when SM DB
TLS port was not configured as the hardcoded 9042.

Fixes https://scylladb.atlassian.net/browse/CLOUD-1187
Scylla TLS certs were not previously validated in
our test env as we didn't generate Scylla TLS certs
with proper SANs to verify. This commit adds the IPs
(from all clusters and minio with all IP families)
entries to DB TLS certs SANs extensions.
Even though the CA extensions used to allow CA to sign
TLS certs were defined in its config, they were ignored
by default. This commit fixes that by specifying them in
the CA TLS cert creation cmd.
This commit makes it so make run-server can be used to validate
that SM server started correctly.
This commit extends job running small pkg integration tests
with a simple check that SM server starts correctly. This is
not covered by our CI where we interact with SM services
directly, not via running SM server. This check would catch
simple issues like https://scylladb.atlassian.net/browse/CLOUD-1187.

Refs https://scylladb.atlassian.net/browse/CLOUD-1187
cd .github/cfg && go run main.go
Comment thread testing/scylla/certs/db.cfg
Comment thread testing/scylla-manager/scylla-manager-ssl.yaml
Comment thread testing/scylla-manager/scylla-manager-ssl-ipv6.yaml

@karol-kokoszka karol-kokoszka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update "Install" with examples of how to setup TLS, and how to setup mTLS between Scylla Manager and Scylla Manager DB.

database:
hosts:
- "192.168.200.100"
ssl: true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about removing "ssl: true" completely ?

It would make sense if we skip cert validation, but this PR is opposite - it forces certificate validation

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I follow. Removing ssl: true results in SM not using TLS when connecting to SM DB. This PR made it so SM DB is set up with TLS when SSL_ENABLED=true. So just removing it would result in errors. I guess that you just wanted to remove some cert validation. We can remove it from this config, as then we don't validate SM DB TLS cert which is required in default secure TLS. We could remove it from SM DB scylla.yaml, but since scylla allows for easy setup of mTLS and we already validate SM certs when connecting to first/second cluster nodes with TLS, I kept the mTLS setup. It's just that by default we have one-way TLS (scylla validates SM, SM doesn't validate scylla), so adding regular TLS results in mTLS out of the box.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From UX perspective - I see ssl: true as an unnecessary boilerplate when you include certificates into the config.

Comment is about this UX exactly. But it's nit.

If we skip cert validation - then ssl: true without certs could mean - encrypt transmission but do not verify certs.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, there are small differences in behavior controlled by the ssl field.
It's true that if someone adds TLS certs to config, then we can infer that ssl: true.
On the other hand, if we are missing TLS certs, we might still want to use TLS against scylla that does not verify client certs.
Similar thing happens when we think about custom CAs. Setup with ssl: true, no TLS certs, no custom CA still uses TLS and validates TLS certs against system CAs.

We might want to think about making it so we always validate TLS certs against both system and custom CA (if specified), so that the CA case is more comprehensive, but for now we can't just remove the ssl: bool field.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or did you mean to just not require ss: true when any other TLS config field is specified, but keep this config option in general?

@karol-kokoszka karol-kokoszka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not blocking PR - please update documentation with examples
"ssl: true/false" is just a nit.

PR is not just about TLS - it includes mTLS.

@Michal-Leszczynski

Copy link
Copy Markdown
Collaborator Author

@karol-kokoszka I will add the docs in a followup PR today so that the CI is not wastefully rekicked.

@Michal-Leszczynski
Michal-Leszczynski merged commit 41461bf into master Mar 30, 2026
80 checks passed
@Michal-Leszczynski
Michal-Leszczynski deleted the ml/1187-sm-db-tls branch March 30, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants