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

postgresql_ping with SSL client certificate and private key #424

Closed
dtma007 opened this issue Mar 7, 2023 · 6 comments
Closed

postgresql_ping with SSL client certificate and private key #424

dtma007 opened this issue Mar 7, 2023 · 6 comments

Comments

@dtma007
Copy link

dtma007 commented Mar 7, 2023

I see that postgresql_ping supports specifying a ca_cert parameter for the root/CA cert. But I couldn't find a way to specify a client certificate and client private key to connect to to a Postgres server that has clientcert=verify-full or clientcert=verify-ca. Is that supported?

@dtma007 dtma007 changed the title postgresql_ping with client certificate and private key postgresql_ping with SSL client certificate and private key Mar 7, 2023
@Andersson007
Copy link
Collaborator

@dtma007 hi, it's a fair point, looking at this, thanks for reporting the issue!

@aleksvagachev
Copy link
Collaborator

@Andersson007 I'm ready to do it.

@dtma007
Copy link
Author

dtma007 commented Mar 8, 2023

@Andersson007 @aleksvagachev Thanks so much for your quick response!

I still think it would be helpful to have the specific parameters for client cert and client private key in postgresql_ping, but I just wanted to let you know that I also found another way to specify the parameters by using the existing connect_params parameter.

for example. I did this:

  community.postgresql.postgresql_ping:
    db: "{{ db_name }}"
    login_host: "{{ db_server }}"
    login_user: "{{ db_user }}"
    login_password: "{{ decoded_pwd }}"
    ca_cert: "{{ db_ssl_root_cert_filename }}"
    connect_params:
      sslcert: "{{ db_ssl_cert_filename }}" 
      sslkey: "{{ db_ssl_key_filename }}" 
  register: result1

@Andersson007
Copy link
Collaborator

@dtma007 sorry for the late reply, was on PTO. Great, thanks for sharing the workaround but, yeah, if we already have some separate cert related params, i think it'd be more logical to have the rest separate as well

@Andersson007
Copy link
Collaborator

@dtma007 merged, thanks for reporting the issue!
@aleksvagachev thanks for fixing this!
@hunleyd thanks for reviewing and merging!

@Andersson007
Copy link
Collaborator

Closed via #427

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

3 participants