Skip to content
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

How to pass private key certificate password? #467

Open
hwzjy01 opened this issue Dec 13, 2024 · 1 comment
Open

How to pass private key certificate password? #467

hwzjy01 opened this issue Dec 13, 2024 · 1 comment

Comments

@hwzjy01
Copy link

hwzjy01 commented Dec 13, 2024

Describe the bug
When I created the client, I specified the use of the SSL protocol and certificate verification. However, the certificate can only pass the path but not the content. As a result, we need to store the plaintext certificate in the environment in advance, which is not allowed. If you pass the encryption certificate directly, there will be an interactive command line to enter the certificate password when executing the execute() method, which is unreasonable.
image

To Reproduce
client = Client(host=constant.MY_SQL_CONFIG.get("host"), port=constant.MY_SQL_CONFIG.get("port"),
database=constant.MY_SQL_CONFIG.get("database"), user=constant.MY_SQL_CONFIG.get("user"),
password=constant.MY_SQL_CONFIG.get("password"),secure=True,ca_certs=ca_file, keyfile=key_file, certfile=cert_file)
database_name = 'new_database'
client.execute(f"CREATE DATABASE IF NOT EXISTS {database_name}")
Expected behavior

When creating the client, you can receive the parameter key_password of a private key password. There is no need to go to the command line to obtain it when executing the execute() method.

Versions
linux x86环境
clickhouse_driver : 0.2.6
python:3.11.4

@hwzjy01
Copy link
Author

hwzjy01 commented Dec 13, 2024

The _create_ssl_context method in the Connection class does not pass the private key certificate password when creating the ssl context.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant