- Notifications
You must be signed in to change notification settings - Fork29
arekinath/pivy
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Simple-to-use PIV client for Linux and OSX. Includes the toolspivy-tool,pivy-agent,pivy-box andpivy-zfs.
This is an implementation of a simple PIV client for desktop Linux and OSX withminimal dependencies. It contains apivy-tool binary which can conduct basicoperations using PIV cards, and thepivy-agent, which implements the SSH agentprotocol as a drop-in replacement for the OpenSSHssh-agent command (exceptthat the keys it contains are always on a PIV card).
"PIV cards" notably includes Yubico Yubikey devices such as the NEO andYubikey4, which can store up to 24 keys by using the "retired key" slots (whichthis agent supports).
This project re-uses most of the agent and protocol parsing code from OpenSSH,where it’s been pretty thoroughly battle-hardened.
Using the PIV agent is identical to running the normalssh-agent command,with the exception thatpivy-agent requires a-g argument specifying theGUID of the PIV card to attach to, and you don’t have to usessh-add to loadany keys. You can also give a-K argument with the public key of the"Card Authentication" slot (9E) for extra security.
For example, the GUID of my PIV card is995E171383029CDA0D9CDBDBAD580813 (ifyou don’t know your GUID, thepivy-tool command can display it). I can use thefollowing command to start thepivy-agent against my card:
$ pivy-agent -g 995E171383029CDA0D9CDBDBAD580813 bash$ ssh-add -l256 SHA256:PJ6ucGKUqlQhiJdArDaF65+AVImg8SVq77vL6nVE/ME PIV_slot_9C /CN=Digital Signature (ECDSA)256 SHA256:U86TVxP/gxVk4CQibIWit3Q+/5i4aZuXa2NALIahjww PIV_slot_9E /CN=Card Authentication (ECDSA)
I can now use the 9E Card Authentication key withssh or any other tools thatuse speak the OpenSSH agent protocol (e.g. the Joyentmanta andtritontools). If I try to use the 9C Digital Signature key right now though, I willget an error like this:
$ ssh user@hostsign_and_send_pubkey: signing failed: agent refused operationuser@host: Permission denied (publickey).
To use the 9C key I will have to give my PIV PIN to the agent so that it canunlock the card to use the key. I can do this either by starting the agent withan environment variableSSH_ASKPASS set (in which case I will get a graphicalprompt for the PIN), or by using the commandssh-add -X:
$ ssh-add -XEnter lock password:Agent unlocked.$ ssh user@hostLast login: Wed Mar 28 21:56:11 2018 from laptop[user@host ~]$
The PIV PIN is stored in memory only with special guard pages allocated eitherside of it and marked non-swappable. On Linux the memory area is also marked asnon-dumpable so that it does not appear in core files.
You can make the agent forget the PIN by using thessh-add -x command to"lock" it. You can supply any password you like (including an empty string)for the "lock" command. The commandssh-add -D can also be used, and will notprompt for a password (useful from scripts).
The agent will also forget the PIN automatically if the PIV card is unavailablefor more than a few minutes, or if unusual conditions occur (e.g. an attackertries to plug in a device with the same GUID that fails the 9E signature test).
Note that it’s perfectly fine to leave thepivy-agent running and remove yourPIV card: the agent will just return errors on any attempt to use it untilyou insert your card again (you will need to enter your PIN again). You caneven start the agent without the PIV card present at all.
One useful way to use thepivy-agent is to set up a systemd unit file for itto run whenever you log in, and adjust your shell profile to use it as yournormal SSH agent. Then your PIV keys are automatically ready for use in anyshell.
You can also start thepivy-agent with mode-C, which indicates that itshould prompt for confirmation (by running the program specified in theSSH_CONFIRM environment variable).
Unlike the regularssh-agent,pivy-agent only prompts for confirmation onceper connection to the agent, and only for connections which are forwarded viaSSH agent forwarding (unless you give the option twice, as-CC, in which caseevery connection is confirmed). This makes the option more suitable for regularuse: local programs don’t necessarily need prompting, and programs which makerepeated use of your keys to perform operations will only pop up one prompt.
TheSSH_CONFIRM environment variable can be given as a path to thezenitytool if desired — pivy-agent will generate appropriate arguments itself.
If you use agent forwarding (ssh -A), use of this mode is highly recommended.
pivy-agent supports the sameSSH_ASKPASS environment variable and interfacethatssh-add does for presenting a GUI prompt for the PIN if desired.
If the environment variableSSH_NOTIFY_SEND is set to a path to a commandwhich acts likenotify-send (takes two arguments, title and message), thenpivy-agent will also run that command whenever it believes a touchconfirmation may be required.
Thepivy-tool program can perform a variety of operations against PIV tokenson the system, including simply listing the available tokens and their state:
$ pivy-tool list card: 562A20E4 device: Yubico YubiKey OTP+FIDO+CCID 00 00 chuid: ok guid: 562A20E42ED0E5813C530ED7FE75BE92 fasc-n: 00000000000000000000000000000000000000000000000000 expiry: 2050-01-01 yubico: implements YubicoPIV extensions (v5.1.2) serial: 9073851 auth: PIN* slots: ID TYPE BITS CERTIFICATE 9e ECDSA 256 /title=piv-card-auth/CN=562A20E42ED0E5813C530ED7FE75BE92 9a ECDSA 256 /title=piv-auth/CN=562A20E42ED0E5813C530ED7FE75BE92 9c RSA 2048 /title=piv-sign/CN=562A20E42ED0E5813C530ED7FE75BE92 9d ECDSA 256 /title=piv-key-mgmt/CN=562A20E42ED0E5813C530ED7FE75BE92
You can see a short summary of the commands available by runningpivy-toolwithout any arguments:
$ pivy-toolpivy-tool: operation requiredusage: pivy-tool [options] <operation>Available operations: list Lists PIV tokens present pubkey <slot> Outputs a public key in SSH format cert <slot> Outputs DER certificate from slot init Writes GUID and card capabilities (used to init a new Yubico PIV) setup Quick setup procedure for new YubiKey (does init + generate + change-pin + change-puk + set-admin) generate <slot> Generate a new private key and a self-signed cert import <slot> Accept a SSH private key on stdin and import it to a Yubikey (generates a self-signed cert to go with it) change-pin Changes the PIV PIN change-puk Changes the PIV PUK reset-pin Resets the PIN using the PUK factory-reset Factory reset the PIV applet on a Yubikey, once the PIN and PUK are both locked (max retries used) set-admin <hex|@file> Sets the admin 3DES key sign <slot> Signs data on stdin ecdh <slot> Do ECDH with pubkey on stdin auth <slot> Does a round-trip signature test to verify that the pubkey on stdin matches the one in the slot attest <slot> (Yubikey only) Output attestation cert and chain for a given slot. box [slot] Encrypts stdin data with an ECDH box unbox Decrypts stdin data with an ECDH box Chooses token and slot automatically box-info Prints metadata about a box from stdin...
I recommend that new users run thepivy-tool setup command — it willinitialise the PIV applet and then generate a standard set of basic keyswhich will suit most users.
Thesetup command will prompt you to set a PIN and PUK, as well as generatingkeys. The PIV PIN and PUK are both secret strings of 6-8 ASCII characterswhich are used to protect access to your device. In the PIV spec, these stringsare required to be numeric (consisting only of digits 0 through 9), but manyPIV devices such as YubiKeys will allow a much wider variety of characters.
The PIN is what you will normally use to authenticate to your device and unlockthe use of private keys. By default, 5 invalid attempts to validate the PIN areallowed before it becomes locked. The PUK is intended as a fall-back if the PINis forgotten, and can be used to reset it when locked. If you supply the PUKincorrectly 3 times (by default), then the card/device becomes locked down andwill generally destroy its private keys.
It’s fine for personal use to set the PIN and PUK to the same value. The PUKis best used in an organisational context where devices are being provisionedfor users centrally — it can be securely stored rather than given to the userand used to help unlock devices when PINs have been forgotten.
In a PIV device/card, your keys are stored in a fixed set of "slots", whichare known by their numbered slot IDs.
The different key "slots" (9a,9c,9d and9e) have different assignedpurposes in the PIV spec, but YubiKeys and a lot of compatible devices are notvery strict in enforcing these.
If you want detailed information about how the slots are intended to be used,you should consultNIST SP 800-73-4 (the PIV standard),but I will attempt a short summary here:
9E: Card Authentication Key (often styled as "CAK"). This key is intendedto authenticate only thedevice/card, not the person who owns it. Itdefaults to not requiring any authentication to use (no PIN, no touchconfirmation on YubiKeys). Inpivy-agent, for example, this slot is usedto check that the device it’s talking to is actually the device it’s supposedto be (and not an attacker replacement with the same ID) before giving itthe user’s PIN.9A: PIV Authentication Key. This is the main key used to authenticate theowner of the card/device. It’s protected by the PIN by default. You shoulduse this key as your primary option for signature authentication (e.g. thisis the key you should add to.ssh/authorized_keysor GitHub).9C: Signature Key. This key is intended for use signing documents orcertificates. Since this purpose is not as common as authentication amongstusers ofpivy, it also serves duty as a backup authentication key. If youneed to SSH or auth to a system that does not support EC keys, this key isan RSA key so that you can use it as a fallback for the9Akey. It requiresa PIN by default, like9A.9D: Key Management Key. This key is intended for use only to derivesymmetric keys to encrypt/decrypt data. It’s a matter of some controversyin the cryptography community whether it’s entirely safe to use the same ECkey both for signing and key derivation (ECDH), so I would recommend youavoid signing arbitrary data with your9Dkey (don’t use it for regularauthentication). See the next section for more information about using thiskey to encrypt data at rest. Requires both PIN and touch confirmation (onYubiKeys).
As well as these 4 basic slots, there are also the "Retired Key Management"slots,82 through95. These are intended for rolling old previously-used9D keys into so that you can continue to decrypt data protected by them ona new device. However, as usual, YubiKeys do not enforce this usage, and theseslots can be used for anything you like.
If you need to import an existing key into your YubiKey, I would recommend usingone of these retired slots rather than placing it in one of the "main 4".
Note that using thepivy-agent for SSH authentication becomes more complexwhen you have more than 4 keys available — most SSH servers default toMaxAuthTries 6 in their configuration, and each key counts as a "try", soif you connect with an agent that contains 6 keys, no other auth methods can beattempted (so you will never fall back to trying password/interactive auth). Ifneeded, you can work around this with theIdentitesOnly SSH configurationoption.
Thepivy-box command provides facilities for managing encrypted data storageusing EC keys. It’s particularly notable for its approach to "recovery" to handlethe situation where your PIV token is lost or damaged.
In short, an ebox generated bypivy-box can be unlocked either by a primaryPIV token,or by a set of N/M recovery PIV tokens. For example, you canhave a primary device you use to unlock an encrypted disk, and then if thatdevice fails, fall back to using any 3 out of a set of 5 recovery devicesinstead.
During recovery the devices being used don’t have to be physically connectedto the machine performing recovery, either — a system of encryptedchallenge-response messages (which you can copy-paste) can be used insteadto make use of a token at a remote location.
Eboxes are designed to be small enough to fit in a LUKS token JSON slot orZFS filesystem property so that they are colocated with the encrypted data.
The ebox primitive is based on thecrypto_box in libnacl/libsodium (afterwhich it was named). PIV doesn’t support Curve25519 today, though, so we useEC keys on the standard NIST P curves instead. ChaCha20+Poly1305 is still thedefault cipher and MAC combination used. GF^256 Shamir secret sharing is usedto achieve the N/M property during recovery.
Since the N/M recovery setup can involve a lot of typing (entering informationabout 5+ tokens),pivy-box lets you save just the metadata about which tokensyou want to use for your recovery setup in a "template" file. These aremanaged by thepivy-box tpl family of commands:
$ pivy-box tplpivy-box: operation requiredpivy-box tpl <op>: create Create a new template edit Edit an existing template show Pretty-print a template to stdout$ pivy-box tpl show -hshow: invalid option -- 'h'usage: pivy-box tpl show [-r] [tpl]Pretty-prints a template to stdout showing details ofdevices and configuration.Options: -r raw input, don't base64-decode stdinIf no [tpl] or -f given, expects template input on stdin.$ pivy-box tpl show backup-- template --version: 1configuration: type: recovery required: 2 parts part: guid: E6FB45BDE5146C5B21FCB9409524B98C name: xk1 key: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTY... part: guid: 051CD9B2177EB12374C798BB3462793E name: xk2 key: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTY... part: guid: D19BE1E0660AECFF0A9AF617540AFFB7 name: xk3 key: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTY...
Thepivy-box tpl create andtpl edit commands also include an interactivemenu-driven editor so you can make changes later:
$ pivy-box tpl edit -i backup-- Editing template --Select a configuration to edit: [1] recovery: any 2 of: E6FB45BD (xk1), 051CD9B2 (xk2), D19BE1E0 (xk3)Commands: [+] add new configuration [-] remove a configuration [w] write and exitChoice? 1-- Editing recovery config 1 --Select a part to edit: [1] E6FB45BD (xk1) [2] 051CD9B2 (xk2) [3] D19BE1E0 (xk3)Commands: [n] 2 parts required to recover data (change) [+] add new part/device [-] remove a part [x] finish and returnChoice? +GUID (in hex)? 562A20E42ED0E5813C530ED7FE75BE92Key? ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoY...-- Editing part 4 --Read-only attributes: GUID: 562A20E42ED0E5813C530ED7FE75BE92 Key: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoY...Select an attribute to change: [n] Name: (null) [c] Card Auth Key: (none set)Commands: [x] finish and returnChoice? nName for part? xk4-- Editing part 4 --Read-only attributes: GUID: 562A20E42ED0E5813C530ED7FE75BE92 Key: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoY...Select an attribute to change: [n] Name: xk4 [c] Card Auth Key: (none set)Commands: [x] finish and returnChoice? x-- Editing recovery config 1 --Select a part to edit: [1] E6FB45BD (xk1) [2] 051CD9B2 (xk2) [3] D19BE1E0 (xk3) [4] 562A20E4 (xk4)Commands: [n] 2 parts required to recover data (change) [+] add new part/device [-] remove a part [x] finish and returnChoice? x-- Editing template --Select a configuration to edit: [1] recovery: any 2 of: E6FB45BD (xk1), 051CD9B2 (xk2), D19BE1E0 (xk3), 562A20E4 (xk4)Commands: [+] add new configuration [-] remove a configuration [w] write and exitChoice? w
Of course, editing a template does not automatically re-encrypt any eboxes youhave already created from it. There is a re-encrypt command available underkey andstream though to help you update to a new template.
There are two different types of ebox supported:
A "key" ebox for storing small amounts of key material or other fixed-lengthdata (e.g. disk encryption master keys); and
A "stream" ebox which can handle large amounts of data without bufferingit all into memory, and can also be used in a seekable form.
In both types, no data is ever output by thepivy-box command from decryptionunless it has passed MAC validation (i.e. all forms available are authenticatedencryption).
An example of using a "key" ebox with ZFS encryption:
$ pivy-box tpl create foobar ...$ pivy-box key generate foobar -l 32 > /tmp/newkey.ebox$ pivy-box key unlock -R < /tmp/newkey.ebox | \ zfs create \ -o encryption=on -o keyformat=raw \ -o local:ebox="$(cat /tmp/newkey.ebox | tr -d '\n')" \ pool/filesystem$ rm /tmp/newkey.ebox$ zfs get -Ho value local:ebox pool/filesystem | \ pivy-box key unlock -R | \ zfs load-key pool/filesystem
Thepivy-zfs tool wraps these steps up into single commands:
$ pivy-box tpl create foobar ...$ pivy-zfs -t foobar zfs-create pool/filesystem$ pivy-zfs unlock pool/filesystem
Thepivy-zfs unlock command also will prompt you to add a new primary tokenif you finish recovery successfully, which also makes it preferable to scriptingthezfs load-key command yourself.
With LUKS/cryptsetup we can store the ebox data in a LUKS2 JSON token slot. Thepivy-luks tool handles formatting and unlocking LUKS2 partitions with theraw volume key encoded directly in the ebox and no passphrase keyslot:
$ pivy-box tpl create foobar ...$ pivy-luks format -t foobar /dev/sdx2$ pivy-luks unlock /dev/sdx2 volname
Othercryptsetup commands work on apivy-luks partition as normal:
$ cryptsetup luksDump /dev/sdx2LUKS header informationVersion: 2Epoch: 3Metadata area: 16384 [bytes]Keyslots area: 16744448 [bytes]UUID: c0b8d772-5418-4460-81c5-a5abe20b85faLabel: (no label)Subsystem: (no subsystem)Flags: (no flags)Data segments: 0: crypt offset: 16777216 [bytes] length: (whole device) cipher: aes-xts-plain64 sector: 4096 [bytes]Keyslots:Tokens: 1: eboxDigests: 0: pbkdf2 Hash: sha256 Iterations: 226376 Salt: fe 5a 67 a7 05 95 e5 06 61 be c5 aa 06 48 ca 97 2a fb c5 eb 0d 42 a1 83 bd 39 61 fb a8 2f 0b bb Digest: 8a 45 6b d0 2c cb 5d b2 51 25 db 3e fd 3a 6f fb e2 db 7a de c4 66 85 46 30 05 41 0e e8 eb 8d 3e
Note that the resulting LUKS header has no keyslots (so there is no passphrasethat will unlock the volume key for this partition, only the ebox).
Whenpivy-box key unlock orpivy-box stream decrypt run and cannot locatea "primary" token on the system that matches the box they are decrypting, theyenter an interactive recovery mode on the terminal.
First, recovery mode will prompt you to select the configuration and partsyou want to use for the recovery:
-- Recovery mode --Select a configuration to use for recovery: [1] recovery: any 2 of: E6FB45BD (xk1), 051CD9B2 (xk2), D19BE1E0 (xk3)Commands:Choice? 1-- Recovery config 1 --Select 2 parts to use for recovery [1] E6FB45BD (xk1) [2] 051CD9B2 (xk2) [3] D19BE1E0 (xk3)Commands:Choice? 1-- Select recovery method for part 1 --GUID: E6FB45BDE5146C5B21FCB9409524B98CName: xk1Public key (9d): ecdsa-sha2-nistp256 AAAAE2VjZHNhL... [x] Do not use* [l] Use locally (directly attached to this machine) [r] Use remotely (via challenge-response)Commands:Choice? r-- Recovery config 1 --Select 2 parts to use for recovery [1] E6FB45BD (xk1)* [remote/challenge-response] [2] 051CD9B2 (xk2) [3] D19BE1E0 (xk3)Commands:Choice? 2-- Select recovery method for part 2 --GUID: 051CD9B2177EB12374C798BB3462793EName: xk2Public key (9d): ecdsa-sha2-nistp256 AAAAE2VjZHN... [x] Do not use* [l] Use locally (directly attached to this machine) [r] Use remotely (via challenge-response)Commands:Choice? r-- Recovery config 1 --Select 2 parts to use for recovery [1] E6FB45BD (xk1)* [remote/challenge-response] [2] 051CD9B2 (xk2)* [remote/challenge-response] [3] D19BE1E0 (xk3) [r] begin recoveryCommands:Choice?
Once sufficient parts have been selected, you can choose the "Begin recovery"option. This will first try to locate any devices you’ve chosen for "local"recovery, prompting for insertion as you go. Then it will proceed to generatechallenges for remote recovery:
-- Begin challenge for remote device E6FB45BD (xk1) --sMUCARDm+0W95RRsWyH8uUCVJLmMnRFjaGFjaGEyMC1wb2x5MTMwNQZzaGE1MTIQFddAc+h16xsXZY9+WCgrBghuaXN0cDI1NiED4yZnwmPVfm0RlixV34blQg+mbRnF+GsLlhyGZojhd5YhA5Cbbob/i306qUbZpULvj9kmErWLvjVsyIiQC4ifpxM+AAAAAQB0JgTe6DAfCdO+dfs0uJvfjStT5w2bxdVJPcP3GR+BoL4yc2ETsa15vF1ST/I0lKGVFFEy/n0MsPZb03iOxbBN40nTXVQZtaSnjpNwinegzFGf6+kq1Tj8Kvgd8N5q3YRJxJ71hjgrH/lwFvSSUN3Njy8UWHDmhl9I2FHxzCUStFN/+G5Ihf5/KGyfDIzcWABcD4wh1wBraCdIgkTftKQQDcb5dHEvtlLeronpS4YfRaqdLRgQdnznFQxV/QnACU2CTD8olkWzgXy/kypkN97FhoJ3wltmnRSWInLTZ5WIzdTz6NkDdf61VsDcaCovcubGkVMuE090O8nuzFSdtObH-- End challenge for remote device E6FB45BD (xk1) --VERIFICATION WORDS for E6FB45BD (xk1): apple leadership sacred breakfast-- Begin challenge for remote device 051CD9B2 (xk2) --sMUCARAFHNmyF36xI3THmLs0Ynk+nRFjaGFjaGEyMC1wb2x5MTMwNQZzaGE1MTIQqxtt1txRzfWNpA2VotX1jQhuaXN0cDI1NiEC+lfqlhWdzpHFqVvRrE6tYls71VNZcmORxoIYnF9ORU4h...-- End challenge for remote device 051CD9B2 (xk2) --VERIFICATION WORDS for 051CD9B2 (xk2): jewellery academic powder syndicateRemaining responses required: * E6FB45BD (xk1) * 051CD9B2 (xk2)-- Enter response followed by newline -->
These base64-encoded challenge tokens are encrypted so that only the targetdevice can process them or retrieve any sensitive information. They do not,however, have any means to authenticate thesending machine on their own,which is the purpose of the "verification words".
As a result, you should transport the verification words separately to thechallenge itself — e.g. send the challenge over IRC or email, but send theverification words over Signal or read them over the phone.
The challenge does include additional information that can be verified totry to reduce the risk of replay as well, which will be displayed on theremote machine.
An example of responding to a challenge:
$ pivy-box challenge respondsMUCARAFHNmyF36xI3THmLs0Ynk+nRFjaGFjaGEyMC1wb2x5MTMwNQZzaGE1MTIQqxtt1txRzfWNpA2VotX1jQhuaXN0cDI1NiEC+lfqlhWdzpHFqVvRrE6tYls71VNZcmORxoIYnF9ORU4...^DEnter PIV PIN for token 051CD9B2:-- Challenge --Purpose recovery of at-rest encryption keysDescription Recovering pivy-box data for part 051CD9B2 (xk2)Hostname myraGenerated at 2019-04-12 12:43:39 (local time)VERIFICATION WORDS jewellery academic powder syndicatePlease check that these verification words match the original source via aseparate communications channel to the one used to transport the challengeitself.If these details are correct and you wish to respond, type 'YES': YES-- Begin response --sMUCAAAAEWNoYWNoYTIwLXBvbHkxMzA1BnNoYTUxMhALNQm7HuVbyMrjFMNjZjsNCG5pc3RwMjU2IQOqjFsNsLv8hotnZopkrjC2SDSSmMkXgQCK6kg78iev1yECfHZbB6dopyOImq3B1uLxj+LeTvry9IEN2YX9xKjk/OkAAAAAOLmaw9nVj0cSaAV21FbbIJvzpFBZBsZkiztabo7moHUEcXSeQ5v/0JDK1zuCQm3dg8mlPMkdu03o-- End response --
Responses to a challenge are not replayable, so they do not need separateverification words.
On Linux you will need to have a compiler and basic build tools and headersinstalled, as well as the librariespcsclite andlibbsd (and their-devpackages if your distro does those). Somemusl based distros will also requireinstallinglibedit.
If you’re using ArchLinux, we have apivy package in the AURwhich will compile and install the binaries for you.
If you’re compiling yourself, clone this repository and usemake to buildthe binaries:
$ git clone https://github.com/arekinath/pivy$ cd pivy$ make
You can then runmake install (as root or with sudo) to install the agent into/opt/pivy. The Makefile also supportsprefix=/… to use a different prefixrather than/opt/pivy, andDESTDIR= to stage the installation.
Themake setup invocation can be used to set up a user systemd service tostart it automatically at login. It will also print out lines to add to your.profile or.bashrc to make sure the agent is automatically available inall your shells (while still preferring a forwarded SSH agent if you SSH intoyour machine later).
$ make setupEnter a GUID to use for pivy-agent: 995E171383029CDA0D9CDBDBAD580813install -d /home/alex/.config/pivy-agentinstall .dist/default_config /home/alex/.config/pivy-agent/defaultsystemctl --user enable pivy-agent@default.servicesystemctl --user start pivy-agent@default.serviceAdd the following lines to your .profile or .bashrc: export PATH=/opt/pivy/bin:$PATH if [[ ! -e "$SSH_AUTH_SOCK" || "$SSH_AUTH_SOCK" == *"/keyring/"* ]]; then export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/pivy-ssh-default.socket" fi
Installing on OSX is even easier, as we have pre-built binary package installerswhich both install the binaries and set up a user launchd service to run thepivy-agent for you.
You can find the latest binary installer on thereleases page.
After installing the program itself, the installer will prompt you to insert aYubiKey or other PIV token using a dialog box. Then it will generate a userlaunchd service to run the agent for you, and add lines to/etc/profile todefault to using it in place of the Keychain agent.
Thepivy- programs will also be added to yourPATH, so they should beaccessible from any terminal. You’ll find them in/opt/pivy if you needthem for any other reason.
There is one known issue on OSX currently: the PCSC framework does not workafter callingfork(), which forces thepivy-agent code to not be able to runin the background (this means usingpivy-agent bash to start a shell doesn’twork, for example). The best way to usepivy-agent on OSX is set up as alaunchd service.
Rather than depend on homebrew or MacPorts or another similar system, we buildlibressl-portable in a subdirectory and statically link the binaries againstit. The Makefile in this repository will handle it all for you.
Note there is no need to install PCSClite or OpenSC or any of the relatedtools or libraries on OSX — the PCSC framework built into the operating systemitself works fine forpivy-agent.
The commands you will need to run are as follows:
## Clone the pivy-agent repository$ git clone https://github.com/arekinath/pivy$ cd pivy## Build libressl and then pivy-agent$ make -j4## Generate a .pkg (will be output in macosx/pivy-version.pkg)$ sudo make package...
About
Tools for using PIV tokens (like Yubikeys) as an SSH agent, for encrypting data at rest, and more
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors9
Uh oh!
There was an error while loading.Please reload this page.