Skip to content

Commit cf77c7e

Browse files
authored
Merge pull request #251 from XPLOT1ON/DH_PARAM_OVERRIDE
Add ability to override default DHPARAM_BITS of 2048
2 parents f1d8ab1 + cf6e235 commit cf77c7e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ $ docker run -d \
219219
* No value (empty, not set): no change in behavior.
220220
* `ecs` [Amazon ECS using ECS_CONTAINER_METADATA_FILE environment variable](http://docs.aws.amazon.com/AmazonECS/latest/developerguide/container-metadata.html)
221221

222+
* `DHPARAM_BITS` - Change the size of the Diffie-Hellman key generated by the container from the default value of 2048 bits. For example `-e DHPARAM_BITS=1024` to support some older clients like Java 6 and 7.
223+
222224
#### Examples:
223225

224226
If you want other examples how to use this container, look at:

app/entrypoint.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,15 @@ function check_writable_directory {
7777
}
7878

7979
function check_dh_group {
80+
local DHPARAM_BITS="${DHPARAM_BITS:-2048}"
81+
re='^[0-9]*$'
82+
if ! [[ "$DHPARAM_BITS" =~ $re ]] ; then
83+
echo "Error: invalid Diffie-Hellman size of $DHPARAM_BITS !" >&2
84+
exit 1
85+
fi
8086
if [[ ! -f /etc/nginx/certs/dhparam.pem ]]; then
8187
echo "Creating Diffie-Hellman group (can take several minutes...)"
82-
openssl dhparam -out /etc/nginx/certs/.dhparam.pem.tmp 2048
88+
openssl dhparam -out /etc/nginx/certs/.dhparam.pem.tmp $DHPARAM_BITS
8389
mv /etc/nginx/certs/.dhparam.pem.tmp /etc/nginx/certs/dhparam.pem || exit 1
8490
fi
8591
}

0 commit comments

Comments
 (0)