Skip to content
This repository has been archived by the owner on Nov 14, 2020. It is now read-only.

Provider Configuration: Support SSL Client Certificates #126

Merged
merged 5 commits into from
Apr 5, 2020
Merged

Provider Configuration: Support SSL Client Certificates #126

merged 5 commits into from
Apr 5, 2020

Conversation

kevinbirch
Copy link
Contributor

@kevinbirch kevinbirch commented Mar 30, 2020

Fixes: #49

Adds a new optional nested block to the provider configuration for SSL client certificate files paths.

Example:

provider "postgresql" {
  host = "localhost"

  clientcert {
    cert     = "client-cert.pem"
    key      = "client-key.pem"
  }
  sslrootcert = "server-ca.pem"
}

I tried to match the coding conventions of the project as best as I understand them. I'm happy to adjust the property names if there are preferences from reviewers.

@ghost ghost added the size/S label Mar 30, 2020
@ghost ghost added size/M and removed size/S labels Mar 30, 2020
@kevinbirch
Copy link
Contributor Author

Hi, could I get someone to take a look at this PR please? Perhaps @cyrilgdn?

Copy link
Contributor

@cyrilgdn cyrilgdn left a comment

Choose a reason for hiding this comment

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

Hi @kevinbirch ,

Thanks a lot for your work on this ! I've just tested it and it works fine 👍

I have just one question regarding the rootcert parameter (see my comments).

Also, could you update the website documentation accordingly please?

Description: "The SSL client certificate private key file path. The file must contain PEM encoded data.",
Required: true,
},
"rootcert": {
Copy link
Contributor

@cyrilgdn cyrilgdn Apr 4, 2020

Choose a reason for hiding this comment

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

I wonder if rootcert must be in this nested block with client cert/key?

If I understood correctly, the CA (rootcert) is used to verify the server certificate (so authenticate the server).
The client cert is used to authenticate the client.

So you can specify only cert/key if you want to authenticate the client or only rootcert if you want to authenticate the server (and all of them if you want to authenticate both).

So wouldn't it be better to keep cert and key in this clientcert block but have sslrootcert outside of it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, that would be totally fine with me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I've made the requested changes, thank you for your feedback!

connStr = fmt.Sprintf(dsnFmt, connValues...)
}

fmt.Printf("connection string: `%s`", connStr)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you remove it please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@ghost ghost added the documentation label Apr 5, 2020
Copy link
Contributor

@cyrilgdn cyrilgdn left a comment

Choose a reason for hiding this comment

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

Very nice! Thanks a lot 👍

@cyrilgdn cyrilgdn merged commit 0d7ad18 into hashicorp:master Apr 5, 2020
@cyrilgdn
Copy link
Contributor

cyrilgdn commented Apr 5, 2020

I'll let you know here when it's released, you can also watch the repository in "Releases only" mode.

@cyrilgdn
Copy link
Contributor

Hi,

This feature has been released in v1.6.0 last Friday.

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

Successfully merging this pull request may close these issues.

Allow specifying ssl certs/keys
2 participants