Skip to content

sslcert url parameter should not be required when using PKCS-12 encoded key #75179

@timveil

Description

@timveil

Describe the problem

Based on my reading of postgres jdbc documentation, a user should be able to specify a PKCS-12 formatted key in the sslkey url parameter. When providing a key in this format, they are not required to provide the sslcert parameter as the PKCS-12 format includes both the key and the cert in a single file. Or at least that is how i interpreted this line in their documentation... Note: This parameter is ignored when using PKCS-12 keys, since in that case the certificate is also retrieved from the same keyfile.. If i attempt to send a url to cockroach sql that includes the sslkey parameter but not the sslcert parameter I am presented with this error...

ERROR: invalid argument "postgresql://localhost:26257/spring_examples?ApplicationName=datasource&reWriteBatchedInserts=true&sslmode=verify-full&sslrootcert=/Users/timveil/Documents/GitHub/spring-examples/docker/lb-haproxy-secure/ca.crt&sslpassword=password&sslkey=/Users/timveil/Documents/GitHub/spring-examples/docker/lb-haproxy-secure/client.pfx" for "--url" flag: URL validation error: sslcert
Client certificate missing.
Failed running "sql"

To Reproduce

I use this repo to create a secure 3 node cluster (https://github.com/timveil-cockroach/spring-examples/tree/master/docker/lb-haproxy-secure)

I use the client key and cert generated from the cockroach cert command and stored in the shared volume to create a PK12 file (client.pfx).

I then pass what should be a valid url to local instance of the cockroach sql client and get the above error. Here is the exact command i pass.

cockroach sql --url='postgresql://localhost:26257/spring_examples?ApplicationName=datasource&reWriteBatchedInserts=true&sslmode=verify-full&sslrootcert=/Users/timveil/Documents/GitHub/spring-examples/docker/lb-haproxy-secure/ca.crt&sslpassword=password&sslkey=/Users/timveil/Documents/GitHub/spring-examples/docker/lb-haproxy-secure/client.pfx'

Expected behavior
I expect to get farther than the url validation error above.

Additional data / screenshots

Additional context

Jira issue: CRDB-12498

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cli-clientCLI commands that pertain to using SQL featuresA-cli-flagsPertains to CLI flag handling common to all CLI commandsA-configurabilityPertains to cluster settings, CLI flags, env vars etcA-securityC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions