Skip to content

Commit 32ac1e3

Browse files
hstievatgitbook-bot
authored andcommitted
GITBOOK-299: No subject
1 parent 37d03b0 commit 32ac1e3

1 file changed

Lines changed: 15 additions & 64 deletions

File tree

services/www/administration.md

Lines changed: 15 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,11 @@ This page describes how to accomplish certain administration tasks on [WWW](./)
44

55
## SSL
66

7-
Occasionally, SSL certificates need to be renewed. We renew certificates yearly. The next time we will need to renew the SSL certificates is late this November.
7+
We use Let's Encrypt for SSL, using Certbot. Let's Encrypt certificates expire every 90 days and are renewed every 60 days. Renewal is automated, but several other servers use the wildcard certificate and must pull the updated one. The most important of these are the mail servers, which use the certificate for SMTP. The script `update-ssl.sh` in the root home directory of Casey and Smith should handle this. After certificates are renewed, run the update-ssl script on:
88

9-
### Before certificate renewal comes up
10-
11-
Generate a new private key and CSR with:
12-
13-
```
14-
openssl req -new -newkey rsa:2048 -nodes -keyout "tjhsst-1718.key" -out "tjhsst-1718.csr"
15-
```
16-
17-
Substitute 1718 with the appropriate school year. This command should be run in `/etc/apache2/ssl` -- be very careful to not overwrite existing files (i.e. make sure `tjhsst-1718.{key,csr}` don't already exist).
18-
19-
Get the public key pin information using
20-
21-
```
22-
openssl rsa -in tjhsst-1718.key -outform der -pubout | openssl dgst -sha256 -binary | openssl enc -base64
23-
```
24-
25-
You'll need to add this to the Public-Key-Pins header in `/etc/nginx/ssl.conf`, following the existing format. Do this _**before**_ you actually rotate keys. Without doing this, browsers will be unable to access the website, and this is a bad thing. Read (the documentation on MDN)\[[https://developer.mozilla.org/en-US/docs/Web/HTTP/Public\_Key\_Pinning](https://developer.mozilla.org/en-US/docs/Web/HTTP/Public\_Key\_Pinning)] for more information about public key pinning.
26-
27-
Alternatively, generate a CSR using an already existing key, with:
28-
29-
```
30-
openssl req -out tjhsst-1718.csr -key tjhsst-1617.key -new.
31-
```
32-
33-
### Rotating the certificate
34-
35-
Once you've received a certificate from the CA, put it alongside the private key using a similar naming format, like `tjhsst-1718.crt`. Create a certificate bundle/chained certificate file according to the instructions given by the CA (usually this looks something like `cat tjcsl_bundle.crt tjhsst-1718.crt > tjhsst-1718.chained.crt`).
36-
37-
You can now update the web server's SSL configuration in `/etc/nginx/ssl.conf`, making sure to replace the values of `ssl_certificate`, `ssl_certificate_key`, as well as `ssl_trusted_certificate` if it's necessary.
38-
39-
### Restart the web server
40-
41-
You can now restart nginx with `/etc/init.d/nginx restart`. If all goes well, the new SSL certificate should be in place.
9+
* Mail servers (Smith and Casey)
10+
* IPA servers, for the web ui
11+
* Monitor/Grafana
4212

4313
## Scripts
4414

@@ -47,37 +17,18 @@ This section contains various other scripts to do useful things on [WWW](./).
4717
### What to do if the webserver goes down
4818

4919
1. Log in to remote.tjhsst.edu (or if you're already on the internal network, that's fine too)
50-
2. If you're on remote, `kinit username/root`
51-
3. `ssh root@www`
52-
4. `reload-webserver`
53-
54-
This restarts nginx/Apache and ensures that the service manager is still in a consistent state. The website should work after this (if not, try clearing cache/etc, it's possible a redirect to an error page might've been cached, although it shouldn't be).
55-
56-
If this doesn't work, there are a few things you can try:
57-
58-
```
59-
pkill k5start
60-
pkill -9 k5start
61-
pkill apache2
62-
pkill -9 apache2
63-
pkill nginx
64-
pkill -9 nginx
65-
service apache2 zap
66-
service nginx zap
67-
service apache2 start
68-
service nginx start
69-
```
70-
71-
This will make sure k5start/nginx/apache have actually been stopped (although possibly not cleanly) before restarting them. If this doesn't work, it's probably an issue with Kerberos / AFS -- make sure `/etc/krb5.keytab.www-data` exists and has the correct keys (`ktlist -K -k /etc/krb5.keytab.www-data`, you should see `www-data@CSL.TJHSST.EDU` listed at least once).
72-
73-
If all of that doesn't work, it's most likely not a problem with the web server -- perhaps check AFS or Kerberos for issues that might be causing a web problem.
20+
2. `ssh root@www`
21+
3. `systemctl restart nginx`
7422

75-
### Granting a user access to edit the website
23+
This restarts nginx and ensures that the service manager is still in a consistent state. The website should work after this (if not, try clearing cache/etc, it's possible a redirect to an error page might've been cached, although it shouldn't be).
7624

77-
You'll need to be an [AFS admin](broken-reference), or ask someone who is, to simply run:
25+
### If SSL doesn't renew automatically
7826

79-
```
80-
pts adduser <USERNAME> web.admins
81-
```
27+
The certbot command is `certbot certonly`\
28+
`--manual`\
29+
`--preferred-challenges dns`\
30+
`--manual-auth-hook /usr/local/bin/certbot-ipa-dns-update.sh`\
31+
`--manual-cleanup-hook /usr/local/bin/certbot-ipa-dns-cleanup.sh`\
32+
`--cert-name tjhsst.edu`
8233

83-
This will grant full access to `/afs/csl/web/www`, where the website files are located.
34+
You can try running this manually to see the error. You can also look at the script in `/usr/local/bin/certbot-ipa-dns-update.sh` to see what it's supposed to do.&#x20;

0 commit comments

Comments
 (0)