• taco_shale032@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      3 days ago

      I think that’s exactly what a password manager would do essentially, just in a user friendlier way.

      • lucas@startrek.website
        link
        fedilink
        English
        arrow-up
        0
        ·
        3 days ago

        How could it possibly be more user friendly than what is already and completely seamlessly integrated into the typical SSH flow?

        • jj4211@lemmy.world
          link
          fedilink
          English
          arrow-up
          0
          ·
          2 days ago

          So it’s super easy for me day to day, I log in and my login password also drives add to the ssh agent.

          However, ssh-keygen and ssh-add and setting all that up is gasp a command line process and you actively have to search up how to do it.

          Password managers offer gui driving the oblivious user to do the same thing.

          I much prefer my way, but I would be tempted to indicate a password manager application if I’m having to tell someone else how to do it, especially in Windows where I don’t think you can integrate it as nicely.

          • lucas@startrek.website
            link
            fedilink
            English
            arrow-up
            1
            ·
            2 days ago

            But SSH is already a command line tool? Besides, the guide in the article itself includes several steps of configuration (most likely in the command line) to set this agent up. I don’t really understand what ‘command-line process’ supposedly needs actively searching how to do it? Is it really that hard to remember (or tab-complete) ssh-keygen then follow interactive prompts?

            I feel like maybe I’m missing something here, and I’m not saying there can’t be reasons to do this, but I’m not following any ‘simplicity’ angle, given that all it’s doing is adding extra steps.

      • jj4211@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 days ago

        You use ssh-agent and ssh-add to take the passphrase hit once, then on disk copy is protected and it is mostly password less.

        Mine unlocks with PAM, so on login without additional step.

  • SavvyWolf@pawb.social
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 days ago

    To just make this absolutely clear, this means that the private keys are vulnerable to be exiltrated by malicious code scanning my disk.

    If you have malicious code capable of scanning your disk it’s basically game over anyway. They can intercept your passwords and ssh connection no matter what you do.

    What’s the security model here? An app that gets user account access but gives it up if it can’t find exactly ssh keys?

    • cow@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      2 days ago

      What’s the security model here? An app that gets user account access but gives it up if it can’t find exactly ssh keys?

      My guess is that a malicious package is scanning your home directory for stuff like SSH keys, GPG keys, AWS keys, etc. It would have filesystem access permission already in the MacOS sandbox due to running inside a common interpreter like node or python, but it might be restricted from stuff like attaching to other processes memory, where it could just get the keys out of bitwarden.

      Could also just be obscurity as most infostealers are programmed to grab keys from common locations and not many developers use bitwarden for keys.

      If you want something resistant to a fully compromised system you need to use something hardware backed, whether an external key or an internal secure enclave.

      • cow@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        4 hours ago

        Ok I played with this, made a very trivial encoding with 16 words in python for fun today.

        code
        from cryptography.hazmat.primitives import serialization
        from cryptography.hazmat.primitives.asymmetric import ed25519
        import itertools
        import sys
        
        if sys.argv[1] == "words":
            with open("wordlist-65536.txt", "r") as f:
                words = [x.strip().lower() for x in f.readlines()]
        
            assert len(words) == 65536
        
            k = serialization.load_ssh_private_key(open(sys.argv[2], "rb").read(),
                                                   password=None)
        
            j = k.private_bytes(encoding=serialization.Encoding.Raw,
                                format=serialization.PrivateFormat.Raw,
                                encryption_algorithm=serialization.NoEncryption())
        
            for a, b in itertools.batched(j, n=2):
                z = a << 8
                if b is not None:
                    z = z | b
        
                print(words[z], end=" ")
        
            print()
        
        elif sys.argv[1] == "key":
            seed = [x.strip() for x in input("Enter your mnemonic ssh key: ").split()]
            assert len(seed) == 16
        
            with open("wordlist-65536.txt", "r") as f:
                words = [x.strip().lower() for x in f.readlines()]
        
            assert len(words) == 65536
        
            words_map = {}
            for i, word in enumerate(words):
                words_map[word] = i
        
            k = bytearray()
            for word in seed:
                z = words_map[word]
        
                b = z & 0xff
                a = (z >> 8) & 0xff
        
                k.append(a)
                k.append(b)
        
            k2 = ed25519.Ed25519PrivateKey.from_private_bytes(k)
        
            private_bytes = k2.private_bytes(
                encoding=serialization.Encoding.PEM,
                format=serialization.PrivateFormat.OpenSSH,
                encryption_algorithm=serialization.NoEncryption())
        
            open(sys.argv[2], "wb+").write(private_bytes)
        ```:::
        
    • taco_shale032@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      3 days ago

      You can self host Bitwarden, which is what I assumed most people in this community do.

      I’m not entirely sure why this got downvoted, it’s not a terrible idea to put your keys in your password manager rather than leave them on disk in plain text.

      • rako@tarte.nuage-libre.fr
        link
        fedilink
        Français
        arrow-up
        0
        ·
        3 days ago

        The title is misleading. There’s no problem with keeping ssh private keys on disk, there’s a problem with keeping private keys in cleartext. OpenSSH keys are always encrypted on your disk, unless you have no passphrase, which is just stupid and the very first thing you must solve.

        Once you have a passphrase there is no problem. Of course don’t store the passphrase on disk, store it… in your password manager.

        Your post is a solution to a problem that doesn’t exist and is a result of a lack of knowledge. Yet the blog post.

      • i_am_not_a_robot@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        1
        ·
        3 days ago

        I’ve never tried it, but another option is ssh-tpm-agent or tpm2-pkcs11. Basically they use the TPM as a non-removable smart card, which is free and potentially more secure than a regular smart card because a smart card can’t normally verify the integrity of the OS that is talking to it. If you’re connecting from a Mac, Apple’s system is called Secure Enclave.