summaryrefslogtreecommitdiff
path: root/src/regress/lib
diff options
context:
space:
mode:
authortb <>2022-03-14 21:30:48 +0000
committertb <>2022-03-14 21:30:48 +0000
commiteafae99fd14060795330ecbb42af9f98d1ddc978 (patch)
tree92535780fe32cf443c8a023a93457adb48add9e1 /src/regress/lib
parent4921127200b0c3cff9bc154e1c31a9ae8681333c (diff)
downloadopenbsd-eafae99fd14060795330ecbb42af9f98d1ddc978.tar.gz
openbsd-eafae99fd14060795330ecbb42af9f98d1ddc978.tar.bz2
openbsd-eafae99fd14060795330ecbb42af9f98d1ddc978.zip
Add a few regress test cases for name constraints.
From Alex Wilson
Diffstat (limited to 'src/regress/lib')
-rw-r--r--src/regress/lib/libcrypto/CA/Makefile6
-rw-r--r--src/regress/lib/libcrypto/CA/intermediate.cnf6
-rw-r--r--src/regress/lib/libcrypto/CA/root.cnf18
3 files changed, 25 insertions, 5 deletions
diff --git a/src/regress/lib/libcrypto/CA/Makefile b/src/regress/lib/libcrypto/CA/Makefile
index 3616b132bf..d430121d14 100644
--- a/src/regress/lib/libcrypto/CA/Makefile
+++ b/src/regress/lib/libcrypto/CA/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.3 2020/12/26 14:42:09 bluhm Exp $ 1# $OpenBSD: Makefile,v 1.4 2022/03/14 21:30:48 tb Exp $
2 2
3CLEANFILES += *.pem *.serial *.txt *.attr *.old 3CLEANFILES += *.pem *.serial *.txt *.attr *.old
4 4
@@ -59,7 +59,7 @@ server.key.pem: stamp-clean
59server.csr.pem: intermediate.cnf server.key.pem 59server.csr.pem: intermediate.cnf server.key.pem
60 # server req 60 # server req
61 openssl req -batch -config ${.CURDIR}/intermediate.cnf -new -sha256 \ 61 openssl req -batch -config ${.CURDIR}/intermediate.cnf -new -sha256 \
62 -subj '/CN=server/O=OpenBSD/OU=So and Sos/C=CA' \ 62 -subj '/CN=server.openbsd.org/OU=So and Sos/O=OpenBSD/C=CA' \
63 -key server.key.pem -out server.csr.pem 63 -key server.key.pem -out server.csr.pem
64 64
65# Sign server key 65# Sign server key
@@ -77,7 +77,7 @@ client.key.pem: stamp-clean
77client.csr.pem: intermediate.cnf intermediate.cert.pem client.key.pem 77client.csr.pem: intermediate.cnf intermediate.cert.pem client.key.pem
78 # client req 78 # client req
79 openssl req -batch -config ${.CURDIR}/intermediate.cnf -new -sha256 \ 79 openssl req -batch -config ${.CURDIR}/intermediate.cnf -new -sha256 \
80 -subj '/CN=client/O=OpenBSD/OU=So and Sos/C=CA' \ 80 -subj '/CN=client/OU=So and Sos/O=OpenBSD/C=CA' \
81 -key client.key.pem -out client.csr.pem 81 -key client.key.pem -out client.csr.pem
82 82
83# Sign client key 83# Sign client key
diff --git a/src/regress/lib/libcrypto/CA/intermediate.cnf b/src/regress/lib/libcrypto/CA/intermediate.cnf
index bbf189d268..d0057ca13f 100644
--- a/src/regress/lib/libcrypto/CA/intermediate.cnf
+++ b/src/regress/lib/libcrypto/CA/intermediate.cnf
@@ -1,4 +1,4 @@
1# $OpenBSD: intermediate.cnf,v 1.3 2020/12/26 00:48:56 bluhm Exp $ 1# $OpenBSD: intermediate.cnf,v 1.4 2022/03/14 21:30:48 tb Exp $
2# For regression tests 2# For regression tests
3default_ca = CA_regress 3default_ca = CA_regress
4 4
@@ -105,6 +105,10 @@ subjectKeyIdentifier = hash
105authorityKeyIdentifier = keyid,issuer 105authorityKeyIdentifier = keyid,issuer
106keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment 106keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment
107extendedKeyUsage = clientAuth, emailProtection 107extendedKeyUsage = clientAuth, emailProtection
108subjectAltName = critical, @usr_san
109
110[ usr_san ]
111email.0 = evilsoandsos@test.openbsd.org
108 112
109[ server_cert ] 113[ server_cert ]
110# Extensions for server certificates (`man x509v3_config`). 114# Extensions for server certificates (`man x509v3_config`).
diff --git a/src/regress/lib/libcrypto/CA/root.cnf b/src/regress/lib/libcrypto/CA/root.cnf
index 506542e943..30a442f136 100644
--- a/src/regress/lib/libcrypto/CA/root.cnf
+++ b/src/regress/lib/libcrypto/CA/root.cnf
@@ -1,4 +1,4 @@
1# $OpenBSD: root.cnf,v 1.3 2020/12/26 00:48:56 bluhm Exp $ 1# $OpenBSD: root.cnf,v 1.4 2022/03/14 21:30:48 tb Exp $
2# For regression tests 2# For regression tests
3default_ca = CA_regress 3default_ca = CA_regress
4 4
@@ -95,6 +95,22 @@ subjectKeyIdentifier = hash
95authorityKeyIdentifier = keyid:always,issuer 95authorityKeyIdentifier = keyid:always,issuer
96basicConstraints = critical, CA:true, pathlen:0 96basicConstraints = critical, CA:true, pathlen:0
97keyUsage = critical, digitalSignature, cRLSign, keyCertSign 97keyUsage = critical, digitalSignature, cRLSign, keyCertSign
98nameConstraints = critical, @ca_name_constraints
99
100[ ca_name_constraints ]
101permitted;DNS.0 = .openbsd.org
102permitted;DNS.1 = client
103permitted;email.0 = openbsd.org
104permitted;email.1 = @test.openbsd.org
105permitted;URI.0 = .openbsd.org
106permitted;dirName.0 = openbsd_dn
107permitted;otherName.0 = 1.3.6.1.4.1.311.20.2.3;UTF8:@openbsd.org
108excluded;IP.0 = 0.0.0.0/0.0.0.0
109excluded;IP.1 = 0:0:0:0:0:0:0:0/0:0:0:0:0:0:0:0
110
111[ openbsd_dn ]
112C = CA
113O = OpenBSD
98 114
99[ usr_cert ] 115[ usr_cert ]
100# Extensions for client certificates (`man x509v3_config`). 116# Extensions for client certificates (`man x509v3_config`).