-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #507 from srvrco/dual-rsa-ecdsa-2-locations
Fix bug #505 with DUAL_RSA_ECDSA and multiple locations
- Loading branch information
Showing
7 changed files
with
119 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#! /usr/bin/env bats | ||
|
||
load '/bats-support/load.bash' | ||
load '/bats-assert/load.bash' | ||
load '/getssl/test/test_helper.bash' | ||
|
||
|
||
# These are run for every test, not once per file | ||
setup() { | ||
export CURL_CA_BUNDLE=/root/pebble-ca-bundle.crt | ||
curl --silent -X POST -d '{"host":"'a.$GETSSL_HOST'", "addresses":["'$GETSSL_IP'"]}' http://10.30.50.3:8055/add-a | ||
} | ||
|
||
|
||
teardown() { | ||
curl --silent -X POST -d '{"host":"'a.$GETSSL_HOST'", "addresses":["'$GETSSL_IP'"]}' http://10.30.50.3:8055/del-a | ||
} | ||
|
||
|
||
@test "Create dual certificates and copy RSA and ECDSA chain and key to two locations" { | ||
CONFIG_FILE="getssl-http01-dual-rsa-ecdsa-2-locations.cfg" | ||
setup_environment | ||
mkdir -p /root/a.${GETSSL_HOST} | ||
|
||
init_getssl | ||
create_certificate | ||
assert_success | ||
|
||
# Check that the RSA chain and key have been copied to both locations | ||
assert [ -e "/etc/nginx/pki/domain-chain.crt" ] | ||
assert [ -e "/root/a.${GETSSL_HOST}/domain-chain.crt" ] | ||
assert [ -e "/etc/nginx/pki/private/server.key" ] | ||
assert [ -e "/root/a.${GETSSL_HOST}/server.key" ] | ||
|
||
# Check that the ECDSA chain and key have been copied to both locations | ||
assert [ -e "/etc/nginx/pki/domain-chain.ec.crt" ] | ||
assert [ -e "/root/a.${GETSSL_HOST}/domain-chain.ec.crt" ] | ||
assert [ -e "/etc/nginx/pki/private/server.ec.key" ] | ||
assert [ -e "/root/a.${GETSSL_HOST}/server.ec.key" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
docker exec -it getssl-alpine bats /getssl/test | ||
docker exec -it getssl-centos6 bats /getssl/test | ||
docker exec -it getssl-debian bats /getssl/test | ||
docker exec -it getssl-ubuntu bats /getssl/test | ||
docker exec -it getssl-ubuntu18 bats /getssl/test |
32 changes: 32 additions & 0 deletions
32
test/test-config/getssl-http01-dual-rsa-ecdsa-2-locations.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Test that more than one location can be specified for CERT and KEY locations and that the | ||
# files are copied to both locations when both RSA and ECDSA certificates are created | ||
# | ||
CA="https://pebble:14000/dir" | ||
|
||
DUAL_RSA_ECDSA="true" | ||
ACCOUNT_KEY_TYPE="prime256v1" | ||
PRIVATE_KEY_ALG="prime256v1" | ||
|
||
# Additional domains - this could be multiple domains / subdomains in a comma separated list | ||
SANS="a.${GETSSL_HOST}" | ||
|
||
# Acme Challenge Location. | ||
ACL=('/var/www/html/.well-known/acme-challenge') | ||
|
||
#Set USE_SINGLE_ACL="true" to use a single ACL for all checks | ||
USE_SINGLE_ACL="true" | ||
|
||
# Location for all your certs, these can either be on the server (full path name) | ||
# or using ssh /sftp as for the ACL | ||
DOMAIN_CERT_LOCATION="/etc/nginx/pki/server.crt" | ||
DOMAIN_KEY_LOCATION="/etc/nginx/pki/private/server.key;/root/a.${GETSSL_HOST}/server.key" | ||
CA_CERT_LOCATION="/etc/nginx/pki/chain.crt" | ||
DOMAIN_CHAIN_LOCATION="/etc/nginx/pki/domain-chain.crt;/root/a.${GETSSL_HOST}/domain-chain.crt" # this is the domain cert and CA cert | ||
DOMAIN_PEM_LOCATION="" # this is the domain_key, domain cert and CA cert | ||
|
||
# The command needed to reload apache / nginx or whatever you use | ||
RELOAD_CMD="cp /getssl/test/test-config/nginx-ubuntu-ssl ${NGINX_CONFIG} && /getssl/test/restart-nginx" | ||
|
||
# Define the server type and confirm correct certificate is installed | ||
SERVER_TYPE="https" | ||
CHECK_REMOTE="true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters