added reproducer for bug 1987256 and test for ICA token
This commit is contained in:
parent
4ae3170271
commit
eb5713998c
4 changed files with 30 additions and 8 deletions
7
Sanity/openCryptoki-PIN-conversion-tool/icatok.fmf
Normal file
7
Sanity/openCryptoki-PIN-conversion-tool/icatok.fmf
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
environment:
|
||||
TOKEN: ica
|
||||
adjust:
|
||||
- enabled: false
|
||||
when: arch != s390x
|
||||
continue: false
|
||||
extra-nitrate: TC#0611373
|
||||
|
|
@ -13,6 +13,7 @@ require:
|
|||
recommend:
|
||||
- opencryptoki
|
||||
- opencryptoki-swtok
|
||||
- opencryptoki-icatok
|
||||
- openssl
|
||||
- gnutls-utils
|
||||
- opensc
|
||||
|
|
@ -31,10 +32,11 @@ link:
|
|||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1780294
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1853420
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1964304
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1995919
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1987256
|
||||
adjust:
|
||||
- enabled: false
|
||||
when: distro == rhel-4, rhel-5, rhel-6, rhel-7
|
||||
continue: false
|
||||
extra-nitrate: TC#0607912
|
||||
extra-summary: /CoreOS/opencryptoki/Sanity/bz1780294-openCryptoki-PIN-conversion-tool
|
||||
extra-task: /CoreOS/opencryptoki/Sanity/bz1780294-openCryptoki-PIN-conversion-tool
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@
|
|||
|
||||
PACKAGE="opencryptoki"
|
||||
|
||||
[ -n "$TOKEN" ] || TOKEN=sw
|
||||
[ "$TOKEN" == "sw" ] && STORE=/var/lib/opencryptoki/swtok
|
||||
[ "$TOKEN" == "ica" ] && STORE=/var/lib/opencryptoki/lite
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm $PACKAGE
|
||||
|
|
@ -42,12 +46,18 @@ rlJournalStart
|
|||
rlRun "pkcsResetTokens"
|
||||
rlServiceStart pkcsslotd
|
||||
sleep 1
|
||||
rlRun "pkcsconf -t | grep 'Soft'"
|
||||
SLOT=$( pkcsGetTokenSlot sw )
|
||||
rlRun "pkcsconf -t"
|
||||
SLOT=$( pkcsGetTokenSlot $TOKEN )
|
||||
MODEL=$( pkcsconf -t -c $SLOT | awk '/Model:/ { print $2 }' )
|
||||
rlRun "sed -i '/tokversion = 3.12/ d' /etc/opencryptoki/opencryptoki.conf" 0 "Remove tokversion = 3.12 from opencryptoki.conf if present"
|
||||
# add token description to reproduce bz#1987256
|
||||
TEXT='description = "My Token"\nmanufacturer = "MyCompany Inc."'
|
||||
rlRun "sed -i 's/stdll = libpkcs11_$TOKEN.so/description = \\\"My Token\\\"\nmanufacturer = \\\"MyCompany Inc\\\"\nstdll = libpkcs11_$TOKEN.so/' /etc/opencryptoki/opencryptoki.conf"
|
||||
rlServiceStart pkcsslotd
|
||||
# initialize token
|
||||
rlRun "pkcsInitToken $SLOT"
|
||||
rlRun "pkcsconf -t"
|
||||
rlRun "p11tool --generate-rsa --login --set-pin $pkcsUSER_PIN --provider=/usr/lib64/pkcs11/libopencryptoki.so --outfile id_rsa.pub 'pkcs11:model=Soft;manufacturer=IBM' --label id_rsa.pub"
|
||||
rlRun "p11tool --generate-rsa --login --set-pin $pkcsUSER_PIN --provider=/usr/lib64/pkcs11/libopencryptoki.so --outfile id_rsa.pub 'pkcs11:model=${MODEL};manufacturer=IBM' --label id_rsa.pub"
|
||||
rlAssertExists id_rsa.pub
|
||||
rlRun -s "pkcs11-tool -v --module /usr/lib64/opencryptoki/libopencryptoki.so --list-objects --slot 0x$SLOT"
|
||||
rlAssertGrep "Public Key Object" $rlRun_LOG
|
||||
|
|
@ -55,15 +65,15 @@ rlJournalStart
|
|||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Token migration"
|
||||
rlRun -s "echo y | pkcstok_migrate -s $SLOT -d /var/lib/opencryptoki/swtok -c /etc/opencryptoki/ -p $pkcsSO_PIN -u $pkcsUSER_PIN" 1
|
||||
rlRun -s "echo y | pkcstok_migrate -s $SLOT -d $STORE -c /etc/opencryptoki/ -p $pkcsSO_PIN -u $pkcsUSER_PIN" 1
|
||||
rlAssertGrep "pkcstok_migrate: Please stop pkcsslotd before running this utility" $rlRun_LOG
|
||||
rlServiceStop pkcsslotd
|
||||
sleep 5
|
||||
systemctl status pkcsslotd --no-pager
|
||||
rlRun -s "echo y | pkcstok_migrate -s $SLOT -d /var/lib/opencryptoki/swtok -c /etc/opencryptoki/ -p $pkcsSO_PIN -u $pkcsUSER_PIN"
|
||||
rlRun -s "echo y | pkcstok_migrate -s $SLOT -d $STORE -c /etc/opencryptoki/ -p $pkcsSO_PIN -u $pkcsUSER_PIN"
|
||||
rlAssertGrep "pkcstok_migrate finished successfully" $rlRun_LOG
|
||||
grep -A 4 -i "slot $SLOT" /etc/opencryptoki/opencryptoki.conf
|
||||
rlRun "grep -A 4 -i 'slot $SLOT' /etc/opencryptoki/opencryptoki.conf | grep 'tokversion = 3.12'" 0 "Verify that slot configuration has been updated with 'tokversion = 3.12'"
|
||||
grep -A 5 -i "slot $SLOT" /etc/opencryptoki/opencryptoki.conf
|
||||
rlRun "grep -A 5 -i 'slot $SLOT' /etc/opencryptoki/opencryptoki.conf | grep 'tokversion = 3.12'" 0 "Verify that slot configuration has been updated with 'tokversion = 3.12'"
|
||||
rlServiceStart pkcsslotd
|
||||
sleep 1
|
||||
rlRun -s "pkcs11-tool -v --module /usr/lib64/opencryptoki/libopencryptoki.so --list-objects --slot 0x$SLOT" 0 "Verify I still can list imported RSA key"
|
||||
|
|
|
|||
3
Sanity/openCryptoki-PIN-conversion-tool/swtok.fmf
Normal file
3
Sanity/openCryptoki-PIN-conversion-tool/swtok.fmf
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
environment:
|
||||
TOKEN: sw
|
||||
extra-nitrate: TC#0607912
|
||||
Loading…
Add table
Add a link
Reference in a new issue