-
-
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
Offer rsa-sha2-512 and rsa-sha2-256 algorithms in internal SSH #17281
Offer rsa-sha2-512 and rsa-sha2-256 algorithms in internal SSH #17281
Conversation
There is a subtle bug in the SSH library x/crypto/ssh which makes the incorrect assumption that the public key type is the same as the signature algorithm type. This means that only ssh-rsa signatures are offered by default. This PR adds a workaround around this problem. Fix go-gitea#17175 Signed-off-by: Andrew Thornton <art27@cantab.net>
Is that bug reported upstream too? |
error log: https://hastebin.nl/CViInAB |
Signed-off-by: Andrew Thornton <art27@cantab.net>
…h-server-algorithms
This works on CI, running tests locally and in simple testing here. Was this on your testing? |
This comment has been minimized.
This comment has been minimized.
it is but I've added a comment explaining why it's happened. |
Could you also send a PR to upstream? Maybe they could also give some reviews. |
This PR isn't suitable for upstream as it's a workaround. The problem is a fundamental design issue with the upstream The issue is that the type type Signer interface {
// PublicKey returns an associated PublicKey instance.
PublicKey() PublicKey
// Sign returns raw signature for the given data. This method
// will apply the hash specified for the keytype to the data.
Sign(rand io.Reader, data []byte) (*Signature, error)
} Doesn't provide a mechanism to say what types of algorithm are supported by this Signer. Even type AlgorithmSigner interface {
Signer
// SignWithAlgorithm is like Signer.Sign, but allows specification of a
// non-default signing algorithm. See the SigAlgo* constants in this
// package for signature algorithms supported by this package. Callers may
// pass an empty string for the algorithm in which case the AlgorithmSigner
// will use its default algorithm.
SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error)
} doesn't do this and nor is it wired into handshake. It would actually need to be something like: type TypedSigner interface {
Signer
// Type returns the algorithm type for this signer
Type() String
} or: type MultipleAlgorithmSigner interface {
AlgorithmSigner
// Algorithms returns the available algorithms
Algorithms() []string
// SignWithAlgorithm is like Signer.Sign, but allows specification of a
// non-default signing algorithm. See the SigAlgo* constants in this
// package for signature algorithms supported by this package. Callers may
// pass an empty string for the algorithm in which case the AlgorithmSigner
// will use its default algorithm.
SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error)
} This would then allow backwards compatibility with the current system through casting as the interface and not requiring a v2 of the module. |
Ok let me test once again ... |
…tea#17281) Backport go-gitea#17281 There is a subtle bug in the SSH library x/crypto/ssh which makes the incorrect assumption that the public key type is the same as the signature algorithm type. This means that only ssh-rsa signatures are offered by default. This PR adds a workaround around this problem. Fix go-gitea#17175 Signed-off-by: Andrew Thornton <art27@cantab.net>
… (#17376) Backport #17281 There is a subtle bug in the SSH library x/crypto/ssh which makes the incorrect assumption that the public key type is the same as the signature algorithm type. This means that only ssh-rsa signatures are offered by default. This PR adds a workaround around this problem. Fix #17175 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* SECURITY * Upgrade Bluemonday to v1.0.16 (go-gitea#17372) (go-gitea#17374) * Ensure correct SSH permissions check for private and restricted users (go-gitea#17370) (go-gitea#17373) * BUGFIXES * Prevent NPE in CSV diff rendering when column removed (go-gitea#17018) (go-gitea#17377) * Offer rsa-sha2-512 and rsa-sha2-256 algorithms in internal SSH (go-gitea#17281) (go-gitea#17376) * Don't panic if we fail to parse U2FRegistration data (go-gitea#17304) (go-gitea#17371) * Ensure popup text is aligned left (backport for 1.15) (go-gitea#17343) * Ensure that git daemon export ok is created for mirrors (go-gitea#17243) (go-gitea#17306) * Disable core.protectNTFS (go-gitea#17300) (go-gitea#17302) * Use pointer for wrappedConn methods (go-gitea#17295) (go-gitea#17296) * AutoRegistration is supposed to be working with disabled registration (backport) (go-gitea#17292) * Handle duplicate keys on GPG key ring (go-gitea#17242) (go-gitea#17284) * Fix SVG side by side comparison link (go-gitea#17375) (go-gitea#17391) Signed-off-by: Andrew Thornton <art27@cantab.net>
* SECURITY * Upgrade Bluemonday to v1.0.16 (#17372) (#17374) * Ensure correct SSH permissions check for private and restricted users (#17370) (#17373) * BUGFIXES * Prevent NPE in CSV diff rendering when column removed (#17018) (#17377) * Offer rsa-sha2-512 and rsa-sha2-256 algorithms in internal SSH (#17281) (#17376) * Don't panic if we fail to parse U2FRegistration data (#17304) (#17371) * Ensure popup text is aligned left (backport for 1.15) (#17343) * Ensure that git daemon export ok is created for mirrors (#17243) (#17306) * Disable core.protectNTFS (#17300) (#17302) * Use pointer for wrappedConn methods (#17295) (#17296) * AutoRegistration is supposed to be working with disabled registration (backport) (#17292) * Handle duplicate keys on GPG key ring (#17242) (#17284) * Fix SVG side by side comparison link (#17375) (#17391) Signed-off-by: Andrew Thornton <art27@cantab.net>
Frontport go-gitea#17392 * SECURITY * Upgrade Bluemonday to v1.0.16 (go-gitea#17372) (go-gitea#17374) * Ensure correct SSH permissions check for private and restricted users (go-gitea#17370) (go-gitea#17373) * BUGFIXES * Prevent NPE in CSV diff rendering when column removed (go-gitea#17018) (go-gitea#17377) * Offer rsa-sha2-512 and rsa-sha2-256 algorithms in internal SSH (go-gitea#17281) (go-gitea#17376) * Don't panic if we fail to parse U2FRegistration data (go-gitea#17304) (go-gitea#17371) * Ensure popup text is aligned left (backport for 1.15) (go-gitea#17343) * Ensure that git daemon export ok is created for mirrors (go-gitea#17243) (go-gitea#17306) * Disable core.protectNTFS (go-gitea#17300) (go-gitea#17302) * Use pointer for wrappedConn methods (go-gitea#17295) (go-gitea#17296) * AutoRegistration is supposed to be working with disabled registration (backport) (go-gitea#17292) * Handle duplicate keys on GPG key ring (go-gitea#17242) (go-gitea#17284) * Fix SVG side by side comparison link (go-gitea#17375) (go-gitea#17391) Signed-off-by: Andrew Thornton <art27@cantab.net>
- Introduced in go-gitea#17281 - Fixed in x/crypto: - golang/crypto@5d542ad - & golang/crypto@3147a52
* Update golang.org/x/crypto - Update dependency to include fix for CVE. - See https://groups.google.com/g/golang-announce/c/-cp44ypCT5s/m/wmegxkLiAQAJ?utm_medium=email&utm_source=footer * Fix deprecation notice * Remove workaround - Introduced in #17281 - Fixed in x/crypto: - golang/crypto@5d542ad - & golang/crypto@3147a52 * Update Kex Algorithms - Use standardized name for curve22519-sha256. golang/crypto@9b07691 - Prefer SHA256 version over SHA1 version. golang/crypto@e4b3678
…tea#17281) * Offer rsa-sha2-512 and rsa-sha2-256 algorithms in internal SSH There is a subtle bug in the SSH library x/crypto/ssh which makes the incorrect assumption that the public key type is the same as the signature algorithm type. This means that only ssh-rsa signatures are offered by default. This PR adds a workaround around this problem. Fix go-gitea#17175 Signed-off-by: Andrew Thornton <art27@cantab.net> * as per review Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update golang.org/x/crypto - Update dependency to include fix for CVE. - See https://groups.google.com/g/golang-announce/c/-cp44ypCT5s/m/wmegxkLiAQAJ?utm_medium=email&utm_source=footer * Fix deprecation notice * Remove workaround - Introduced in go-gitea#17281 - Fixed in x/crypto: - golang/crypto@5d542ad - & golang/crypto@3147a52 * Update Kex Algorithms - Use standardized name for curve22519-sha256. golang/crypto@9b07691 - Prefer SHA256 version over SHA1 version. golang/crypto@e4b3678
There is a subtle bug in the SSH library x/crypto/ssh which makes the incorrect
assumption that the public key type is the same as the signature algorithm type.
This means that only ssh-rsa signatures are offered by default.
This PR adds a workaround around this problem.
Fix #17175
Signed-off-by: Andrew Thornton art27@cantab.net