Skip to content

Commit 0afed64

Browse files
g-andradeomahabrad
andauthored
Provide a subdomain with a reversed certificate chain (#443)
* Change Ruby version to 2.4 Jekyll requires Ruby 2.4. Update Dockerfile to include it per comment by @shawn-lo on #405 . * Do not run `docker-run` before `docker-build` or `certs-test` have concluded * Provide a subdomain with a disorderly certificate chain * Improve naming of misorderly certificate chain Rename it from disorderly certificate chain, as suggested by lgarron. * Improve naming of reverse certificate chain Ideally, a misorderly chain would leverage 3 or more certificates; since there may be some obstacles to doing so with the live website, simplify the expectations of our use case by renaming it to reverse certificate chain. * Fix typo in naming of reversed certificate chain It's _reversed_ rather than reverse. Co-authored-by: Brad <[email protected]>
1 parent d62114f commit 0afed64

File tree

9 files changed

+80
-3
lines changed

9 files changed

+80
-3
lines changed

Dockerfile

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
FROM ubuntu:16.04
33
MAINTAINER April King <[email protected]>
44
EXPOSE 80 443
5+
RUN apt-get update && apt-get install -y apt-transport-https
6+
RUN apt-get install -y software-properties-common
7+
RUN apt-add-repository ppa:brightbox/ruby-ng
58
RUN apt-get update && apt-get install -y \
69
build-essential \
710
git \
811
libffi-dev \
912
make \
1013
nginx \
11-
ruby \
12-
ruby-dev
14+
ruby2.4 \
15+
ruby2.4-dev
16+
RUN gem update --system
1317
RUN gem install jekyll
1418

1519
# Install badssl.com

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export PROD_DOMAIN = badssl.com
88
# This should bring up a full test server in docker from a bare repo.
99
# Certs are generated outside the docker container, for persistence.
1010
.PHONY: test
11+
.NOTPARALLEL: test
1112
test: certs-test docker-build docker-run
1213

1314
# Convenience alias.

certs/Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ CHAINS_PROD += $(O)/gen/chain/wildcard-incomplete-chain.pem
119119
$(O)/gen/chain/wildcard-incomplete-chain.pem: $(O)/gen/crt/wildcard-main.crt
120120
./tool chain $@ $(D) $^
121121

122+
################################
123+
$(O)/gen/csr/subdomain-reversed-chain.csr: src/conf/subdomain-reversed-chain.conf $(O)/gen/key/leaf-main.key
124+
./tool gen-csr $@ $(D) $^
125+
$(O)/gen/crt/subdomain-reversed-chain.crt: src/conf/subdomain-reversed-chain.conf $(O)/gen/csr/subdomain-reversed-chain.csr $(O)/gen/key/ca-intermediate.key $(O)/gen/crt/ca-intermediate.crt
126+
./tool sign $@ $(D) $(SIGN_LEAF_DEFAULTS) $^
127+
CHAINS_PROD += $(O)/gen/chain/subdomain-reversed-chain.pem
128+
$(O)/gen/chain/subdomain-reversed-chain.pem: $(O)/gen/crt/ca-intermediate.crt $(O)/gen/crt/subdomain-reversed-chain.crt
129+
./tool chain $@ $(D) $^
130+
122131
################################
123132
$(O)/gen/crt/wildcard-sha1-2016.crt: src/conf/wildcard.conf $(O)/gen/csr/wildcard-main.csr $(O)/gen/key/ca-intermediate.key $(O)/gen/crt/ca-intermediate.crt
124133
# TODO: date calculations
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
commonName = reversed-chain.__DOMAIN__
14+
15+
[ req_v3_usr ]
16+
basicConstraints = CA:FALSE
17+
subjectAltName = @alt_names
18+
19+
[ alt_names ]
20+
DNS.1 = reversed-chain.__DOMAIN__

domains/cert/reversed-chain.conf

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
---
3+
server {
4+
listen 80;
5+
server_name reversed-chain.{{ site.domain }};
6+
7+
return 301 https://$server_name$request_uri;
8+
}
9+
10+
server {
11+
listen 443;
12+
server_name reversed-chain.{{ site.domain }};
13+
14+
include {{ site.serving-path }}/nginx-includes/subdomain-reversed-chain.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/reversed-chain;
19+
}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
subdomain: reversed-chain
3+
layout: page
4+
favicon: orange
5+
background: rgb(243, 121, 46)
6+
---
7+
8+
<div id="content">
9+
<h1 style="font-size: 8vw;">
10+
{{ page.subdomain }}.<br>{{ site.domain }}
11+
</h1>
12+
</div>
13+
14+
<div id="footer" style="font-size: 1.5vw">
15+
The certificate chain sent by this site is not hierarchically ordered. This will cause a certificate error unless the browser knows how to walk a reversed chain.
16+
</div>

domains/misc/badssl.com/dashboard/sets.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ var sets = [
9191
{subdomain: "ecc256"},
9292
{subdomain: "ecc384"},
9393
{subdomain: "extended-validation"},
94-
{subdomain: "mozilla-modern"}
94+
{subdomain: "mozilla-modern"},
95+
{subdomain: "reversed-chain"}
9596
]
9697
}
9798
];

domains/misc/badssl.com/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ <h2 id="certificate"><span class="emoji">🎫</span>Certificate</h2>
4242
<a href="https://no-common-name.{{ site.domain }}/" class="dubious"><span class="icon"></span>no-common-name</a>
4343
<a href="https://no-subject.{{ site.domain }}/" class="dubious"><span class="icon"></span>no-subject</a>
4444
<a href="https://incomplete-chain.{{ site.domain }}/" class="dubious"><span class="icon"></span>incomplete-chain</a>
45+
<a href="https://reversed-chain.{{ site.domain }}/" class="dubious"><span class="icon"></span>reversed-chain</a>
4546
<hr>
4647
<a href="https://sha256.{{ site.domain }}/" class="good"><span class="icon"></span>sha256</a>
4748
<a href="https://sha384.{{ site.domain }}/" class="good"><span class="icon"></span>sha384</a>
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-reversed-chain.pem;
6+
ssl_certificate_key /etc/keys/ca-intermediate.key;

0 commit comments

Comments
 (0)