These scripts can associate a user with a PIV smart card by different pairing methods.
- Install piv-cli-tool
- Install swiftDialog
To pair the current user with a PIV smart card that can be found in MAPPING_TABLE in src/lookup_table/mapping-table.sh.
Each line in MAPPING_TABLE is a user-PIV pair, the format is as follows.
"USER:CHUID:HASH"
USERis user account nameCHUIDis cardholder unique identifier. which can be known by running commandpiv-cli-tool -r READER -a statusorpiv-cli-tool -r READER -a read-object --id=0x5FC102.HASHis public key hash of a certificate, this is optional. Specifying hash to specify the pairing certificate. Hashes can be known by running commandsc_auth identities.
Examples:
"joshua:3019d4e739da739ced39ce739d836858210842108421c84210c3eb341018d0e48becd1f91b91f845089e9b3e13350832303330303130313e00fe00"
"user1:3019d4e739da739ced39ce739d836858210842108421c84210c3eb341018d0e48becd1f91b91f845089e9b3e13350832303330303130313e00fe00:B549D7112F6762C1C917F0947C401DC98CEE2CEA"
- Unpairing all paired PIV smart cards
./piv-pairing.sh unpair
- Pairing with the lookup table method
sudo ./piv-pairing.sh pair lookup_table
Jamf Pro can create scripts via Settings > Computer management > Scripts , and can add packages via Settings > Computer management > Packages .
In order to use these scripts in Jamf Pro's Self Service, you need to create a script named piv-pairing.sh to include the entire contents of src/piv-pairing.sh .
At the top of the script, JAMF_PRO_MODE=0 needs to be changed to 1.
Both packages piv-cli-tool and swiftDialog need to be added for installing on user's computer.
For using different pairing methods, more details are described as follows.
- Create a script named
mapping-table.shto include the entire contents ofsrc/lookup_table/mapping-table.sh. - Copy the entire contents of
src/lookup_table/pairing-form-table.shexcept the first line, and paste it into the bottom of functionpairing_from_table()inpiv-pairing.sh, then comment out the lines that starting withsourcein the function.
In order to make a script function to be displayed as a button in Self Service, you need to create a policy and enable it available in Self Service via Settings > Computers > Policies.
- Create a new policy
- Set
Execution FrequencytoOngoinginOptions > General - Add necessary packages in
Options > Packages - Add
piv-pairing.shand setParameter 4tounpairinOptions > Scripts - Set scope to
All ComputersandAll UsersinScope > Targets - Check
Make the policy available in Self ServiceinSelf Service
- Create a new policy
- Set
Execution FrequencytoOngoinginOptions > General - Add necessary packages in
Options > Packages - Add
piv-pairing.sh, setParameter 4topairandParameter 5tolookup_tableinOptions > Scripts - Add
mapping-table.sh, changePrioritytoBeforeand setParameter 4todumpinOptions > Scripts - Set scope to
All ComputersandAll UsersinScope > Targets - Check
Make the policy available in Self ServiceinSelf Service