Skip to content

Commit

Permalink
feature(tls-certs): add pcssibiity to generate certs/keys for each test
Browse files Browse the repository at this point in the history
SCT uses a set of certificates created in 2016, for which newer TLS versions with
certification checks cannot be used (particularly these old certificates don't use
Subject Alternative Name extension, which would include DNS name/IP of a node for
hostname verification).

The change reworks how the TLS certificates/keys are created and used in
SCT:
- certificates/keys are created for each test run
- certificates are individual for each node - SAN extension of the
  certificate contains DNS name and IP of that node only
- added possibility to enable mutual TLS
- 'stress_thread' modules are updated to build properly the c-s, s-b and
  latte stress commands, depending on what is enabled - tls in general,
  hostname validation, mtls
- old certificates are deleted from SCT

The related task: scylladb/qa-tasks#1605
  • Loading branch information
dimakr committed Jun 18, 2024
1 parent b7f05f7 commit e8ad1ef
Show file tree
Hide file tree
Showing 34 changed files with 459 additions and 382 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ fabric.properties

# Linux swap files range from .saa to .swp (used by vim and some other apps)
*.s[a-w][a-p]

# SSL artifacts
data_dir/ssl_conf/
5 changes: 4 additions & 1 deletion artifacts_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from sdcm.sct_events import Severity
from sdcm.sct_events.database import ScyllaHousekeepingServiceEvent
from sdcm.provision.helpers.certificate import c_s_transport_str
from sdcm.tester import ClusterTester
from sdcm.utils.adaptive_timeouts import NodeLoadInfoServices
from sdcm.utils.housekeeping import HousekeepingDB
Expand Down Expand Up @@ -124,7 +125,9 @@ def check_cluster_name(self):
def run_cassandra_stress(self, args: str):
stress_cmd = f"{self.node.add_install_prefix(STRESS_CMD)} {args} -node {self.node.ip_address}"
if self.params.get('client_encrypt'):
stress_cmd += " -transport 'truststore=/etc/scylla/ssl_conf/client/cacerts.jks truststore-password=cassandra'"
transport_str = c_s_transport_str(self.params.get('client_encrypt_mtls'))
stress_cmd += f" -transport '{transport_str}'"

result = self.node.remoter.run(stress_cmd)
assert "java.io.IOException" not in result.stdout
assert "java.io.IOException" not in result.stderr
Expand Down
33 changes: 0 additions & 33 deletions data_dir/ssl_conf/cadb.pem

This file was deleted.

Binary file removed data_dir/ssl_conf/client/cacerts.jks
Binary file not shown.
51 changes: 0 additions & 51 deletions data_dir/ssl_conf/client/catest.key

This file was deleted.

33 changes: 0 additions & 33 deletions data_dir/ssl_conf/client/catest.pem

This file was deleted.

6 changes: 3 additions & 3 deletions data_dir/ssl_conf/client/cqlshrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
factory = cqlshlib.ssl.ssl_transport_factory

[ssl]
certfile = /etc/scylla/ssl_conf/client/test.crt
certfile = /etc/scylla/ssl_conf/ca.pem
validate = false
userkey = /etc/scylla/ssl_conf/client/test.key
usercert = /etc/scylla/ssl_conf/client/test.crt
userkey = /etc/scylla/ssl_conf/client-facing.key
usercert = /etc/scylla/ssl_conf/client-facing.crt
Binary file removed data_dir/ssl_conf/client/keystore.jks
Binary file not shown.
Binary file removed data_dir/ssl_conf/client/keystore.p12
Binary file not shown.
13 changes: 0 additions & 13 deletions data_dir/ssl_conf/client/test.crl

This file was deleted.

33 changes: 0 additions & 33 deletions data_dir/ssl_conf/client/test.crt

This file was deleted.

30 changes: 0 additions & 30 deletions data_dir/ssl_conf/client/test.csr

This file was deleted.

51 changes: 0 additions & 51 deletions data_dir/ssl_conf/client/test.key

This file was deleted.

Loading

0 comments on commit e8ad1ef

Please sign in to comment.