database64128 3 hours ago

Security features like this works, until it doesn't.

When I installed WireGuard on macOS, I was happy to discover that it stores private keys in the system keychain. Accessing the private key requires Touch ID.

Then one day after a system upgrade, the WireGuard app crashed on startup with:

  [APP] Unable to open config from keychain: -25300

Then the app deleted all profiles because they are all "orphaned", apparently for "keychain consistency" [0].

From then on, I just use a text editor to edit my WireGuard configuration files, and import them to the app. The bug still exists to this day [1].

[0] https://github.com/WireGuard/wireguard-apple/commit/dfb685f2...

[1] https://www.reddit.com/r/WireGuard/comments/wyt828/osx_wireg...

  • redrove 3 hours ago

    Developing for macos, I’ve gotten bit by keychain consistency issues far too many times. It’s a mess.

    • wpm 2 hours ago

      So many of the keychain APIs are "deprecated" (read: marked as "we will nuke this API whenever we want") and have been for a decade or more, but have no replacement either.

      A lot of the Security Framework came from Classic, hell, the idea of a keychain came from Classic! Just a mess.

  • cl3misch 3 hours ago

    > The bug still exists to this day

    You linked a commit and a Reddit post. Is there a proper Github issue as well?

    • andersonpico 3 hours ago

      from his link:

        Edit (March 2025):
        Wireguard, to my surprise, has no bug tracking system like Jira or issue tracking area such as GitHub.
        If you want to see this fixed, the only way to instigate change is to write team@wireguard.com and jason@zx2c4.com.
    • database64128 3 hours ago

      > You linked a commit and a Reddit post. Is there a proper Github issue as well?

      It's funny you mentioned that. The GitHub repository is a mirror of https://git.zx2c4.com/wireguard-apple. You cannot create issues there. You're supposed to send a bug report to the mailing list, which is enough friction that none of us did so far.

      • Barbing 2 hours ago

        >enough friction that none of us did so far.

        Emailed per https://news.ycombinator.com/item?id=50450200

        Definitely still a bug right? Linked them to your parent comment.

        Edit: oops sorry team, think you're on it (4d ago): https://github.com/whyredfire/wireguard-apple/commit/0bac142...

        Guess it can serve as feedback on the friction when issues can't simply be opened though!

        • database64128 2 hours ago

          > Definitely still a bug right? Linked them to your parent comment.

          Thanks! Yes, it is still a bug.

          > Edit: oops sorry team, think you're on it (4d ago)

          I don't think @zx2c4 has seen this PR, and the author of the PR has not sent a bug report yet, so it's probably fine :P

          • traceroute66 33 minutes ago

            > Thanks! Yes, it is still a bug.

            Its unfortunate no updates for Wireguard macOS have been pushed out for 3 years, App Store is still showing 1.0.16 as the latest version – as also confirmed on the Wireguard website at the latest version.

            No doubt macOS APIs have moved on a lot in 3 years and so perhaps bugs that are being seen are simply a reflection of the lack of updates to keep up with API changes ? Just thinking aloud here, I don't know if the concept of OS API changes are applicable to this particular PR / bug.

      • encom 1 hour ago

        >friction

        I appreciate when both options exist, because I've passed on reporting so many bugs, because I refuse to create a Microsoft account to do it.

        In fact, I don't understand how sending an email is high friction.

        • database64128 48 minutes ago

          > I've passed on reporting so many bugs, because I refuse to create a Microsoft account to do it.

          99% of the time it's perfectly fine to just email the maintainer with a bug report and maybe a patch.

          > In fact, I don't understand how sending an email is high friction.

          Judging from the fact that after so many years, such a widespread (as seen in the Reddit post and here) issue still hasn't resulted in a single bug report in the mailing list, I'd say most people (including myself) do indeed consider using a mailing list to be higher friction.

          If I'm not mistaken, unless you're already CC'ed by a participant, you'd have to subscribe to the whole mailing list just to receive notifications for a single thread. For an "issue" on a Git forge, participation is usually as easy as upvoting and then clicking the "Subscribe" button.

          • encom 37 minutes ago

            Assuming you're already using MS Github. Anyway, even if I was, a lot of Github project require filling out an absurd Simon Says form. Or that scene from Indiana Jones where he takes a wrong step and falls through the floor. That's nothing to do with email or Microsoft specifically, it's just another reason I almost never bother reporting bugs. Talk about friction.

            • database64128 16 minutes ago

              Yeah, I hate these forms (issue templates) too. Every time I have to fill such a form, I always feel that they are discouraging me from writing the bug description in a natural, coherent way. I'd spend more effort to make sure the description is clear and contains all necessary information, if there's no issue template requirements.

  • con 3 hours ago

    I had this as well - funny enough I asked my local AI to "find the removed config" and it was able to restore everything.

    • database64128 2 hours ago

      Lucky for you! I first ran into this before AI agents were a thing, so :(

  • raverbashing 38 minutes ago

    There are features built for security nerds (like PGP/GPG, etc)

    And features built for normal people

    The overlap is very rare

    • sysguest 32 minutes ago

      well but deletion isn't what even those "security nerds" would have expected...

      • adastra22 21 minutes ago

        Security nerd here. I would have expected it. But only in the sense that I have no faith in this industry to write secure software and protect from data loss.

jen729w 1 hour ago

I use 1Password's `op` for this, but with an allowance: my dev environment keys.

I found I was getting fingerprint fatigue. Do I need a fingerprint request every time my dev server wants to connect to dev Supabase? No. That's expected, and zero risk. There's no data there.

I worried that a nefarious request would be auto-approved by me. When you see 20 requests a day, your muscle memory just reaches for the sensor.

So I have a separate 1Password vault that a service account [0] can read. That token is in my environment as OP_SERVICE_ACCOUNT_TOKEN, which the `op` tool understands.

It also has access to a vault with 'AI-safe' keys that I want Claude to be able to access without asking me.

Now, these requests work invisibly. And when I see a fingerprint popup, it's unusual, and I don't auto-approve by habit.

I also keep an item called '_One-day keys' in a separate vault. (The underscore just pushing it to the top of the list for easy access.)

It has prod keys, mostly restricted read-only. If required, I move that over to the open vault. Claude knows this item and has instructions to remind me to move it back out when it's finished what it was doing.

[0]: https://www.1password.dev/service-accounts/get-started

  • earthpyy 1 hour ago

    1Password + `op` cli is a good alternative choice here.

mavam 53 minutes ago

One fundamental problem with agentic development is that accessing the secure enclave key requires human presence. If you're running headless and aren't logged in, Secretive (not sure about others) will not be able to access the enclave, even when you only chose "notify" and not "touchid".

This is why I'm skeptical that the approach can scale reliably, even though I'm relying on it today. (Yes, PATs would fix this, but the enclave model is what I'm trying to retain for now.) What I've done instead is wrote a small daemon that sets the SSH authentication socket and does agent forwarding. This works when I'm traveling with laptop...but not yet from my mobile phone.

Example:

    Laptop                                   Remote Mac
   ┌─────────────────────┐                  ┌──────────────────────────┐
   │ Secretive           │                  │ ssh / git commit -S      │
   │ (Secure Enclave)    │                  │          │               │
   │        ▲            │  ForwardAgent    │          ▼               │
   │        └── ssh ─────┼─────────────────►│  ~/.ssh/agent.sock       │
   │                     │                  │  (stable proxy)          │
   └─────────────────────┘                  │      │          │        │
                                            │      ▼          ▼        │
                                            │  forwarded   local       │
                                            │  laptop      Secretive   │
                                            │  agent       (if you sit │
                                            │              at this Mac)│
                                            └──────────────────────────┘

NB: I'm not using Rex instead of herdr and because Rex uses its own protocol, I always need to have one SSH tunnel to reset the remote agent socket. Not optimal, but it works. All of this feels wrong from a UX perspective, and it feels like I'm holding on too hard on secure enclave for what my use cases are. Feedback appreciated!

LeBit 2 hours ago

The article starts on an incorrect premise.

The author says he doesn’t like the idea of having keys sitting on his file system ready to be snatched by bad actors.

That’s why they should be passphrase protected.

You use ssh agent to store the keys in memory and for convenience you can store the passphrases in keychain. MacOS OpenSSH has the UseKeychain config directive for that.

I use Yubikey/FIDO2 myself, but not because private keys cannot be protected on a file system.

  • chicagobuss 2 hours ago

    was wondering the exact same thing. dude never heard of passphrases?

  • Gigachad 2 hours ago

    Secure Enclave is still more secure in that it should be impossible to access the private key. Password protected keys are still vulnerable to malware that can read the keyboard, trick you in to typing the password, or that have exploits in macOS to read the memory.

  • Jakob 2 hours ago

    Isn’t the macOS keychain user-readable by default?

    Assuming the attacker has user rights (which it needs to read the key) it could also read the passphrase, right?

    Update: I tried it out and stand corrected. ssh-add doesn’t store it in the user-readable keychain. So the passphrase is protected. (And also not recoverable by the user).

  • mjg59 1 hour ago

    Do you type your passphrase every time you log into a remote machine? If not, the private key is in RAM and can be extracted by malware and stolen. If so, that's way more annoying than using touchid or some other physical proof of presence.

    • elmimmo 1 hour ago

      I used to install ssh_locker [1] (I don’t know if it still works), and have the passphrase in a keychain separate from the default `login` that I then set in Keychain Access to autolock after a set period of time. Handy for keeping the private key for a while in RAM and then autoremoved, instead of having it there for the whole session. It worked transparently and is a feature that should come with the OS.

      [1]: https://github.com/ddribin/ssh_locker

      • elmimmo 44 minutes ago

        ChatGPT says ssh_locker locked the keys with `ssh-add -x` which doesn’t necessarily remove them from RAM. Duh! It does point to suggested minimal changes to its source code to effectively accomplish that though.

dsenkus 3 hours ago

These days I'm mainly doing development inside VM's. Previously I was embedding Github key to each VM, but since I setup Secure Enclave (with Secretive), I'm only forwarding it's agent to VM and each git action on origin now requires approval using fingerprint reader. I think this a good way to prevent malware from gaining access to github

  • LeBit 2 hours ago

    Why not use PAT?

    I’ve grown to appreciate ssh should only be used with git for signing commits and as a deploy key (eg in a CI system).

    I always use https for day to day git operations. My keys reside in gopass and are extracted by gopass-git-credential when needed by git.

    I use that within devcontainers

    https://github.com/gopasspw/git-credential-gopass

    • Gigachad 2 hours ago

      Those access token can still be stolen just the same. The Secure Enclave is better because you can ask it to authorise the action, but you can never get the key out of it, so the latest malicious npm package can’t send off your access tokens or ssh keys.

      • dsenkus 1 hour ago

        absolute security does not exist, but each small improvement adds up. I quite like having to authorize each remote git action with Touch ID.

    • Jakob 2 hours ago

      PAT are vulnerable, once stolen they can be used from anywhere until their (usually) long term expiry.

      Better use short lived tokens with auto refresh. For example OAuth tokens. They can be used for the same use cases like PAT, but they expire after a max of 2 hours.

      • masklinn 2 hours ago

        Which oauth tokens are you talking about? Because GitHub’s created by oauth or gh apps have a lifetime of either 8h or forever.

        • Jakob 1 hour ago

          Gitlab uses 2h. TIL that GitHub uses 8h.

          • eddythompson80 23 minutes ago

            2 hours is plenty. The recent binance hack was 20 minutes after all. A 2 hour token is enough time to get all that can be gotten or done by a token in almost any system especially well defined ones like GH or GL.

            It would be nice if GitHub or GitLab could limit a token to a given IP, but with how proxies and dynamic ips work I would imagine it would be a hassle to get it working correctly for everyone, but it’s better than nothing.

computerfriend 1 hour ago

I wish there was a way to cache the touch. As it stands, this is mostly unusable for commit signing in a rebase-heavy workflow.

  • szenrom 59 minutes ago

    In case you want to just have an encrypted SSH key with password in keychain, you can make it work automatically when logged in (and when Mac is unlocked) by putting in .ssh/config:

      Host github.com
        AddKeysToAgent yes
        UseKeychain yes
        IdentityFile ~/.ssh/id_ed25519
    

    Docs: https://docs.github.com/en/authentication/connecting-to-gith...

larusso 4 hours ago

I used yubikeys for ssh for years. First via the older clunky gpg as ssh key feature. Then via the FIDO api. My biggest issue was the chicken and egg issue when using this setup on a new machine or god forbid in a container etc. windows and WLS wasn’t super thrilled either. I switched to 1Password ssh because I actually like the fact that I can simply share my keys. It’s still not perfect. Agent forwarding needs an extra configuration and depending how many keys you have and how verbose your ssh config gets it becomes also very finicky. This solution feels for me like a slight setback because it’s a macOS only solution. If you have a Linux or windows machine next to a Mac you have to deal with the insecure key file on your hard drive again either via yubi keys or software solutions.

But I think I would take this over a yubikey. I really disliked the fact that one usb port was constantly in use.

  • nubb 3 hours ago

    you can’t just pop it out once you’re logged in?

    • larusso 3 hours ago

      Sure and pop in whenever I do a git commit? I also sign my commits. I used GPG (different key on the same hardware key) and now via SSH key. I had both a compact and bigger key. I got the compact key because my very first yubikey nearly broke. I lifted my Mac while it was connected and it cracked in the middle. I bought a compact one next which can stay inside and that one you don’t want to take out. It’s so small you’ll lose it. I know because that happened to my backup key … (that was actually the idea for the bigger one I bought but I lost the damn thing during the setup phase) But having the yubikey bound to your Mac at all times is also stupid because it doesn’t come with a fingerprint or other biometric sensor. The idea is that you use this thing as a token not that you leave the key in the lock at all times. For that alone I would favor the enclave solution.

      • LeBit 2 hours ago

        The Yubikey 5 Nano and 5C Nano DO come with touch.

        The idea is precisely that you keep them permanently connected in the laptop.

  • 0xCMP 2 hours ago

    The way I think of it is YubiKeys should be used to basically provision a computer with an approved device specific key. Whether it's a passkey or SE/TPM secured SSH/GPG/TLS key: the Yubikey holds the credential everyone trusts and therefore can be used from any device to gain access and enroll a new approved key.

  • LeBit 2 hours ago

    Why do you share private keys?

    SSH private keys should be passphrase protected.

    You don’t have to do that if you use FIDO2 with a Yubikey.

    • larusso 2 hours ago

      Share as in storing my key in 1Password and use it from different machines. I generated the key from 1Password and don’t intend to export it.

newman314 54 minutes ago

The thing I don't like about the Secure Enclave is that it does not yet support ed25519 keys.

devsda 2 hours ago

What's the general consensus around ssh-agent?

It's often the case that we make much effort into securing the key but expose it via an open agent socket at a well known path or use an open control master path for multiplexing.

Certain automation and dev tools like Ansible make it a pain to work if agent key requires a confirmation.

  • petesergeant 2 hours ago

    Weirdly enough, this is _why_ I ended up using Secretive: I needed a second ssh-agent because selecting which keys are forwarded per-host is very fiddly, and while standard ssh-agent kinda supports it, 1Password doesn't. Anyway, _a_ solution for this is having separate SSH agents, and Secretive is another agent on top of 1Password.

dostick 29 minutes ago

Isn't a GitHub app project Secretive doing that but better?

sandeepkd 2 hours ago

Not sure how many people feel like this, the risk in plain sight is a lot easier to handle than the risk hiding under the layers. You can keep shifting the storage for the key, one way or another you have to open up a channel to access to key or use the key. That channel would then become the vulnerability target.

  • Vegenoid 1 hour ago

    To prove possession of a private key, one needs only to sign something with that key (this is how SSH key auth works). This is how things like the macOS Secure Enclave operate - the private key is stored in a separate hardware chip that only exposes an interface to sign something with that key, never to actually present the key. To obtain the key would require having physical access to the computer, ripping it open, and performing advanced deconstruction and analysis of that chip.

    • sandeepkd 1 hour ago

      I dont want to be rude, I am aware of the operational semantics. Getting what you want to be signed with the key is the external channel operation I was referring to. In this particular case, somehow the attack vector being disabled is the actual private key being locked from any export. This gives a sense of security, however the channel abuse can bypass the security.

computerfriend 1 hour ago

> That ssh: at the end is the FIDO2 application ID — it’s part of the key, not a comment.

I think this is incorrect and the "ssh:" at the end is indeed a comment.

Gigachad 4 hours ago

I was looking in to this just earlier today. The native macos version worries me a little because it seems someone just happened to discover it in MacOS, rather than it being a documented feature. The worry being Apple could change or remove it later locking you out of your keys since they never advertised this as a thing you could do.

  • cavoirom 4 hours ago

    It is the same as you lost your device. You must have a second backup key, and treat one in Secure Enclave as disposable key.

petesergeant 4 hours ago

I've been using Secretive (a nice software wrapper for these) for a few days for my Github keys (where 1Password holds the rest of my SSH keys). It works nicely, but obviously you can't back up a key that started life in a secure enclave, so you'll need alternative access arrangements for anything you setup that way.

  • johng 3 hours ago

    2nd this. Found out about it when this type of thing came up about a week ago. I had a hard time getting the stock stuff going but Secretive made it easy to set up and I love using it.

    Definitely a recco from me as well. -- git hub here: https://github.com/maxgoedjen/secretive

bdamm 4 hours ago

We should have had this 20 years ago. It is almost pathological how difficult it is to reliably use hardware keys as ssh credentials.

  • DaSHacka 3 hours ago

    ed25519-sk werks on my machine...

    Unless you specifically mean (f)TPMs/secure envlaves.