|
|
d738b9 |
From 5d072bc7e890e18903a18d22ecda7662db1d603e Mon Sep 17 00:00:00 2001
|
|
|
d738b9 |
From: Greg Hudson <ghudson@mit.edu>
|
|
|
d738b9 |
Date: Fri, 25 Aug 2017 12:39:14 -0400
|
|
|
d738b9 |
Subject: [PATCH] Add PKINIT test case for generic client cert
|
|
|
d738b9 |
|
|
|
d738b9 |
In t_pkinit.py, add a test case where a client cert with no extensions
|
|
|
d738b9 |
is authorized via subject and issuer using a pkinit_cert_match string
|
|
|
d738b9 |
attribute.
|
|
|
d738b9 |
|
|
|
d738b9 |
ticket: 8562
|
|
|
d738b9 |
(cherry picked from commit 8c5d50888aab554239fd51306e79c5213833c898)
|
|
|
d738b9 |
---
|
|
|
d738b9 |
src/tests/t_pkinit.py | 10 ++++++++++
|
|
|
d738b9 |
1 file changed, 10 insertions(+)
|
|
|
d738b9 |
|
|
|
d738b9 |
diff --git a/src/tests/t_pkinit.py b/src/tests/t_pkinit.py
|
|
|
d738b9 |
index 5a0624de7..22ab81743 100755
|
|
|
d738b9 |
--- a/src/tests/t_pkinit.py
|
|
|
d738b9 |
+++ b/src/tests/t_pkinit.py
|
|
|
d738b9 |
@@ -26,6 +26,7 @@ user_enc_p12 = os.path.join(certs, 'user-enc.p12')
|
|
|
d738b9 |
user_upn_p12 = os.path.join(certs, 'user-upn.p12')
|
|
|
d738b9 |
user_upn2_p12 = os.path.join(certs, 'user-upn2.p12')
|
|
|
d738b9 |
user_upn3_p12 = os.path.join(certs, 'user-upn3.p12')
|
|
|
d738b9 |
+generic_p12 = os.path.join(certs, 'generic.p12')
|
|
|
d738b9 |
path = os.path.join(os.getcwd(), 'testdir', 'tmp-pkinit-certs')
|
|
|
d738b9 |
path_enc = os.path.join(os.getcwd(), 'testdir', 'tmp-pkinit-certs-enc')
|
|
|
d738b9 |
|
|
|
d738b9 |
@@ -65,6 +66,7 @@ p12_identity = 'PKCS12:%s' % user_p12
|
|
|
d738b9 |
p12_upn_identity = 'PKCS12:%s' % user_upn_p12
|
|
|
d738b9 |
p12_upn2_identity = 'PKCS12:%s' % user_upn2_p12
|
|
|
d738b9 |
p12_upn3_identity = 'PKCS12:%s' % user_upn3_p12
|
|
|
d738b9 |
+p12_generic_identity = 'PKCS12:%s' % generic_p12
|
|
|
d738b9 |
p12_enc_identity = 'PKCS12:%s' % user_enc_p12
|
|
|
d738b9 |
p11_identity = 'PKCS11:soft-pkcs11.so'
|
|
|
d738b9 |
p11_token_identity = ('PKCS11:module_name=soft-pkcs11.so:'
|
|
|
d738b9 |
@@ -342,6 +344,14 @@ realm.kinit(realm.user_princ,
|
|
|
d738b9 |
flags=['-X', 'X509_user_identity=%s' % p12_identity],
|
|
|
d738b9 |
expected_code=1, expected_msg=msg)
|
|
|
d738b9 |
|
|
|
d738b9 |
+# Authorize a client cert with no PKINIT extensions using subject and
|
|
|
d738b9 |
+# issuer. (Relies on EKU checking being turned off.)
|
|
|
d738b9 |
+rule = '&&<SUBJECT>CN=user$<ISSUER>O=MIT,'
|
|
|
d738b9 |
+realm.run([kadminl, 'setstr', realm.user_princ, 'pkinit_cert_match', rule])
|
|
|
d738b9 |
+realm.kinit(realm.user_princ,
|
|
|
d738b9 |
+ flags=['-X', 'X509_user_identity=%s' % p12_generic_identity])
|
|
|
d738b9 |
+realm.klist(realm.user_princ)
|
|
|
d738b9 |
+
|
|
|
d738b9 |
if not have_soft_pkcs11:
|
|
|
d738b9 |
skip_rest('PKINIT PKCS11 tests', 'soft-pkcs11.so not found')
|
|
|
d738b9 |
|