Patroni connect etcd with TLS #15999
-
What happened?we are trying to integrate Patroni with ETCD, but found patroni can not connect with etcd using TLS with CN name specificly, the ETCD enabled client-cert-auth and enabled authentication. Patroni export told me it's becuase the gRPC-gateway connection. The patroni log: What did you expect to happen?But we do not want use u/p in the patroni configuraiton file, so I am thinking to give up the etcd RBAC. I did some CTL and API call test, seems everyone use any client certification assigned by same root CA can read/audit/delete to change the ETCD keys. is this expected logical? if etcd auth is not enabled, everyone by default can control the ETCD by API/CTL How can we reproduce it (as minimally and precisely as possible)?ETCD created with --client-auth-auth=true Anything else we need to know?etcd3: Etcd version (please run commands below)3.2 etcdserver Etcd configuration (command line flags or environment variables)paste your configuration hereEtcd debug information (please run commands below, feel free to obfuscate the IP address or FQDN in the output)The debug info for API calls using different certificates D | auth: found common name patroni_usr Relevant log outputNo response |
Beta Was this translation helpful? Give feedback.
Replies: 11 comments 1 reply
-
Hi @EdithChenLi - Thanks for your question, in future please raise as a github discussion, refer: https://github.com/etcd-io/etcd/blob/main/Documentation/contributor-guide/triage_issues.md#support-requests I believe this section of documentation is relevant in your case: https://etcd.io/docs/v3.5/op-guide/authentication/rbac/#using-tls-common-name
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the support link and details. James |
Beta Was this translation helpful? Give feedback.
-
Hi @EdithChenLi - Please refer to this documentation covering how etcd auth time-of-check/time-of-use works https://etcd.io/docs/v3.5/learning/design-auth-v3/#authentication Additionally please refer to this documentation for password change instructions: https://etcd.io/docs/v3.5/op-guide/authentication/rbac/#working-with-users |
Beta Was this translation helpful? Give feedback.
-
Thanks James
$ etcdctl user list But we got certification error when trying to use username/password as howing below, did I misunderstand something? etcd3: The patroni log: $ /home/chen/etcd35/etcdctl user list --endpoints=$ENDPOINTS --user patroni_usr:1234 |
Beta Was this translation helpful? Give feedback.
-
Please provide the configuration file or full list of flags you are using to configure etcd. You can redact hostnames if necessary I just want to understand what flags you are passing in relation to tls in context with other etcd configuration options. Edit: This docs page may be of assistance in relation to general purpose tls configuration: https://etcd.io/docs/v3.5/op-guide/security/ |
Beta Was this translation helpful? Give feedback.
-
Yes, please see below env file for etcd. The etcd.crt CN included all 3 ETCD nodes IP/hostnames ETCD_NAME=etcd_1 ETCD_CERT_FILE=/etc/etcd.crt ETCD_PEER_CERT_FILE=/etc/etcd.crt The patroni original configuraiton before enable etcd auth: To connect etcd using etcdctl before: |
Beta Was this translation helpful? Give feedback.
-
@EdithChenLi I ran into the same error when I set up a Patroni cluster with client cert authentication today and found this issue when I looked for a solution. The error is triggered by the following code:
Clearly, etcd doesn't like the CommonName in the client certificate, so I issued one without a CN and everything is now working fine for me. Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
Thanks @karfrank I did not realised the client certificate can generate without a CN with PKI, if you don't mind, can you pls share the certificate configuraiton file? And I think I got the reason why I got the permission error using etcd auth. There is one line warning in patroni log missed(not sure why did not see similar warning/error in etcd log, maybe because the log level) Patroni log: I downloaded version 3.5 and do same configuraiton then got same error you mentioned for CN: So before 3.3, ETCD authenticate is not supported for real? because I can see the etcd authenticate page for 3.2 version(for some reason, I need use version 3.2) |
Beta Was this translation helpful? Give feedback.
-
@EdithChenLi I used the following minimalistic cfssl configuration file to generate the client certificates for Patroni:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the sharing @karfrank @karfrank @jmhbnz Regarding the warning message in patroni when use username/password to connect ETCD. if possible you know where/who we can confirm if 3.2.0 support etcd auth or not? I am checking with Patroni Eng as well Patroni log: The patroni code which trigger the WARNING message for reference |
Beta Was this translation helpful? Give feedback.
-
Much appreciated @karfrank @jmhbnz |
Beta Was this translation helpful? Give feedback.
@EdithChenLi I ran into the same error when I set up a Patroni cluster with client cert authentication today and found this issue when I looked for a solution.
The error is triggered by the following code:
https://github.com/etcd-io/etcd/blob/0073fd422528e7cb56fdf8b8a61d8751e3a281db/server/embed/serve.go#L419-L422C4
Clearly, etcd doesn't like the CommonName in the client certificate, so I issued one without a CN and everything is now working fine for me.
Hope this helps!