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

ssh in lima seems to exclude aes-ctr and force aes-gcm exclusively #2913

Open
apostasie opened this issue Nov 15, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@apostasie
Copy link

Description

My problem here is that we do not want to carry openssl as a dependency in other parts of our systems, and our ssh client is compiled --without-openssl.

So:

$ ssh -Q cipher
aes128-ctr
aes192-ctr
aes256-ctr
[email protected]

Which will not work with lima apparently:

$ limactl shell foo
command-line line 0: Unsupported option "gssapiauthentication"
command-line line 0: Bad SSH2 cipher spec '^[email protected],[email protected]'.

From a casual reading of:

lima/pkg/sshutil/sshutil.go

Lines 201 to 222 in 217da28

if !sshInfo.openSSHVersion.LessThan(*semver.New("8.1.0")) {
// By default, `ssh` choose [email protected], even when AES accelerator is available.
// (OpenSSH_8.1p1, macOS 11.6, MacBookPro 2020, Core i7-1068NG7)
//
// We prioritize AES algorithms when AES accelerator is available.
if sshInfo.aesAccelerated {
logrus.Debugf("AES accelerator seems available, prioritizing [email protected] and [email protected]")
if runtime.GOOS == "windows" {
opts = append(opts, "Ciphers=^[email protected],[email protected]")
} else {
opts = append(opts, "Ciphers=\"^[email protected],[email protected]\"")
}
} else {
logrus.Debugf("AES accelerator does not seem available, prioritizing [email protected]")
if runtime.GOOS == "windows" {
opts = append(opts, "Ciphers=^[email protected]")
} else {
opts = append(opts, "Ciphers=\"^[email protected]\"")
}
}
}
return opts, nil

It seems to me lima is forcing gcm (when there is acceleration for aes), with a fallback on chacha - so, pretty much, forcing ciphers that also provide integrity, excluding ctr+separate mac.

I appreciate strong opinions :-) - and clearly there is nothing wrong with aes-gcm (though maybe chacha is more contentious) - so, if this was a conscious decision to make lima work exclusively for these ciphers, that is fine.

On the other hand, if this was not a concerted decision - there is nothing wrong with aes-ctr + hmac-sha2 either - so, curious about folks' opinion on this?

Thanks in advance.

@AkihiroSuda AkihiroSuda added the bug Something isn't working label Nov 15, 2024
@AkihiroSuda
Copy link
Member

Yes, Lima should query ssh -Q cipher to validate available algorithms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants