-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Use go method to calculate ssh key fingerprint #7128
Use go method to calculate ssh key fingerprint #7128
Conversation
It seems you can remove |
@lunny It seems we implemented the two methods and only use the go method for built-in ssh server. Lines 287 to 293 in 744972e
Should I do the same trick and implements both ? or should I clean SSHKeyGenParsePublicKey and replace it with SSHNativeParsePublicKey ? |
Codecov Report
@@ Coverage Diff @@
## master #7128 +/- ##
==========================================
+ Coverage 41.53% 41.53% +<.01%
==========================================
Files 449 449
Lines 61314 61338 +24
==========================================
+ Hits 25465 25479 +14
- Misses 32497 32503 +6
- Partials 3352 3356 +4
Continue to review full report at Codecov.
|
Hmm I think unless we're certain that go's support is the same as the native we could get into trouble assuming that go SSH and native fingerprints are the same. I don't know enough about go ssh to know if this is the case. The fact that we have this native switch for parsing makes me concerned that these may be different. PS Why we can't get the fingerprint at the time of parsing? |
@zeripath |
I separate the native go method to only to be use with built-in ssh. |
* Use go method to calculate key fingerprint * add gitea copyright * use native go method only for built-in server * refactor and add tests * add gitea copyright
Use ssh package to calculate the fingerprint in place of writing to a temporary file and relying on ssh-keygen to output the fingerprint.
This remove some i/o interaction and spinning up a sub-process. This is also needed for building a configurable rootless container because ssh-keygen try to find the running user (which is useless to calculate the fingerprint)
https://godoc.org/golang.org/x/crypto/ssh#ParseAuthorizedKey
https://godoc.org/golang.org/x/crypto/ssh#FingerprintSHA256