Skip to content

Fixed yaml model (insecureSkipTlsVerify) #177

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 1 commit into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ protected Builder withScyllaCloudConnectionConfig(ScyllaCloudConnectionConfig co
new ScyllaCloudSniEndPointFactory(
proxyAddress, currentDatacenter.getNodeDomain()))
.withSSL(
(config.getCurrentAuthInfo().isInsecureSkipTlsVerify()
(config.getCurrentDatacenter().isInsecureSkipTlsVerify()
? config.createBundle().getInsecureSSLOptions()
: config.createBundle().getSSLOptions()))
Comment on lines 1410 to 1413

Choose a reason for hiding this comment

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

A potential problem I see (and I didn't expect at the beginning): Previously, there was only a single insecureSkipTlsVerify, so we could set it here with withSSL on a session. But now, you could have different configurations of insecureSkipTlsVerify per each datacenter - but here currentDatacenter determines the configuration for all SSL connections.

.withAuthProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class ScyllaCloudAuthInfo {
private final String clientKeyPath;
private final String username;
private final String password;
private final boolean insecureSkipTlsVerify;

@JsonCreator
public ScyllaCloudAuthInfo(
Expand All @@ -35,16 +34,13 @@ public ScyllaCloudAuthInfo(
@JsonProperty(value = "clientKeyData") byte[] clientKeyData,
@JsonProperty(value = "clientKeyPath") String clientKeyPath,
@JsonProperty(value = "username") String username,
@JsonProperty(value = "password") String password,
@JsonProperty(value = "insecureSkipTlsVerify", defaultValue = "false")
boolean insecureSkipTlsVerify) {
@JsonProperty(value = "password") String password) {
this.clientCertificateData = clientCertificateData;
this.clientCertificatePath = clientCertificatePath;
this.clientKeyData = clientKeyData;
this.clientKeyPath = clientKeyPath;
this.username = username;
this.password = password;
this.insecureSkipTlsVerify = insecureSkipTlsVerify;
}

public void validate() {
Expand Down Expand Up @@ -96,8 +92,4 @@ public String getUsername() {
public String getPassword() {
return password;
}

public boolean isInsecureSkipTlsVerify() {
return insecureSkipTlsVerify;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ScyllaCloudDatacenter {
private final String tlsServerName;
private final String nodeDomain;
private final String proxyURL;
private final boolean insecureSkipTlsVerify;

// Full hostname has limit of 255 chars.
// Host UUID takes 32 chars for hex digits and 4 dashes. Additional 1 is for separator dot before
Expand All @@ -33,13 +34,16 @@ public ScyllaCloudDatacenter(
@JsonProperty(value = "server") String server,
@JsonProperty(value = "tlsServerName") String tlsServerName,
@JsonProperty(value = "nodeDomain") String nodeDomain,
@JsonProperty(value = "proxyURL") String proxyURL) {
@JsonProperty(value = "proxyURL") String proxyURL,
@JsonProperty(value = "insecureSkipTlsVerify", defaultValue = "false")
boolean insecureSkipTlsVerify) {
this.certificateAuthorityPath = certificateAuthorityPath;
this.certificateAuthorityData = certificateAuthorityData;
this.server = server;
this.tlsServerName = tlsServerName;
this.nodeDomain = nodeDomain;
this.proxyURL = proxyURL;
this.insecureSkipTlsVerify = insecureSkipTlsVerify;
}

public void validate() {
Expand Down Expand Up @@ -85,6 +89,10 @@ public String getProxyURL() {
return proxyURL;
}

public boolean isInsecureSkipTlsVerify() {
return insecureSkipTlsVerify;
}

// Using parts relevant to hostnames as we're dealing with a part of hostname
// RFC-1123 Section 2.1 and RFC-952 1.
private void validateNodeDomain() {
Expand Down