Skip to content
This repository was archived by the owner on Jan 6, 2021. It is now read-only.

Commit 164d4cc

Browse files
committed
pull dhparams from DO, deprecate DHLEVEL
1 parent 32144ac commit 164d4cc

File tree

6 files changed

+29
-27
lines changed

6 files changed

+29
-27
lines changed

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ RUN \
131131
/defaults/proxy-confs --strip-components=1 --exclude=linux*/.gitattributes --exclude=linux*/.github --exclude=linux*/.gitignore --exclude=linux*/LICENSE && \
132132
echo "**** configure nginx ****" && \
133133
rm -f /etc/nginx/conf.d/default.conf && \
134+
curl -o \
135+
/defaults/dhparams.pem -L \
136+
"https://lsio.ams3.digitaloceanspaces.com/dhparams.pem" && \
134137
echo "**** cleanup ****" && \
135138
apk del --purge \
136139
build-dependencies && \

Dockerfile.aarch64

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ RUN \
131131
/defaults/proxy-confs --strip-components=1 --exclude=linux*/.gitattributes --exclude=linux*/.github --exclude=linux*/.gitignore --exclude=linux*/LICENSE && \
132132
echo "**** configure nginx ****" && \
133133
rm -f /etc/nginx/conf.d/default.conf && \
134+
curl -o \
135+
/defaults/dhparams.pem -L \
136+
"https://lsio.ams3.digitaloceanspaces.com/dhparams.pem" && \
134137
echo "**** cleanup ****" && \
135138
apk del --purge \
136139
build-dependencies && \

Dockerfile.armhf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ RUN \
131131
/defaults/proxy-confs --strip-components=1 --exclude=linux*/.gitattributes --exclude=linux*/.github --exclude=linux*/.gitignore --exclude=linux*/LICENSE && \
132132
echo "**** configure nginx ****" && \
133133
rm -f /etc/nginx/conf.d/default.conf && \
134+
curl -o \
135+
/defaults/dhparams.pem -L \
136+
"https://lsio.ams3.digitaloceanspaces.com/dhparams.pem" && \
134137
echo "**** cleanup ****" && \
135138
apk del --purge \
136139
build-dependencies && \

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ docker create \
7474
-e PROPAGATION= `#optional` \
7575
-e DUCKDNSTOKEN= `#optional` \
7676
-e EMAIL= `#optional` \
77-
-e DHLEVEL=2048 `#optional` \
7877
-e ONLY_SUBDOMAINS=false `#optional` \
7978
-e EXTRA_DOMAINS= `#optional` \
8079
-e STAGING=false `#optional` \
@@ -110,7 +109,6 @@ services:
110109
- PROPAGATION= #optional
111110
- DUCKDNSTOKEN= #optional
112111
- EMAIL= #optional
113-
- DHLEVEL=2048 #optional
114112
- ONLY_SUBDOMAINS=false #optional
115113
- EXTRA_DOMAINS= #optional
116114
- STAGING=false #optional
@@ -140,7 +138,6 @@ Container images are configured using parameters passed at runtime (such as thos
140138
| `-e PROPAGATION=` | Optionally override (in seconds) the default propagation time for the dns plugins. |
141139
| `-e DUCKDNSTOKEN=` | Required if `VALIDATION` is set to `duckdns`. Retrieve your token from https://www.duckdns.org |
142140
| `-e EMAIL=` | Optional e-mail address used for cert expiration notifications. |
143-
| `-e DHLEVEL=2048` | Dhparams bit value (default=2048, can be set to `1024` or `4096`). |
144141
| `-e ONLY_SUBDOMAINS=false` | If you wish to get certs only for certain subdomains, but not the main domain (main domain may be hosted on another machine and cannot be validated), set this to `true` |
145142
| `-e EXTRA_DOMAINS=` | Additional fully qualified domain names (comma separated, no spaces) ie. `extradomain.com,subdomain.anotherdomain.org` |
146143
| `-e STAGING=false` | Set to `true` to retrieve certs in staging mode. Rate limits will be much higher, but the resulting cert will not pass the browser's security test. Only to be used for testing purposes. |
@@ -192,7 +189,7 @@ In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as bel
192189
* After setup, navigate to `https://yourdomain.url` to access the default homepage (http access through port 80 is disabled by default, you can enable it by editing the default site config at `/config/nginx/site-confs/default`).
193190
* Certs are checked nightly and if expiration is within 30 days, renewal is attempted. If your cert is about to expire in less than 30 days, check the logs under `/config/log/letsencrypt` to see why the renewals have been failing. It is recommended to input your e-mail in docker parameters so you receive expiration notices from letsencrypt in those circumstances.
194191
### Security and password protection
195-
* The container detects changes to url and subdomains, revokes existing certs and generates new ones during start. It also detects changes to the DHLEVEL parameter and replaces the dhparams file.
192+
* The container detects changes to url and subdomains, revokes existing certs and generates new ones during start.
196193
* If you'd like to password protect your sites, you can use htpasswd. Run the following command on your host to generate the htpasswd file `docker exec -it letsencrypt htpasswd -c /config/nginx/.htpasswd <username>`
197194
* You can add multiple user:pass to `.htpasswd`. For the first user, use the above command, for others, use the above command without the `-c` flag, as it will force deletion of the existing `.htpasswd` and creation of a new one
198195
* You can also use ldap auth for security and access control. A sample, user configurable ldap.conf is provided, and it requires the separate image [linuxserver/ldap-auth](https://hub.docker.com/r/linuxserver/ldap-auth/) to communicate with an ldap server.
@@ -295,6 +292,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
295292

296293
## Versions
297294

295+
* **17.06.20:** - Reformat ssl.conf. Pull in pre-generated 4096-bit dhparams.pem from DO Spaces (rotated weekly via Jenkins job: https://ci.linuxserver.io/blue/organizations/jenkins/Xtras-Builders-Etc%2Fdhparams-uploader/activity for use in new instances); deprecate `DHLEVEL` param.
298296
* **01.06.20:** - Rebasing to alpine 3.12, change ldap login address to `/ldaplogin` to avoid clashes (existing users need to manually update).
299297
* **31.05.20:** - Tweak Authelia confs (existing users can delete `authelia-server.conf` and `authelia-location.conf`, and restart to update).
300298
* **23.05.20:** - Add support for Authelia.

readme-vars.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ opt_param_env_vars:
5555
- { env_var: "PROPAGATION", env_value: "", desc: "Optionally override (in seconds) the default propagation time for the dns plugins." }
5656
- { env_var: "DUCKDNSTOKEN", env_value: "", desc: "Required if `VALIDATION` is set to `duckdns`. Retrieve your token from https://www.duckdns.org" }
5757
- { env_var: "EMAIL", env_value: "", desc: "Optional e-mail address used for cert expiration notifications." }
58-
- { env_var: "DHLEVEL", env_value: "2048", desc: "Dhparams bit value (default=2048, can be set to `1024` or `4096`)." }
5958
- { env_var: "ONLY_SUBDOMAINS", env_value: "false", desc: "If you wish to get certs only for certain subdomains, but not the main domain (main domain may be hosted on another machine and cannot be validated), set this to `true`" }
6059
- { env_var: "EXTRA_DOMAINS", env_value: "", desc: "Additional fully qualified domain names (comma separated, no spaces) ie. `extradomain.com,subdomain.anotherdomain.org`" }
6160
- { env_var: "STAGING", env_value: "false", desc: "Set to `true` to retrieve certs in staging mode. Rate limits will be much higher, but the resulting cert will not pass the browser's security test. Only to be used for testing purposes." }
@@ -90,7 +89,7 @@ app_setup_block: |
9089
* After setup, navigate to `https://yourdomain.url` to access the default homepage (http access through port 80 is disabled by default, you can enable it by editing the default site config at `/config/nginx/site-confs/default`).
9190
* Certs are checked nightly and if expiration is within 30 days, renewal is attempted. If your cert is about to expire in less than 30 days, check the logs under `/config/log/letsencrypt` to see why the renewals have been failing. It is recommended to input your e-mail in docker parameters so you receive expiration notices from letsencrypt in those circumstances.
9291
### Security and password protection
93-
* The container detects changes to url and subdomains, revokes existing certs and generates new ones during start. It also detects changes to the DHLEVEL parameter and replaces the dhparams file.
92+
* The container detects changes to url and subdomains, revokes existing certs and generates new ones during start.
9493
* If you'd like to password protect your sites, you can use htpasswd. Run the following command on your host to generate the htpasswd file `docker exec -it letsencrypt htpasswd -c /config/nginx/.htpasswd <username>`
9594
* You can add multiple user:pass to `.htpasswd`. For the first user, use the above command, for others, use the above command without the `-c` flag, as it will force deletion of the existing `.htpasswd` and creation of a new one
9695
* You can also use ldap auth for security and access control. A sample, user configurable ldap.conf is provided, and it requires the separate image [linuxserver/ldap-auth](https://hub.docker.com/r/linuxserver/ldap-auth/) to communicate with an ldap server.
@@ -127,7 +126,7 @@ app_setup_nginx_reverse_proxy_block: ""
127126

128127
# changelog
129128
changelogs:
130-
- { date: "17.06.20:", desc: "Reformat ssl.conf." }
129+
- { date: "17.06.20:", desc: "Reformat ssl.conf. Pull in pre-generated 4096-bit dhparams.pem from DO Spaces (rotated weekly via Jenkins job: https://ci.linuxserver.io/blue/organizations/jenkins/Xtras-Builders-Etc%2Fdhparams-uploader/activity for use in new instances); deprecate `DHLEVEL` param." }
131130
- { date: "01.06.20:", desc: "Rebasing to alpine 3.12, change ldap login address to `/ldaplogin` to avoid clashes (existing users need to manually update)." }
132131
- { date: "31.05.20:", desc: "Tweak Authelia confs (existing users can delete `authelia-server.conf` and `authelia-location.conf`, and restart to update)." }
133132
- { date: "23.05.20:", desc: "Add support for Authelia." }

root/etc/cont-init.d/50-config

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ URL=${URL}\\n\
99
SUBDOMAINS=${SUBDOMAINS}\\n\
1010
EXTRA_DOMAINS=${EXTRA_DOMAINS}\\n\
1111
ONLY_SUBDOMAINS=${ONLY_SUBDOMAINS}\\n\
12-
DHLEVEL=${DHLEVEL}\\n\
1312
VALIDATION=${VALIDATION}\\n\
1413
DNSPLUGIN=${DNSPLUGIN}\\n\
1514
EMAIL=${EMAIL}\\n\
@@ -21,7 +20,7 @@ if [ -n "${TEST_RUN}" ]; then
2120
fi
2221

2322
# Sanitize variables
24-
SANED_VARS=( DHLEVEL DNSPLUGIN EMAIL EXTRA_DOMAINS ONLY_SUBDOMAINS STAGING SUBDOMAINS URL VALIDATION )
23+
SANED_VARS=( DNSPLUGIN EMAIL EXTRA_DOMAINS ONLY_SUBDOMAINS STAGING SUBDOMAINS URL VALIDATION )
2524
for i in "${SANED_VARS[@]}"
2625
do
2726
export echo "$i"="${!i//\"/}"
@@ -46,8 +45,8 @@ chown -R abc:abc /config/dns-conf
4645

4746
# copy reverse proxy configs
4847
cp -R /defaults/proxy-confs /config/nginx/
49-
# remove outdated files (remove this action after 2019/08/29)
50-
rm -f /config/nginx/proxy-confs/_readme /config/nginx/proxy-confs/mytinytodo.subfolder.conf.example
48+
# remove outdated files (remove this action after 2020/10/17)
49+
rm -f /config/nginx/proxy-confs/seafile.subdomain.config.sample /config/nginx/proxy-confs/librespeed.subdomain.com.sample
5150

5251
# copy/update the fail2ban config defaults to/in /config
5352
cp -R /defaults/fail2ban/filter.d /config/fail2ban/
@@ -79,6 +78,17 @@ cp /config/fail2ban/jail.local /etc/fail2ban/jail.local
7978
[[ ! -f /config/nginx/authelia-location.conf ]] && \
8079
cp /defaults/authelia-location.conf /config/nginx/authelia-location.conf
8180

81+
# copy pre-generated dhparams or generate if needed
82+
[[ ! -f /config/nginx/dhparams.pem ]] && \
83+
cp /defaults/dhparams.pem /config/nginx/dhparams.pem
84+
if ! grep -q 'PARAMETERS' "/config/nginx/dhparams.pem"; then
85+
curl -o /config/nginx/dhparams.pem -L "https://lsio.ams3.digitaloceanspaces.com/dhparams.pem"
86+
fi
87+
if ! grep -q 'PARAMETERS' "/config/nginx/dhparams.pem"; then
88+
echo "Generating dhparams.pem. This will take a long time. Do not stop the container until this process is completed."
89+
openssl dhparam -out /config/nginx/dhparams.pem 4096
90+
fi
91+
8292
# check to make sure DNSPLUGIN is selected if dns validation is used
8393
[[ "$VALIDATION" = "dns" ]] && [[ ! "$DNSPLUGIN" =~ ^(aliyun|cloudflare|cloudxns|cpanel|digitalocean|dnsimple|dnsmadeeasy|domeneshop|gandi|google|inwx|linode|luadns|nsone|ovh|rfc2136|route53|transip)$ ]] && \
8494
echo "Please set the DNSPLUGIN variable to a valid plugin name. See docker info for more details." && \
@@ -90,7 +100,7 @@ cp /config/crontabs/* /etc/crontabs/
90100

91101
# create original config file if it doesn't exist
92102
if [ ! -f "/config/donoteditthisfile.conf" ]; then
93-
echo -e "ORIGURL=\"$URL\" ORIGSUBDOMAINS=\"$SUBDOMAINS\" ORIGONLY_SUBDOMAINS=\"$ONLY_SUBDOMAINS\" ORIGEXTRA_DOMAINS=\"$EXTRA_DOMAINS\" ORIGDHLEVEL=\"$DHLEVEL\" ORIGVALIDATION=\"$VALIDATION\" ORIGDNSPLUGIN=\"$DNSPLUGIN\" ORIGPROPAGATION=\"$PROPAGATION\" ORIGSTAGING=\"$STAGING\" ORIGDUCKDNSTOKEN=\"$DUCKDNSTOKEN\"" > /config/donoteditthisfile.conf
103+
echo -e "ORIGURL=\"$URL\" ORIGSUBDOMAINS=\"$SUBDOMAINS\" ORIGONLY_SUBDOMAINS=\"$ONLY_SUBDOMAINS\" ORIGEXTRA_DOMAINS=\"$EXTRA_DOMAINS\" ORIGVALIDATION=\"$VALIDATION\" ORIGDNSPLUGIN=\"$DNSPLUGIN\" ORIGPROPAGATION=\"$PROPAGATION\" ORIGSTAGING=\"$STAGING\" ORIGDUCKDNSTOKEN=\"$DUCKDNSTOKEN\"" > /config/donoteditthisfile.conf
94104
echo "Created donoteditthisfile.conf"
95105
fi
96106

@@ -104,12 +114,6 @@ if [ -z "$VALIDATION" ]; then
104114
echo "VALIDATION parameter not set; setting it to http"
105115
fi
106116

107-
# compare dhparams existence and level, create if necessary
108-
if [ ! "$DHLEVEL" = "$ORIGDHLEVEL" ]; then
109-
rm -rf /config/nginx/dhparams.pem
110-
echo "DH parameters bit setting changed. Deleting old dhparams file."
111-
fi
112-
113117
# if staging is set to true, use the staging server
114118
if [ "$STAGING" = "true" ]; then
115119
echo "NOTICE: Staging is active"
@@ -118,14 +122,6 @@ else
118122
ACMESERVER="https://acme-v02.api.letsencrypt.org/directory"
119123
fi
120124

121-
if [ ! -f "/config/nginx/dhparams.pem" ]; then
122-
echo "Creating DH parameters for additional security. This may take a very long time. There will be another message once this process is completed"
123-
openssl dhparam -out /config/nginx/dhparams.pem "$DHLEVEL"
124-
echo "DH parameters successfully created - $DHLEVEL bits"
125-
else
126-
echo "$ORIGDHLEVEL bit DH parameters present"
127-
fi
128-
129125
# figuring out url only vs url & subdomains vs subdomains only
130126
if [ -n "$SUBDOMAINS" ]; then
131127
echo "SUBDOMAINS entered, processing"
@@ -238,7 +234,7 @@ if [ ! "$URL" = "$ORIGURL" ] || [ ! "$SUBDOMAINS" = "$ORIGSUBDOMAINS" ] || [ ! "
238234
fi
239235

240236
# saving new variables
241-
echo -e "ORIGURL=\"$URL\" ORIGSUBDOMAINS=\"$SUBDOMAINS\" ORIGONLY_SUBDOMAINS=\"$ONLY_SUBDOMAINS\" ORIGEXTRA_DOMAINS=\"$EXTRA_DOMAINS\" ORIGDHLEVEL=\"$DHLEVEL\" ORIGVALIDATION=\"$VALIDATION\" ORIGDNSPLUGIN=\"$DNSPLUGIN\" ORIGPROPAGATION=\"$PROPAGATION\" ORIGSTAGING=\"$STAGING\" ORIGDUCKDNSTOKEN=\"$DUCKDNSTOKEN\"" > /config/donoteditthisfile.conf
237+
echo -e "ORIGURL=\"$URL\" ORIGSUBDOMAINS=\"$SUBDOMAINS\" ORIGONLY_SUBDOMAINS=\"$ONLY_SUBDOMAINS\" ORIGEXTRA_DOMAINS=\"$EXTRA_DOMAINS\" ORIGVALIDATION=\"$VALIDATION\" ORIGDNSPLUGIN=\"$DNSPLUGIN\" ORIGPROPAGATION=\"$PROPAGATION\" ORIGSTAGING=\"$STAGING\" ORIGDUCKDNSTOKEN=\"$DUCKDNSTOKEN\"" > /config/donoteditthisfile.conf
242238

243239
# alter extension for error message
244240
if [ "$DNSPLUGIN" = "google" ]; then

0 commit comments

Comments
 (0)