diff options
| author | tb <> | 2022-03-14 21:30:48 +0000 |
|---|---|---|
| committer | tb <> | 2022-03-14 21:30:48 +0000 |
| commit | eafae99fd14060795330ecbb42af9f98d1ddc978 (patch) | |
| tree | 92535780fe32cf443c8a023a93457adb48add9e1 /src | |
| parent | 4921127200b0c3cff9bc154e1c31a9ae8681333c (diff) | |
| download | openbsd-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')
| -rw-r--r-- | src/regress/lib/libcrypto/CA/Makefile | 6 | ||||
| -rw-r--r-- | src/regress/lib/libcrypto/CA/intermediate.cnf | 6 | ||||
| -rw-r--r-- | src/regress/lib/libcrypto/CA/root.cnf | 18 |
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 | ||
| 3 | CLEANFILES += *.pem *.serial *.txt *.attr *.old | 3 | CLEANFILES += *.pem *.serial *.txt *.attr *.old |
| 4 | 4 | ||
| @@ -59,7 +59,7 @@ server.key.pem: stamp-clean | |||
| 59 | server.csr.pem: intermediate.cnf server.key.pem | 59 | server.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 | |||
| 77 | client.csr.pem: intermediate.cnf intermediate.cert.pem client.key.pem | 77 | client.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 |
| 3 | default_ca = CA_regress | 3 | default_ca = CA_regress |
| 4 | 4 | ||
| @@ -105,6 +105,10 @@ subjectKeyIdentifier = hash | |||
| 105 | authorityKeyIdentifier = keyid,issuer | 105 | authorityKeyIdentifier = keyid,issuer |
| 106 | keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment | 106 | keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment |
| 107 | extendedKeyUsage = clientAuth, emailProtection | 107 | extendedKeyUsage = clientAuth, emailProtection |
| 108 | subjectAltName = critical, @usr_san | ||
| 109 | |||
| 110 | [ usr_san ] | ||
| 111 | email.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 |
| 3 | default_ca = CA_regress | 3 | default_ca = CA_regress |
| 4 | 4 | ||
| @@ -95,6 +95,22 @@ subjectKeyIdentifier = hash | |||
| 95 | authorityKeyIdentifier = keyid:always,issuer | 95 | authorityKeyIdentifier = keyid:always,issuer |
| 96 | basicConstraints = critical, CA:true, pathlen:0 | 96 | basicConstraints = critical, CA:true, pathlen:0 |
| 97 | keyUsage = critical, digitalSignature, cRLSign, keyCertSign | 97 | keyUsage = critical, digitalSignature, cRLSign, keyCertSign |
| 98 | nameConstraints = critical, @ca_name_constraints | ||
| 99 | |||
| 100 | [ ca_name_constraints ] | ||
| 101 | permitted;DNS.0 = .openbsd.org | ||
| 102 | permitted;DNS.1 = client | ||
| 103 | permitted;email.0 = openbsd.org | ||
| 104 | permitted;email.1 = @test.openbsd.org | ||
| 105 | permitted;URI.0 = .openbsd.org | ||
| 106 | permitted;dirName.0 = openbsd_dn | ||
| 107 | permitted;otherName.0 = 1.3.6.1.4.1.311.20.2.3;UTF8:@openbsd.org | ||
| 108 | excluded;IP.0 = 0.0.0.0/0.0.0.0 | ||
| 109 | excluded;IP.1 = 0:0:0:0:0:0:0:0/0:0:0:0:0:0:0:0 | ||
| 110 | |||
| 111 | [ openbsd_dn ] | ||
| 112 | C = CA | ||
| 113 | O = 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`). |
