This documentation assumes that you have used ssh keys in the past. The YubiKey
This is a step-by-step on how to setup SSH user certificates using PIV for hardware-backed keys.
Windows
- Download from Yubico website https://www.yubico.com/products/services-software/download/yubikey-manager/
Yubikey Personalization gui tool
NOTE: You do not need to download the personalization GUI tool if you are only looking to load authentication certs
- Yubikey NEO Manager Tool
- Yubikey PIV Manager tool
- Run the Yubikey NEO Manager and insert your key.
- Click Change Name and change the name to something recognizable.
- The name you set is only stored locally on your computer; it's there to make it easier to tell the difference between multiple Yubikeys in the NEO Manager.
- Click Change connection mode and select CCID (need for PIV/certificates). You can leave U2F and OTP if you are using them, or turn them off.
- Remove the key when prompted and reinsert.
- Insert key and log in or Run the Yubikey PIV Manager tool as the user account you are adding a PIV cert.
- Enter a PIN. The PIN must be 4-8 characters in length and can contain capital and lowercase letters, numbers, and special characters (!, @, #, etc.).
- Select Use a separate key and then click Random. Record this Management key. You will need it later on to add certificates.
- Enter a PUK (Personal Unlocking Key) and Click OK
- Click Certificates and then choose the tab you want to add the certificate to (Authentication, Digital Signature, Key Management, Card Authentication)
- Click Generate new key
- Select RSA (2048)
- Select Request a certificate from a Windows CA
- Enter Certificate Template (yubicosc for Main, FinanceSmartcard for Finance)
- For Subject, enter your AD Account's DistinguishedName, but replace the commas with slashes. This is CASE SENSITIVE.
- You can get this for the user you're currently logged in as by running the PowerShell command:
"/"+(get-aduser -server main.ad.rit.edu $env:USERNAME).distinguishedname.replace(",","/")Example: /CN=jlgdss/OU=Other/OU=AMS/OU=Users/OU=RITusers/DC=main/DC=ad/DC=rit/DC=edu
- "/"+([adsisearcher]::new("samaccountname=$env:USERNAME").FindAll().Properties.distinguishedname).replace(",","/")
- You can get this for the user you're currently logged in as by running the PowerShell command:
- Click OK
- Enter PIN you just created (same for all certs) when prompted.
- Enter Management Key if prompted.
- Choose RIT AD Signing CA (Kerberos) - itscaad01.ad.rit.edu
- It should then say a new private key has been generated.
- If you want to load certificates for another account (ex. a "-admin" account):
- Close the PIV manager
- Run the PIV manager as the account you want to generate a certificate for
- Select another tab/slot that does not already have a certificate assigned – only slots 1 (the 'authentication' tab), 3 ('the 'key management' tab), and 4 (the 'card authentication' tab) support smart card authentication by pin
Perform the same steps starting with Generate Key above
See Using Certificate for Digitally Signing Email in Outlook if you want to digitally sign your emails with your new certificates.
OS X or Linux
Prerequisites
a YubiKey with the PIV application loaded
the yubico-piv-tool software
the ykcs11 PKCS#11 module
OpenSSH
Steps
Generate an "ssh user CA" key and trust it for this account on this host
ssh-keygen -N '' -C user-ca -f ~/.ssh/ca sed 's/^/cert-authority /' ~/.ssh/ca.pub > ~/.ssh/authorized_keysGenerate or import a key in PIV slot 9c that requires touch.
yubico-piv-tool -a generate -s 9c -A RSA2048 --pin-policy=never --touch-policy=always -o public.pem yubico-piv-tool -a selfsign-certificate -s 9c -S "/CN=SSH key/" -i public.pem -o cert.pem yubico-piv-tool -a import-certificate -s 9c -i cert.pemDouble check that the key appears in slot 9c (optional)
yubico-piv-tool -a statusClear the SSH agent
ssh-add -D ssh-add -e /PATH/TO/libykcs11.soMake sure to use the correct path (e.g.
/usr/local/lib) and extension (.sofor Linux,.dylibfor Mac OS X) for libykcs11.Beware that
ssh-add -Ddoesn’t seem to clear PKCS#11 libraries, only keys.
Add PIV to the SSH agent (will prompt for PIV PIN)
ssh-add -s /PATH/TO/libykcs11.soGet the public key from PIV and sign it using the CA key. This produces
~/.ssh/id_rsa-cert.pubssh-add -L > ~/.ssh/id_rsa.pub ssh-keygen -s ~/.ssh/ca -I identity -n "${LOGNAME}" ~/.ssh/id_rsa.pubAuthenticate to the target system using the new key:
ssh user@sporcsubmit.rc.rit.edu
If you have followed these steps to the letter, you will not be asked for the PIV PIN, but your YubiKey will start blinking, waiting for touch.
More info
Yubikey SSH - https://developers.yubico.com/PIV/Guides/SSH_user_certificates.html
Manual - https://www.yubico.com/wp-content/uploads/2015/03/YubiKeyManual_v3.4.pdf
Software:
https://developers.yubico.com/yubikey-piv-manager/Releases/
https://developers.yubico.com/yubikey-personalization-gui/Releases/
...
wiki page is deprecated. You can find this documentation on our new documentation site: https://research-computing.git-pages.rit.edu/docs/configuring_ssh_with_yubikey.html


