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

MITM: recreating private/public keys all the time #368

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

stiray
Copy link

@stiray stiray commented Nov 29, 2019

... has huge impact on speed of processing, with this change the RSA and ECDSA keys are created within "init()" and used when needed. This is quick fix, please set it to some configuration variable if you consider that it is useful to generate them on each request. I dont think this would impact the security on client side.

Copy link
Owner

@elazarl elazarl left a comment

Choose a reason for hiding this comment

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

I'm really thrilled to merge it, but can we not depend on external package go-cache?

That's the only blocker.

signer.go Outdated
@@ -16,8 +16,10 @@ import (
"net"
"sort"
"time"
"github.com/zond/gotomic"
Copy link
Owner

Choose a reason for hiding this comment

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

Can we do that without introducing another depdendency?

@@ -77,6 +97,7 @@ func signHost(ca tls.Certificate, hosts []string) (cert *tls.Certificate, err er
}

var certpriv crypto.Signer

Copy link
Owner

Choose a reason for hiding this comment

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

Can we put the whitespace changes in a different commit?

@hazcod
Copy link

hazcod commented Sep 15, 2020

@stiray @elazarl @engineering-this : see hazcod@152f865 and hazcod@578522f for a possibly better implementation.

@stiray
Copy link
Author

stiray commented Oct 12, 2020

Ok, I am not using github and I dont even intend to as I have my own git server and I am quite happy with shell so I wont be clicking anything here any more...

Regarding the "race condition" which was probably merged due to clicking to "resolve whatever" which was a mistake if "the semaphore fix" came into code.

The race condition was put there deliberately to avoid synchronizing multiple threads using synchronization object at a cost that here and then the certificate is generated without any reason which is performance wise better decision.

But nvm me, this was a drive by code, it have my own git server/repo/fork (ignore the one that is on github, wont be updated any more) so please do whatever feels appropriate for you.

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