-
Notifications
You must be signed in to change notification settings - Fork 37
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
Sonoma 14.6 breaks ssh-askpass #54
Comments
Seems the service can't start:
But it's still not running:
When trying to start it:
I tried deleting the |
@dataviruset You can directly set SSH_ASKPASS and SUDO_ASKPASS to test it without the services. It is due to the system I think, not the services
|
Using my original
Interestingly the |
I added keys to the ssh-agent using keepassxreboot/keepassxc#9955 (comment) macOS 14.6 upgrade break ssh-agent |
If your organisation depends on this working and has a support agreement with Apple, please point them at this bug. 😄 I dug in to this a bit today, it looks like Sonoma 14.6 has changed the environment variable inheritance rules for system-provided user daemons ( This means that when macOS starts The work-around @zeyugao proposed side-steps all of this by not using macOS' On a system with Sonoma 14.5 with
On a system with Sonoma 14.6 without
With Sonoma 14.6 with
Other macOS system daemons (eg: User-installed software in The fact that I suspect that this was part of some other security / platform hardening change, but I'm unable to find any specific release notes about this. It's something that Apple will need to fix. |
@micolous Have you succeeded in setting I manually set the |
No. What matters is the environment that The error we're seeing is because
The work-around I've got for now is to disable confirmation, but I've set up my SSH keys using It just means now I don't get any prompt on screen, just a flashing light on the side of my computer. If you're using |
I worked around it by running a user-land instance of Some GUI apps might not pick that up, but so far without issues. Other than it being annoying to setup. For anyone interested here are some resources that helped me:
Given the fact Apple likely broke this for good I think that will be the way forward. |
Yeah, your setup and 1Password's replace the default Apple-provided SSH agent setup (partially or entirely). There are usability edge cases to that, as you've already noted. If you go further (as 1Password do, and has been suggested elsewhere) and replace I acknowledge that there are tradeoffs, like that those hardening features can also prevent you from using some more "obscure" functionality (like FIDO2 resident keys and PIV with ECDSA keys). For what it's worth, there are large corporates and government agencies with macOS workstations and a custom At this point, I'm quietly optimistic that it won't remain broken forever... it just needs to get in front of the right set of eyes. 😄 |
I think the issue has been (at lease partially) misdiagnosed by @micolous; (FWIW I use a different askpass program but I think the issue is similar) As an experiment, I tried unsetting the
So I add a tiny script to the above location: #!/bin/sh
echo "$@" > ~/askpass
date >> ~/askpass
env >> ~/askpass I notice that when keys are not loaded, I get output as follows:
In particular, the
i.e. the script runs in the same context as the ssh command, likely invoked directly by Whereas if keys are loaded I get similar to the following: $ cat ~/askpass
Allow use of key user@host?
Key fingerprint SHA256:<redacted>.
SHELL=/bin/zsh
SSH_ASKPASS_PROMPT=confirm
TMPDIR=/var/folders/vx/wq1n25gs5t54v4sp3_6yj3c00000gn/T/
MallocSpaceEfficient=1
USER=user
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.LVjkwSsCS6/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
PATH=/usr/bin:/bin:/usr/sbin:/sbin
PWD=/
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
SHLVL=1
HOME=/Users/user
LOGNAME=user
DISPLAY=/private/tmp/com.apple.launchd.NVQ3vVyfbz/org.xquartz:0
_=/usr/bin/env which is a fairly vanilla environment, likely invoked by The conclusion is that rather than not recognizing |
update: I can confirm that
where programs are at the respective locations above opens the confirmation dialog and proceeds to successfully authenticate. Presumably pointing EDIT: |
I tried your work-around on Sonoma 14.5 and 14.6 with XQuartz installed (so I removed the brew services stop ssh-askpass
launchctl unsetenv SSH_ASKPASS
launchctl unsetenv SUDO_ASKPASS
unset SSH_ASKPASS
unset SUDO_ASKPASS
killall ssh-agent I then added the keys again with confirmation enabled: # For SSH key in the Keychain:
ssh-add -cs /usr/lib/ssh-keychain.dylib
# If you were using a private key stored on disk, you would do:
ssh-add -c I tested putting both your tiny script and this repository's version of Even adding a symlink to a Homebrew-installed version of Looking at the source of Apple's version of SSH, it will try to use This would suggest that the only trigger for the issue is that environment variables from While I don't doubt that (This post was edited multiple times to clarify things.) |
A step-by-step, minimum-viable workaround for Sonoma 14.6 with macOS' default, out-of-the-box
Then you can load your keys into your SSH agent as normal ( This should also work on Sonoma 14.5 and earlier, if you want to prepare a system before upgrading to 14.6. A work-around without XQuartz would be to have Edited (2024-08-06): fix typo: replace |
An alternative workaround is to clone and shadow the original system launch-agent, which cannot be disabled or modified (due to SIP), and does not inherit global environment. Make a copy: cp /System/Library/LaunchAgents/com.openssh.ssh-agent.plist ~/Library/LaunchAgents/com.openssh.ssh-agent-my.plist Change:
Load the launch-agent launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.openssh.ssh-agent-my.plist Even if it's the same executable, it does inherit the global environment as it is not a system launch-agent. So it gets the Restart your terminal app to acquire the fresh global env. Now the To make it work in your terminal, you can override the original env variable in your shell config: export SSH_AUTH_SOCK=$SSH_AUTH_SOCK_MY To make it work with all apps, we have to override the socket-file itself: ln -sf $SSH_AUTH_SOCK_MY $SSH_AUTH_SOCK (Idea source: maxgoedjen/secretive Finally, it's working just as before the OS upgrade. |
@micolous - However, there's no mention of |
@sprig Yes, that was a typo, I've now fixed that, thanks. 😄
Note: I've set On a system with Sonoma 14.5 on
On a system on Sonoma 14.6 on
Out of the box, this is a broken symlink. This is from a machine with Sonoma 14.6 on
I also jumped into macOS recovery on a machine running Sonoma 14.6 on There's no By default, the user data partition isn't mounted, and the (sealed) OS partition is mounted as read-only at All of the macOS systems I used have always had system integrity protection enabled. I'll leave reproducing this on a fresh install of macOS as an exercise for the reader. 😄
@D54 You'll have run this every time you log in. GUI app compatibility is one of the draw-backs of not using Apple's provided By comparison, the work-around I proposed works with everything that Apple's default |
Wow! What an active and amazing community we have! ❤️ I'll try to answer the unanswered questions and correct, as best as I can, a few things. |
I'm guessing this is because of #53 We don't actually have a process running we just use the service to set the
I've never seen this before and the output is not something we do. Uninstall and reinstall to get the correct version. |
This is basically it. Apple released a new version and it had an unintended bug in it by removing environment variables from system agents that is set by Why do we classify this as a bug?
AFAICT |
@micolous proposed work-around works. Homebrew doesn't want us to write to |
If I understand the logic correctly if This is also why you don't get a password prompt with |
@micolous and @D54 got me thinking of a very ugly idea... 😆 We could, and I just tried it - it works, in our launchd plist:
It's NOT pretty but it works. But since there are workarounds we'll wait a bit for Apple to fix it. We are not the only ones using But if you have a support contract please remember to contact Apple about it! |
Hi are you folks also seeing ssh-agent being unable to respond to connect requests after the update until ssh-add is called? |
|
14.6.1 is released, is it fixed or it is intended by apple? |
@zeyugao The issue is not fixed in Sonoma 14.6.1. If you want to test if a version of macOS is affected (without installing # Set SSH_ASKPASS to reject all requests, but only if it is unset.
[ -z "$(launchctl getenv SSH_ASKPASS)" ] && launchctl setenv SSH_ASKPASS /bin/false
# Check for SSH_ASKPASS from ssh-agent's environment
launchctl print gui/$UID/com.openssh.ssh-agent | grep SSH_ASKPASS If the second command returns nothing, then that version of macOS is affected by the issue. If the second command returns To explicitly unset launchctl unsetenv SSH_ASKPASS |
I don't think On a Sonoma 14.5
On a Sonoma 14.6.0 and 14.6.1
Interestingly, the security release notes for Sonoma 14.6 says:
There are similar patches for There aren't any publicly-available details around what that bug actually is, which is normal for an issue that's either privately disclosed or discovered internally at Apple. My outsider, armchair theory is:
There have been narrower environment variable restrictions in the past: the previous (open source) version of I still feel that this issue may be an unintended side-effect: Apple's default |
here is the workaround I am using: this stops any other ssh-agent, then uses its own socket env var to start the agent with custom config, then symlinks the original ssh socket to the custom one |
@MichaelRoosz Won't launchd use socket activation and start a new ssh-agent and inherit |
@simmel due to the symlink, socket activation will start the custom ssh-agent |
The workaround is actually pretty similar to this workaround posted earlier, but automates the socket symlinking hack at the end. All of the
In any case, if a future macOS version starts protecting Launching |
@micolous the setenv (at least SSH_SK_PROVIDER) are needed to make the other ssh tools pickup the FIDO2 provider lib. they are there for a reason. SSH_ASKPASS was needed to make ssh work when used by ansible, if I remember correctly, but it surely does not hurt to set it. to be honest, it is a shame that Apple does not support setting these configs in an easy way without needing to use those workarounds. I really hope they properly implement a way to configure the ssh-agent before they mess it up even more. |
From the comments and suggestions here, I tried to use the workaround masking the system I compiled my solution into a gist (https://gist.github.com/lepus2589/5235d78172e529b2d076d2c0e9670b27). Feel free to test it and to give feedback! |
I made a self-contained installer / uninstaller here. The script is aware of the 1Password location – because that's what I use – but if there's a similarly pre-defined socket path for AskPass, just add it here before running the script.
|
Just after update to Sonoma 14.6 today I get:
Same for my co-worker, it definitely worked ok on 14.5 just before this update (hours ago).
The text was updated successfully, but these errors were encountered: