Skip to content

Commit 8b0ea72

Browse files
committed
move to letsencrypt for our ssl cert
1 parent 6b2c713 commit 8b0ea72

File tree

4 files changed

+15
-105
lines changed

4 files changed

+15
-105
lines changed

doc/genesis.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,6 @@ knife vault create master github-api \
291291
--admins adriaan
292292
```
293293

294-
## For nginx ssl
295-
296-
```
297-
knife vault create master scala-ci-key \
298-
--json scalaci-key.json \
299-
--search 'name:jenkins-master' \
300-
--admins adriaan
301-
```
302-
303294

304295
## Workers that need to publish
305296
```

doc/maintenance.md

Lines changed: 6 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -57,119 +57,32 @@ Tips for addressing a temporary free-space issue on the behemoths:
5757
community build job is running!)
5858
* From time to time we can delete `~/.dbuild`, `~/.ivy2`, `~/.m2`
5959

60-
## Updating the scala-jenkins-infra cookbook
61-
62-
Note that the setup instructions don't require you to clone all of the
63-
cookbooks to your local machine, only the scala-jenkins-infra
64-
cookbook. That's because our own cookbook is the one we usually
65-
update; the rest don't normally need to be touched.
66-
67-
If you change the scala-jenkins-infra cookbook, you don't need
68-
to push your change anywhere in order to test it in production.
69-
We often test changes that way, and then after verifying that
70-
the change is working as desired in production, we push the change
71-
to scala/scala-jenkins-infra.
72-
73-
To make changes,
74-
75-
### 1. Edit the cookbook
76-
77-
Edit the cookbook. (For example, a common change is to edit
78-
one of the `.xml.erb` files for Jenkins.)
79-
80-
### 2. Upload the cookbook
81-
82-
knife cookbook upload scala-jenkins-infra
83-
84-
This always uploads the cookbook to the Typesafe account on chef.io,
85-
regardless of whether you made changes.
86-
87-
### 3. Run chef-client
88-
89-
Run `chef-client` on the affected nodes (usually jenkins-master),
90-
which will cause the node to get the updated cookbook from chef.io.
91-
You can run it automatically or manually.
92-
93-
Running it automatically just involves waiting. On a regular schedule
94-
(every 15 minutes, 30 minutes, something like that? it's configured in
95-
our cookbook for chef-client itself), an already running chef-client
96-
process will wake up and check chef.io for updates. (The log for
97-
the run presumably goes somewhere, but where? See
98-
https://github.com/scala/scala-jenkins-infra/issues/110.)
99-
100-
But it's usually better to do it manually because you can watch it
101-
happen and catch mistakes. Any cookbook changes found will show up as
102-
light-gray diffs in the `chef-client` output so you can spot and
103-
sanity-check them. If diffs are found, the cookbook specifies what
104-
should happen as a result -- for example, that service might be
105-
restarted.
106-
107-
The commands to run chef-client depend on whether the node in question
108-
is Linux or Windows:
109-
110-
#### Linux node
111-
112-
Here `hostname` might be e.g. `jenkins-master` and username can be omitted
113-
to accept the default in your `~/.ssh/config`, or can be explicitly supplied
114-
e.g. `ec2-user@jenkins-master`.
115-
116-
```
117-
ssh hostname # or username@hostname to override your ~/.ssh/config default
118-
sudo su --login # --login needed on ubuntu to set SSL_CERT_FILE (it's done in /etc/profile.d)
119-
chef-client
120-
```
121-
122-
#### Windows node
123-
124-
```
125-
PASS=$(aws ec2 get-password-data --instance-id i-0485455cc766c86ef --priv-launch-key ~/.ssh/typesafe-scala-aws-$AWS_USER.pem | jq .PasswordData | xargs echo)
126-
knife winrm jenkins-worker-windows-publish chef-client -m -P $PASS
127-
```
12860

12961
# Misc
13062

13163
The remainder of this document is just rough notes.
13264

133-
## Upload all cookbooks to chef server
134-
135-
```
136-
knife cookbook upload --all
137-
```
138-
139-
this has not been done since the initial install!
140-
141-
"Adriaan could also make a tarball" of his all-cookbooks setup
142-
sometime, maybe.
14365

14466
## SSL cert
145-
```
146-
$ openssl genrsa -out scala-ci.key 2048
147-
```
148-
and
67+
68+
We're using letsencrypt certificates, auto-renewing every 90 days.
14969

15070
```
151-
$ openssl req -new -out scala-ci.csr -key scala-ci.key -config ssl-certs/scalaci.openssl.cnf
71+
sudo apt-get install python-certbot-nginx -t stretch-backports
72+
sudo certbot --nginx
15273
```
15374

154-
Send CSR to SSL provider, receive scalaci.csr. Store scala-ci.key securely in vault master scala-ci-key (see above).
75+
The challenge/response happens over http, so I had to open up that port for master.
15576

156-
Incorporate the cert into an ssl chain for nginx:
157-
```
158-
(cd ssl-certs && cat 00\ -\ scala-ci.crt 01\ -\ COMODORSAOrganizationValidationSecureServerCA.crt 02\ -\ COMODORSAAddTrustCA.crt 03\ -\ AddTrustExternalCARoot.crt > ../files/default/scala-ci.crt)
159-
```
16077

78+
### static diffie-hellman param
16179
For [forward secrecy](http://axiacore.com/blog/enable-perfect-forward-secrecy-nginx/):
16280
```
16381
openssl dhparam -out files/default/dhparam.pem 1024
16482
```
16583

16684
Using 1024 bits (instead of 2048) for DH to be Java 6 compatible... Bye-bye A+ on https://www.ssllabs.com/ssltest/analyze.html?d=scala-ci.typesafe.com
16785

168-
Confirm values in the csr using:
169-
170-
```
171-
$ openssl req -text -noout -in scala-ci.csr
172-
```
17386

17487
# Give up, bypass Chef?
17588

roles/nginx/templates/nginx-jenkins.conf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ server {
3636
server_name {{ server_name }};
3737

3838
ssl on;
39-
ssl_certificate /etc/nginx/ssl/scala-ci.crt;
40-
ssl_certificate_key /etc/nginx/ssl/scala-ci.key;
39+
ssl_certificate /etc/letsencrypt/live/scala-ci.typesafe.com/fullchain.pem; # managed by Certbot
40+
ssl_certificate_key /etc/letsencrypt/live/scala-ci.typesafe.com/privkey.pem; # managed by Certbot
41+
4142
# Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits
4243
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
4344

roles/worker/tasks/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,13 @@
110110

111111

112112

113+
# full /etc/apt/sources.list:
114+
# deb http://cdn-aws.deb.debian.org/debian stretch main
115+
# deb http://security.debian.org/debian-security stretch/updates main
116+
# deb http://cdn-aws.deb.debian.org/debian stretch-updates main
117+
# deb http://cdn-aws.deb.debian.org/debian stretch-backports main
113118
- name: Add apt repo for Java 9 backports
114-
apt_repository: repo='deb http://ftp.debian.org/debian stretch-backports main'
119+
apt_repository: repo='deb http://cdn-aws.deb.debian.org/debian stretch-backports main'
115120

116121
- name: Install openjdk
117122
apt: name={{item}} state=installed

0 commit comments

Comments
 (0)