Repository navigation
add pkcs11 support to Ansible ssh connection module - #32829
Conversation
|
The test |
|
The test |
|
so instead of hardocding them in many places, you can just add it instead just to the connection plugin that uses them, as ini/env/connection variables they will also be a lot more flexible. |
|
The pkcs11_pin is sensitive and I wanted to follow the same process Ansible currently uses for passwords. I could just reuse the password variable for the pin and use ini/env/connection variables for the pkcs11_provider, and whenever you set the pkcs11_provider then it uses PKCS11 rather than password auth. I see pkcs11 making its way to other connection plugins (paramiko_ssh), so thats why I initially took the approach of the variables being CLI options.
|
|
i think reusing password is fine and keeping the provider as separate parameter |
Co-authored-by: Jordan Borean <[email protected]>
Correct logic for a password being required for pkcs11_provider Co-authored-by: Jordan Borean <[email protected]>
jborean93
left a comment
There was a problem hiding this comment.
Changes look great, just need to wait until we branch off the 2.11 changes so we can merge this into devel for the 2.12 release.
|
@jborean93 Since 2.11 is branched out. Do you want to merge this? |
|
@jborean93, @bcoca, @nitzmahone is it time to merge? |
|
My apologies should have looked at this earlier. rebuild_merge |
|
Bot is taking it's time, will just merge manually (it passed the rebuild test). |
|
@thedavidwhiteside Thanks for the contribution and patients. @jborean93 @nitzmahone @bcoca Thanks for the review. |
SUMMARY
Ansible does not currently support PKCS#11 (PIV, CAC, smartcard) authentication. With a simple modification to the ssh connection plugin, you can easily add support for PKCS#11. Paramiko is in the process of adding PKCS11 support, after the support is added in the next stable release of Paramiko then its also possible to add PKCS11 support for the Ansible+Paramiko combination.
ISSUE TYPE
COMPONENT NAME
ssh connection plugin
ANSIBLE VERSION
USAGE
I use https://github.com/OpenSC/OpenSC for the middleware, this is the pkcs11-provider library that you point Ansible to with the pkcs11_provider ini setting or ANSIBLE_PKCS11_PROVIDER env variable.
I tested with a smartcard, a very common device you might use with Ansible pkcs11 would be a Yubikey device (https://www.yubico.com/product/yubikey-neo).