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

feat: Add mTLS configuration for ffresty #65

Merged
merged 5 commits into from
Apr 25, 2023

Conversation

EnriqueL8
Copy link
Contributor

Adding the ability to supply a config to the ffresty client to setup TLS and mTLS.

NOTE This changes the interface of that init function to now return an error as well, so every consumer of this library and that client on update will need to handle that error. We could avoid doing this by allowing the user to provide a TLS Config as an argument but the pattern seems to be to provide viper config!

For testing I added a series of real and fake certificates and keys. I also explore standing up an mTLS mock server with the httptest but it proved cumbersome. I think validating that the correct certificates are added to the TLS Config should be good enough but happy to rectify

Signed-off-by: Enrique Lacal <enriquelacal@Enriques-MacBook-Pro.local>
Copy link
Contributor

@peterbroadhurst peterbroadhurst left a comment

Choose a reason for hiding this comment

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

This is great @EnriqueL8 - A few suggestions/questions to consider.

test/certs/ca-crt.pem Outdated Show resolved Hide resolved
pkg/ffresty/ffresty.go Outdated Show resolved Hide resolved

var client *resty.Client

func New(ctx context.Context, staticConfig config.Section) (client *resty.Client, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

As you mention, this line will drive a lot of change in the components.

I wonder if the right answer here, is to prepare a set of PRs against the other hyperledger/firefly-* repositories - otherwise they would become unable to pick up security maintenance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds like a plan, have already started on the main firefly but will look at the other repos and coordinate the changes

Enrique Lacal added 3 commits April 20, 2023 13:23
Signed-off-by: Enrique Lacal <enriquelacal@Enriques-MacBook-Pro.local>
Signed-off-by: Enrique Lacal <enriquelacal@Enriques-MacBook-Pro.local>
Signed-off-by: Enrique Lacal <enrique.lacal@kaleido.io>
Copy link
Contributor

@peterbroadhurst peterbroadhurst left a comment

Choose a reason for hiding this comment

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

Awesome. Thanks for going the extra mile to package this one all up so tidily @EnriqueL8!

@peterbroadhurst peterbroadhurst merged commit d13465d into hyperledger:main Apr 25, 2023
@peterbroadhurst peterbroadhurst deleted the add_mtls_ffresty branch April 25, 2023 18:34
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

Successfully merging this pull request may close these issues.

2 participants