Skip to content

Commit 5a1df16

Browse files
committed
Add no-subject and no-common-name subdomains. Addresses #268.
1 parent b65fe50 commit 5a1df16

10 files changed

+140
-0
lines changed

certs/Makefile

+18
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,15 @@ CHAINS_PROD += $(O)/gen/chain/wildcard-ecc384.pem
218218
$(O)/gen/chain/wildcard-ecc384.pem: $(O)/gen/crt/wildcard-ecc384.crt $(O)/gen/crt/ca-intermediate.crt
219219
./tool chain $@ $(D) $^
220220

221+
################################
222+
$(O)/gen/csr/subdomain-no-common-name.csr: src/conf/subdomain-no-common-name.conf $(O)/gen/key/leaf-main.key
223+
./tool gen-csr $@ $(D) $^
224+
$(O)/gen/crt/subdomain-no-common-name.crt: src/conf/subdomain-no-common-name.conf $(O)/gen/csr/subdomain-no-common-name.csr $(O)/gen/key/ca-intermediate.key $(O)/gen/crt/ca-intermediate.crt
225+
./tool sign $@ $(D) $(SIGN_LEAF_DEFAULTS) $^
226+
CHAINS_PROD += $(O)/gen/chain/subdomain-no-common-name.pem
227+
$(O)/gen/chain/subdomain-no-common-name.pem: $(O)/gen/crt/subdomain-no-common-name.crt $(O)/gen/crt/ca-intermediate.crt
228+
./tool chain $@ $(D) $^
229+
221230
################################
222231
$(O)/gen/csr/subdomain-no-san.csr: src/conf/subdomain-no-san.conf $(O)/gen/key/leaf-main.key
223232
./tool gen-csr $@ $(D) $^
@@ -227,6 +236,15 @@ CHAINS_LOCAL_ONLY += $(O)/gen/chain/subdomain-no-san.pem
227236
$(O)/gen/chain/subdomain-no-san.pem: $(O)/gen/crt/subdomain-no-san.crt $(O)/gen/crt/ca-intermediate.crt
228237
./tool chain $@ $(D) $^
229238

239+
################################
240+
$(O)/gen/csr/subdomain-no-subject.csr: src/conf/subdomain-no-subject.conf $(O)/gen/key/leaf-main.key
241+
./tool gen-csr-no-subject $@ $(D) $^
242+
$(O)/gen/crt/subdomain-no-subject.crt: src/conf/subdomain-no-subject.conf $(O)/gen/csr/subdomain-no-subject.csr $(O)/gen/key/ca-intermediate.key $(O)/gen/crt/ca-intermediate.crt
243+
./tool sign $@ $(D) $(SIGN_LEAF_DEFAULTS) $^
244+
CHAINS_PROD += $(O)/gen/chain/subdomain-no-subject.pem
245+
$(O)/gen/chain/subdomain-no-subject.pem: $(O)/gen/crt/subdomain-no-subject.crt $(O)/gen/crt/ca-intermediate.crt
246+
./tool chain $@ $(D) $^
247+
230248
################################
231249
$(O)/gen/csr/subdomain-1000-sans.csr: src/conf/subdomain-1000-sans.conf $(O)/gen/key/leaf-main.key
232250
./tool gen-csr $@ $(D) $^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[ req ]
2+
default_bits = 2048
3+
distinguished_name = req_distinguished_name
4+
encrypt_key = no
5+
prompt = no
6+
req_extensions = req_v3_usr
7+
8+
[ req_distinguished_name ]
9+
countryName = US
10+
stateOrProvinceName = California
11+
localityName = San Francisco
12+
organizationName = BadSSL
13+
14+
[ req_v3_usr ]
15+
basicConstraints = CA:FALSE
16+
subjectAltName = @alt_names
17+
18+
[ alt_names ]
19+
DNS.1 = no-subject.__DOMAIN__
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[ req ]
2+
default_bits = 2048
3+
distinguished_name = req_distinguished_name
4+
encrypt_key = no
5+
req_extensions = req_v3_usr
6+
7+
[ req_distinguished_name ]
8+
9+
[ req_v3_usr ]
10+
basicConstraints = CA:FALSE
11+
subjectAltName = critical, @alt_names
12+
13+
[ alt_names ]
14+
DNS.1 = no-subject.__DOMAIN__

certs/tool

+7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ gen-csr)
3131
-config <(cat $1 | sed "s/__DOMAIN__/$DOMAIN/g") \
3232
-key $2
3333
;;
34+
gen-csr-no-subject)
35+
openssl req -new \
36+
-subj / \
37+
-out $OUT \
38+
-config <(cat $1 | sed "s/__DOMAIN__/$DOMAIN/g") \
39+
-key $2
40+
;;
3441
gen-ca)
3542
openssl req -new -x509 -days 7300 \
3643
-out $OUT \

domains/cert/no-common-name.conf

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
---
3+
server {
4+
listen 80;
5+
server_name no-common-name.{{ site.domain }};
6+
7+
return 301 https://$server_name$request_uri;
8+
}
9+
10+
server {
11+
listen 443;
12+
server_name no-common-name.{{ site.domain }};
13+
14+
include {{ site.serving-path }}/nginx-includes/subdomain-no-common-name.conf;
15+
include {{ site.serving-path }}/nginx-includes/tls-defaults.conf;
16+
include {{ site.serving-path }}/common/common.conf;
17+
18+
root {{ site.serving-path }}/domains/cert/no-common-name;
19+
}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
subdomain: no-common-name
3+
layout: page
4+
favicon: gray
5+
background: gray
6+
---
7+
8+
<div id="content">
9+
<h1>
10+
{{ page.subdomain }}.<br>{{ site.domain }}
11+
</h1>
12+
</div>
13+
14+
<div id="footer">
15+
This site uses a certificate without a common name.
16+
</div>

domains/cert/no-subject.conf

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
---
3+
server {
4+
listen 80;
5+
server_name no-subject.{{ site.domain }};
6+
7+
return 301 https://$server_name$request_uri;
8+
}
9+
10+
server {
11+
listen 443;
12+
server_name no-subject.{{ site.domain }};
13+
14+
include {{ site.serving-path }}/nginx-includes/subdomain-no-subject.conf;
15+
include {{ site.serving-path }}/nginx-includes/tls-defaults.conf;
16+
include {{ site.serving-path }}/common/common.conf;
17+
18+
root {{ site.serving-path }}/domains/cert/no-subject;
19+
}

domains/cert/no-subject/index.html

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
subdomain: no-subject
3+
layout: page
4+
favicon: gray
5+
background: gray
6+
---
7+
8+
<div id="content">
9+
<h1>
10+
{{ page.subdomain }}.<br>{{ site.domain }}
11+
</h1>
12+
</div>
13+
14+
<div id="footer">
15+
This site uses a certificate without a subject.
16+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
---
3+
4+
ssl on;
5+
ssl_certificate {{ site.cert-path }}/subdomain-no-common-name.pem;
6+
ssl_certificate_key /etc/keys/leaf-main.key;
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
---
3+
4+
ssl on;
5+
ssl_certificate {{ site.cert-path }}/subdomain-no-subject.pem;
6+
ssl_certificate_key /etc/keys/leaf-main.key;

0 commit comments

Comments
 (0)