| @ -0,0 +1,19 @@ | |||
| #!/bin/bash | |||
| # need to add your Token for duckdns below | |||
| token=${DUCKDNS_TOKEN:-} | |||
| if [ -z "$token" ]; then | |||
| echo "DUCKDNS_TOKEN not set" | |||
| exit 1 | |||
| fi | |||
| domain="$1" | |||
| txtvalue="$2" | |||
| response=$(curl --silent "https://www.duckdns.org/update?domains=${domain}&token=${token}&txt=${txtvalue}") | |||
| if [ "$response" != "OK" ]; then | |||
| echo "Failed to update TXT record for ${domain} at duckdns.org (is the TOKEN valid?)" | |||
| echo "Response: $response" | |||
| exit 1 | |||
| fi | |||
| @ -0,0 +1,12 @@ | |||
| #!/bin/bash | |||
| # need to add your Token for duckdns below | |||
| token=${DUCKDNS_TOKEN:-} | |||
| domain="$1" | |||
| response=$(curl --silent "https://www.duckdns.org/update?domains=${domain}&token=${token}&txt=&clear=true") | |||
| if [ "$response" != "OK" ]; then | |||
| echo "Failed to update TXT record for ${domain} at duckdns.org (is the TOKEN valid?)" | |||
| echo "$response" | |||
| exit 1 | |||
| fi | |||
| @ -0,0 +1,42 @@ | |||
| #! /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() { | |||
| if [ -n "$STAGING" ]; then | |||
| export GETSSL_HOST=getssl.duckdns.org | |||
| fi | |||
| } | |||
| @test "Create new certificate using staging server and DuckDNS" { | |||
| if [ -z "$STAGING" ]; then | |||
| skip "Running internal tests, skipping external test" | |||
| fi | |||
| CONFIG_FILE="getssl-duckdns01.cfg" | |||
| setup_environment | |||
| init_getssl | |||
| create_certificate | |||
| assert_success | |||
| refute_output --regexp '[Ff][Aa][Ii][Ll][Ee][Dd]' | |||
| refute_output --regexp '[Ee][Rr][Rr][Oo][Rr]' | |||
| refute_output --regexp '[Ww][Aa][Rr][Nn][Ii][Nn][Gg]' | |||
| } | |||
| @test "Force renewal of certificate using staging server and DuckDNS" { | |||
| if [ -z "$STAGING" ]; then | |||
| skip "Running internal tests, skipping external test" | |||
| fi | |||
| run ${CODE_DIR}/getssl -f $GETSSL_HOST | |||
| assert_success | |||
| refute_output --regexp '[Ff][Aa][Ii][Ll][Ee][Dd]' | |||
| refute_output --regexp '[Ee][Rr][Rr][Oo][Rr]' | |||
| refute_output --regexp '[Ww][Aa][Rr][Nn][Ii][Nn][Gg]' | |||
| cleanup_environment | |||
| curl --silent -X POST -d '{"host":"getssl.duckdns.org", "addresses":["'$GETSSL_IP'"]}' http://10.30.50.3:8055/del-a | |||
| } | |||
| @ -0,0 +1,103 @@ | |||
| #! /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() { | |||
| if [ -n "$STAGING" ]; then | |||
| export GETSSL_HOST=getssl.duckdns.org | |||
| fi | |||
| } | |||
| @test "Create new certificate using staging server and prime256v1" { | |||
| if [ -z "$STAGING" ]; then | |||
| skip "Running internal tests, skipping external test" | |||
| fi | |||
| CONFIG_FILE="getssl-duckdns01.cfg" | |||
| GETSSL_HOST=getssl.duckdns.org | |||
| setup_environment | |||
| init_getssl | |||
| sed -e 's/rsa/prime256v1/g' < "${CODE_DIR}/test/test-config/${CONFIG_FILE}" > "${INSTALL_DIR}/.getssl/${GETSSL_HOST}/getssl.cfg" | |||
| run ${CODE_DIR}/getssl "$GETSSL_HOST" | |||
| assert_success | |||
| refute_output --regexp '[Ff][Aa][Ii][Ll][Ee][Dd]' | |||
| refute_output --regexp '[Ee][Rr][Rr][Oo][Rr]' | |||
| refute_output --regexp '[Ww][Aa][Rr][Nn][Ii][Nn][Gg]' | |||
| } | |||
| @test "Force renewal of certificate using staging server and prime256v1" { | |||
| if [ -z "$STAGING" ]; then | |||
| skip "Running internal tests, skipping external test" | |||
| fi | |||
| run ${CODE_DIR}/getssl -f $GETSSL_HOST | |||
| assert_success | |||
| refute_output --regexp '[Ff][Aa][Ii][Ll][Ee][Dd]' | |||
| refute_output --regexp '[Ee][Rr][Rr][Oo][Rr]' | |||
| refute_output --regexp '[Ww][Aa][Rr][Nn][Ii][Nn][Gg]' | |||
| cleanup_environment | |||
| } | |||
| @test "Create new certificate using staging server and secp384r1" { | |||
| if [ -z "$STAGING" ]; then | |||
| skip "Running internal tests, skipping external test" | |||
| fi | |||
| CONFIG_FILE="getssl-duckdns01.cfg" | |||
| GETSSL_HOST=getssl.duckdns.org | |||
| setup_environment | |||
| init_getssl | |||
| sed -e 's/rsa/secp384r1/g' < "${CODE_DIR}/test/test-config/${CONFIG_FILE}" > "${INSTALL_DIR}/.getssl/${GETSSL_HOST}/getssl.cfg" | |||
| run ${CODE_DIR}/getssl "$GETSSL_HOST" | |||
| assert_success | |||
| refute_output --regexp '[Ff][Aa][Ii][Ll][Ee][Dd]' | |||
| refute_output --regexp '[Ee][Rr][Rr][Oo][Rr]' | |||
| refute_output --regexp '[Ww][Aa][Rr][Nn][Ii][Nn][Gg]' | |||
| } | |||
| @test "Force renewal of certificate using staging server and secp384r1" { | |||
| if [ -z "$STAGING" ]; then | |||
| skip "Running internal tests, skipping external test" | |||
| fi | |||
| run ${CODE_DIR}/getssl -f $GETSSL_HOST | |||
| assert_success | |||
| refute_output --regexp '[Ff][Aa][Ii][Ll][Ee][Dd]' | |||
| refute_output --regexp '[Ee][Rr][Rr][Oo][Rr]' | |||
| refute_output --regexp '[Ww][Aa][Rr][Nn][Ii][Nn][Gg]' | |||
| cleanup_environment | |||
| } | |||
| @test "Create new certificate using staging server and secp521r1" { | |||
| skip "The staging server returns 'ECDSA curve P-521 not allowed'" | |||
| CONFIG_FILE="getssl-duckdns01.cfg" | |||
| GETSSL_HOST=getssl.duckdns.org | |||
| setup_environment | |||
| init_getssl | |||
| sed -e 's/rsa/secp521r1/g' < "${CODE_DIR}/test/test-config/${CONFIG_FILE}" > "${INSTALL_DIR}/.getssl/${GETSSL_HOST}/getssl.cfg" | |||
| run ${CODE_DIR}/getssl "$GETSSL_HOST" | |||
| assert_success | |||
| refute_output --regexp '[Ff][Aa][Ii][Ll][Ee][Dd]' | |||
| refute_output --regexp '[Ee][Rr][Rr][Oo][Rr]' | |||
| refute_output --regexp '[Ww][Aa][Rr][Nn][Ii][Nn][Gg]' | |||
| } | |||
| @test "Force renewal of certificate using staging server and secp521r1" { | |||
| skip "The staging server returns 'ECDSA curve P-521 not allowed'" | |||
| run ${CODE_DIR}/getssl -f $GETSSL_HOST | |||
| assert_success | |||
| refute_output --regexp '[Ff][Aa][Ii][Ll][Ee][Dd]' | |||
| refute_output --regexp '[Ee][Rr][Rr][Oo][Rr]' | |||
| refute_output --regexp '[Ww][Aa][Rr][Nn][Ii][Nn][Gg]' | |||
| cleanup_environment | |||
| } | |||
| @ -0,0 +1,37 @@ | |||
| # Test that the script works with external dns provider and staging server | |||
| # | |||
| CA="https://acme-staging-v02.api.letsencrypt.org/directory" | |||
| VALIDATE_VIA_DNS=true | |||
| DNS_ADD_COMMAND="/getssl/dns_scripts/dns_add_duckdns" | |||
| DNS_DEL_COMMAND="/getssl/dns_scripts/dns_del_duckdns" | |||
| AUTH_DNS_SERVER=1.1.1.1 | |||
| CHECK_ALL_AUTH_DNS=false | |||
| DNS_EXTRA_WAIT=20 | |||
| ACCOUNT_KEY_TYPE="rsa" | |||
| PRIVATE_KEY_ALG="rsa" | |||
| # Additional domains - this could be multiple domains / subdomains in a comma separated list | |||
| SANS="" | |||
| # Acme Challenge Location. The first line for the domain, the following ones for each additional domain. | |||
| ACL=('/var/www/html/.well-known/acme-challenge') | |||
| #Set USE_SINGLE_ACL="true" to use a single ACL for all checks | |||
| USE_SINGLE_ACL="false" | |||
| # 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" | |||
| CA_CERT_LOCATION="/etc/nginx/pki/chain.crt" | |||
| DOMAIN_CHAIN_LOCATION="" # 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 (using a custom port) | |||
| SERVER_TYPE="https" | |||
| CHECK_REMOTE="true" | |||