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

Add TLS support #102

Merged
merged 3 commits into from
Sep 28, 2023
Merged

Add TLS support #102

merged 3 commits into from
Sep 28, 2023

Conversation

kentbull
Copy link
Contributor

@kentbull kentbull commented Sep 7, 2023

This adds createHttpServer to create an HTTPS server with hio.core.tcp.ServerTls.

@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Merging #102 (ee0ac93) into development (05c7eab) will increase coverage by 1.55%.
Report is 6 commits behind head on development.
The diff coverage is 84.88%.

@@               Coverage Diff               @@
##           development     #102      +/-   ##
===============================================
+ Coverage        88.20%   89.75%   +1.55%     
===============================================
  Files               30       34       +4     
  Lines             4789     5281     +492     
===============================================
+ Hits              4224     4740     +516     
+ Misses             565      541      -24     
Files Changed Coverage Δ
tests/app/test_specing.py 100.00% <ø> (ø)
src/keria/app/grouping.py 22.36% <22.36%> (ø)
src/keria/peer/exchanging.py 30.55% <30.55%> (ø)
src/keria/end/ending.py 85.71% <50.00%> (+54.34%) ⬆️
src/keria/app/aiding.py 85.03% <83.87%> (+7.29%) ⬆️
src/keria/app/agenting.py 84.29% <100.00%> (+2.96%) ⬆️
src/keria/app/credentialing.py 79.00% <100.00%> (+0.73%) ⬆️
src/keria/app/notifying.py 100.00% <100.00%> (ø)
src/keria/app/presenting.py 96.61% <100.00%> (+1.69%) ⬆️
src/keria/testing/testing_helper.py 99.29% <100.00%> (ø)
... and 8 more

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@kentbull kentbull marked this pull request as ready for review September 7, 2023 14:09
@kentbull kentbull marked this pull request as draft September 7, 2023 14:15
@kentbull kentbull marked this pull request as ready for review September 7, 2023 14:18
@m00sey m00sey requested a review from pfeairheller September 7, 2023 14:19
@@ -108,6 +110,31 @@ def setup(name, bran, adminPort, bootPort, base='', httpPort=None, configFile=No
return doers


def createHttpServer(port, app, keypath, certpath, cafilepath):
Copy link
Member

Choose a reason for hiding this comment

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

This method probably needs a test to get the patch coverage up

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add one.

Copy link
Member

@pfeairheller pfeairheller left a comment

Choose a reason for hiding this comment

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

We have to push this support all the way down to OOBI generation for the Agent OOBIs. See my comment below.

@@ -93,7 +95,7 @@ def setup(name, bran, adminPort, bootPort, base='', httpPort=None, configFile=No
ending.loadEnds(agency=agency, app=happ)
indirecting.loadEnds(agency=agency, app=happ)

server = http.Server(port=httpPort, app=happ)
server = createHttpServer(httpPort, happ, keypath, certpath, cafilepath)
Copy link
Member

Choose a reason for hiding this comment

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

If you are going to change this to HTTPS, you will need to change the way you expose the OOBIs so that they are also HTTPs. Otherwise others will not be able to resolve the oobis for this Agent.

This is brings to mind that we might need multiple cert options because users will probably want to expose this endpoint to the world on one domain name and expose the Admin API on another domain name. Heck, we may need 3.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does Rodolfo's PR #91 address this need?

Copy link
Member

Choose a reason for hiding this comment

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

No it does not. You will have to update OobiResourceEnd.on_get to change what scheme (currently hardcoded to http) is used when generating OOBIs, based on the configuration of these flags. Endpoints that are returned when OOBIs are resolved are controlled by configuration files so they are fine, but not OOBIs themselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just hit this problem. I'm getting a socket.gaierror: [Errno -2] Name does not resolve when resolving an HTTPS OOBI.
I'll get a PR submitted on this ASAP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was able to use the changes from #91 for a fully HTTPS KERIA. I haven't yet tried switching my witness over to HTTPS. That's my next task.

Copy link
Member

Choose a reason for hiding this comment

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

You still have not address my change request. That change needs to be made before this PR can be accepted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you want to merge #103 and have me re-base this on development or should I just pull those changes into this branch?

Copy link
Member

Choose a reason for hiding this comment

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

#103 is a mess at the moment, pulling in old changes or something. And tests are broken in 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.

Ok, I'll pull just the changes I need into this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those changes are now committed to this PR.

@kentbull
Copy link
Contributor Author

To get the patch coverage up higher I need to add test coverage for the keria start command. In order to do that it seemsI need to actually start a KERIA server instance which means I need real TLS certificates like I discussed in WebOfTrust/keripy#570

I could pull in test certificates like Sam did in the hio library here: https://github.com/ioflo/hio/blob/master/tests/core/tcp/test_tcp.py#L657

If you'd like me to do that let me know and I will. Otherwise the overall test coverage appears to be increasing, yet the patch coverage is still around 50%.

@rodolfomiranda
Copy link
Collaborator

seems that the codecov reports that is shown at the top of the PR gives different results that the one used to enforce the checks.

@rodolfomiranda
Copy link
Collaborator

I close PR #103 in favor of this one that includes all the changes

@kentbull
Copy link
Contributor Author

Is anything more needed for this PR to be merged?

@pfeairheller pfeairheller merged commit ea1f913 into WebOfTrust:development Sep 28, 2023
@kentbull kentbull deleted the tls branch October 3, 2023 09:56
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.

4 participants