-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
[FAB-18339] CLI: update GetCerificate to only load client certificate as it is supposed to be #2146
Conversation
1532199
to
3a8b46c
Compare
3a8b46c
to
c410525
Compare
Thanks @wenjianqiao, one Q: if we don't load server certs, how can the client be sure that it contacts the intended OS node? |
@ale-linux Good question. GetCertificate should be called GetClientCertificate because it only |
Thanks @wenjianqiao, so the server certs are already available, and yet |
c410525
to
3bf099c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small nits that should be quick/easy to address.
One thing that you didn't introduce to these tests that I think can be split out into a follow-up JIRA is to stop using cert fixtures and instead use tlsgen
(here) to generate the certs/keys and write them to a temp folder.
GetCertificate() should be renamed to GetClientCertificate() as it only returns the client certificate. Currently GetCertificate() gets a PeerClient that unnecessarily loads server tls root file based on env vars. Update the function to only load client certificate. Signed-off-by: Wenjian Qiao <wenjianq@gmail.com>
3bf099c
to
7bbc084
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Wenjian! Looks good to me (I also manually verified the behavior before/after the fix just to be sure). I'll open a follow-up task to move away from the cert fixtures in these tests.
Signed-off-by: Wenjian Qiao wenjianq@gmail.com
Type of change
Description
Both "peer lifecycle chaincode" and "peer chaincode" commands need to get
the client certificate (when peer.tls.clientAuthRequired=true) for deliver service.
GetCertificate() returns a client certificate to pass to DeliverService. Currently, it
creates a PeerClient that unnecessarily loads server tls root file based on env vars,
which caused a problem loading tls files from env even if --tlsRootCertFile
already overwrites the env var.
The fix is to update GetCertificate to only load client certificate and rename it
to GetClientCertificate to avoid confusion.
Related issues
https://jira.hyperledger.org/browse/FAB-18339