Browse Source

Merge pull request #493 from srvrco/test-on-alpine

Fix epoch_date for busybox and json_awk for gawk v5
pull/494/head
Tim Kimber 6 years ago
committed by GitHub
parent
commit
2ad785c558
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 88 additions and 67 deletions
  1. +29
    -4
      docker-compose.yml
  2. +2
    -2
      getssl
  3. +20
    -0
      test/Dockerfile-alpine
  4. +1
    -1
      test/Dockerfile-centos6
  5. +1
    -1
      test/Dockerfile-ubuntu18
  6. +1
    -1
      test/Dockerfile-ubuntu18-no-gawk
  7. +14
    -0
      test/alpine-supervisord.conf
  8. +8
    -0
      test/restart-nginx
  9. +4
    -25
      test/test-config/getssl-dns01.cfg
  10. +4
    -4
      test/test-config/getssl-http01-10-hosts.cfg
  11. +3
    -27
      test/test-config/getssl-http01.cfg
  12. +1
    -2
      test/test_helper.bash

+ 29
- 4
docker-compose.yml View File

@ -7,8 +7,6 @@ services:
environment:
# with Go 1.13.x which defaults TLS 1.3 to on
GODEBUG: "tls13=1"
# Don't re-use authorisations (breaks force renew test scripts)
# PEBBLE_AUTHZREUSE: "0"
ports:
- 14000:14000 # HTTPS ACME API
- 15000:15000 # HTTPS Management API
@ -77,6 +75,33 @@ services:
- i.centos6.getssl.test
- j.centos6.getssl.test
- k.centos6.getssl.test
getssl-alpine:
build:
context: .
dockerfile: test/Dockerfile-alpine
container_name: getssl-alpine
volumes:
- .:/getssl
environment:
GETSSL_HOST: alpine.getssl.test
GETSSL_IP: 10.30.50.6
NGINX_CONFIG: /etc/nginx/conf.d/default.conf
networks:
acmenet:
ipv4_address: 10.30.50.6
aliases:
- alpine.getssl.test
- a.alpine.getssl.test
- b.alpine.getssl.test
- c.alpine.getssl.test
- d.alpine.getssl.test
- e.alpine.getssl.test
- f.alpine.getssl.test
- g.alpine.getssl.test
- h.alpine.getssl.test
- i.alpine.getssl.test
- j.alpine.getssl.test
- k.alpine.getssl.test
getssl-ubuntu18-no-gawk:
build:
context: .
@ -86,12 +111,12 @@ services:
- .:/getssl
environment:
GETSSL_HOST: ubuntu18-no-gawk.getssl.test
GETSSL_IP: 10.30.50.6
GETSSL_IP: 10.30.50.7
NGINX_CONFIG: /etc/nginx/sites-enabled/default
TEST_AWK: "yes"
networks:
acmenet:
ipv4_address: 10.30.50.6
ipv4_address: 10.30.50.7
aliases:
- ubuntu18-no-gawk.getssl.test


+ 2
- 2
getssl View File

@ -716,7 +716,7 @@ date_epoc() { # convert the date into epoch time
elif [[ "$os" == "mac" ]]; then
date -j -f "%b %d %T %Y %Z" "$1" +%s
elif [[ "$os" == "busybox" ]]; then
de_ld=$(echo "$1" | awk '{print $1 $2 $3 $4}')
de_ld=$(echo "$1" | awk '{print $1 " " $2 " " $3 " " $4}')
date -D "%b %d %T %Y" -d "$de_ld" +%s
else
date -d "$1" +%s
@ -1174,7 +1174,7 @@ function scream(msg) {
function tokenize(a1,pq,pb,ESCAPE,CHAR,STRING,NUMBER,KEYWORD,SPACE) {
SPACE="[[:space:]]+"
gsub(/\"[^[:cntrl:]\"\\]*((\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})[^[:cntrl:]\"\\]*)*\"|-?(0|[1-9][0-9]*)([.][0-9]*)?([eE][+-]?[0-9]*)?|null|false|true|[[:space:]]+|./, "\n&", a1)
gsub(/"[^[:cntrl:]"\\]*((\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})[^[:cntrl:]"\\]*)*"|-?(0|[1-9][0-9]*)([.][0-9]*)?([eE][+-]?[0-9]*)?|null|false|true|[[:space:]]+|./, "\n&", a1)
gsub("\n" SPACE, "\n", a1)
sub(/^\n/, "", a1)
ITOKENS=0 # get_token() helper


+ 20
- 0
test/Dockerfile-alpine View File

@ -0,0 +1,20 @@
FROM alpine:latest
RUN apk --no-cache add supervisor openssl git curl bind-tools wget gawk nginx bash
# RUN apk --no-cache add vim dos2unix # for debugging
WORKDIR /root
RUN mkdir /run/nginx
RUN mkdir /etc/nginx/pki
RUN mkdir /etc/nginx/pki/private
COPY ./test/test-config/nginx-ubuntu-no-ssl /etc/nginx/sites-enabled/default
COPY ./test/alpine-supervisord.conf /etc/supervisord.conf
# BATS (Bash Automated Testings)
RUN git clone https://github.com/bats-core/bats-core.git /bats-core
RUN git clone https://github.com/jasonkarns/bats-support /bats-support
RUN git clone https://github.com/jasonkarns/bats-assert-1 /bats-assert
RUN /bats-core/install.sh /usr/local
# Use supervisord to run nginx in the background
ENTRYPOINT /usr/bin/supervisord -c /etc/supervisord.conf

+ 1
- 1
test/Dockerfile-centos6 View File

@ -19,4 +19,4 @@ RUN /bats-core/install.sh /usr/local
EXPOSE 80 443
# Run eternal loop - for testing
CMD ["/bin/bash", "-c", "while :; do sleep 10; done"]
CMD tail -f /dev/null

+ 1
- 1
test/Dockerfile-ubuntu18 View File

@ -25,4 +25,4 @@ RUN /bats-core/install.sh /usr/local
EXPOSE 80 443
# Run eternal loop - for testing
CMD ["/bin/bash", "-c", "while :; do sleep 10; done"]
CMD tail -f /dev/null

+ 1
- 1
test/Dockerfile-ubuntu18-no-gawk View File

@ -14,4 +14,4 @@ RUN git clone https://github.com/jasonkarns/bats-assert-1 /bats-assert
RUN /bats-core/install.sh /usr/local
# Run eternal loop - for testing
CMD ["/bin/bash", "-c", "while :; do sleep 10; done"]
CMD tail -f /dev/null

+ 14
- 0
test/alpine-supervisord.conf View File

@ -0,0 +1,14 @@
[supervisord]
nodaemon=true
logfile=/tmp/supervisord.log
childlogdir=/tmp
pidfile = /tmp/supervisord.pid
[program:nginx]
command=nginx -g 'daemon off;'
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=false
startretries=0

+ 8
- 0
test/restart-nginx View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
if [ "$GETSSL_HOST" = "alpine.getssl.test" ]; then
killall -HUP nginx >&3-
sleep 5
else
service nginx restart >&3-
fi

+ 4
- 25
test/test-config/getssl-dns01.cfg View File

@ -2,35 +2,17 @@
# see https://github.com/srvrco/getssl/wiki/Config-variables for details
# see https://github.com/srvrco/getssl/wiki/Example-config-files for example configs
#
# The staging server is best for testing
#CA="https://acme-staging.api.letsencrypt.org"
# This server issues full certificates, however has rate limits
#CA="https://acme-v01.api.letsencrypt.org"
CA="https://pebble:14000/dir"
VALIDATE_VIA_DNS=true
DNS_ADD_COMMAND="/getssl/dns_scripts/dns_add_challtestsrv"
DNS_DEL_COMMAND="/getssl/dns_scripts/dns_del_challtestsrv"
# AUTH_DNS_SERVER=10.30.50.3
#PRIVATE_KEY_ALG="rsa"
# Additional domains - this could be multiple domains / subdomains in a comma separated list
# Note: this is Additional domains - so should not include the primary domain.
SANS=""
# Acme Challenge Location. The first line for the domain, the following ones for each additional domain.
# If these start with ssh: then the next variable is assumed to be the hostname and the rest the location.
# An ssh key will be needed to provide you with access to the remote server.
# Optionally, you can specify a different userid for ssh/scp to use on the remote server before the @ sign.
# If left blank, the username on the local server will be used to authenticate against the remote server.
# If these start with ftp: then the next variables are ftpuserid:ftppassword:servername:ACL_location
# These should be of the form "/path/to/your/website/folder/.well-known/acme-challenge"
# where "/path/to/your/website/folder/" is the path, on your web server, to the web root for your domain.
ACL=('/var/www/html/.well-known/acme-challenge')
# 'ssh:server5:/var/www/getssltest.hopto.org/web/.well-known/acme-challenge'
# 'ssh:sshuserid@server5:/var/www/getssltest.hopto.org/web/.well-known/acme-challenge'
# 'ftp:ftpuserid:ftppassword:getssltest.hopto.org:/web/.well-known/acme-challenge')
#Set USE_SINGLE_ACL="true" to use a single ACL for all checks
USE_SINGLE_ACL="false"
@ -44,11 +26,8 @@ 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} && service nginx restart >&3-"
RELOAD_CMD="cp /getssl/test/test-config/nginx-ubuntu-ssl ${NGINX_CONFIG} && /getssl/test/restart-nginx"
# Define the server type. This can be https, ftp, ftpi, imap, imaps, pop3, pop3s, smtp,
# smtps_deprecated, smtps, smtp_submission, xmpp, xmpps, ldaps or a port number which
# will be checked for certificate expiry and also will be checked after
# an update to confirm correct certificate is running (if CHECK_REMOTE) is set to true
#SERVER_TYPE="https"
#CHECK_REMOTE="true"
# Define the server type and confirm correct certificate is installed
SERVER_TYPE="https"
CHECK_REMOTE="true"

+ 4
- 4
test/test-config/getssl-http01-10-hosts.cfg View File

@ -5,7 +5,6 @@
CA="https://pebble:14000/dir"
# Additional domains - this could be multiple domains / subdomains in a comma separated list
# Note: this is Additional domains - so should not include the primary domain.
SANS="a.${GETSSL_HOST},b.${GETSSL_HOST},c.${GETSSL_HOST},d.${GETSSL_HOST},e.${GETSSL_HOST},f.${GETSSL_HOST},g.${GETSSL_HOST},h.${GETSSL_HOST},i.${GETSSL_HOST},j.${GETSSL_HOST},k.${GETSSL_HOST}"
# Acme Challenge Location.
@ -22,7 +21,8 @@ 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} && service nginx restart >&3-"
RELOAD_CMD="cp /getssl/test/test-config/nginx-ubuntu-ssl ${NGINX_CONFIG} && /getssl/test/restart-nginx"
#SERVER_TYPE="https"
#CHECK_REMOTE="true"
# Define the server type and confirm correct certificate is installed
SERVER_TYPE="https"
CHECK_REMOTE="true"

+ 3
- 27
test/test-config/getssl-http01.cfg View File

@ -2,34 +2,13 @@
# see https://github.com/srvrco/getssl/wiki/Config-variables for details
# see https://github.com/srvrco/getssl/wiki/Example-config-files for example configs
#
# The staging server is best for testing
#CA="https://acme-staging.api.letsencrypt.org"
# This server issues full certificates, however has rate limits
#CA="https://acme-v01.api.letsencrypt.org"
CA="https://pebble:14000/dir"
#VALIDATE_VIA_DNS=true
#DNS_ADD_COMMAND="/getssl/dns_scripts/dns_add_challtestsrv"
#DNS_DEL_COMMAND="/getssl/dns_scripts/dns_del_challtestsrv"
#PRIVATE_KEY_ALG="rsa"
# Additional domains - this could be multiple domains / subdomains in a comma separated list
# Note: this is Additional domains - so should not include the primary domain.
SANS=""
# Acme Challenge Location. The first line for the domain, the following ones for each additional domain.
# If these start with ssh: then the next variable is assumed to be the hostname and the rest the location.
# An ssh key will be needed to provide you with access to the remote server.
# Optionally, you can specify a different userid for ssh/scp to use on the remote server before the @ sign.
# If left blank, the username on the local server will be used to authenticate against the remote server.
# If these start with ftp: then the next variables are ftpuserid:ftppassword:servername:ACL_location
# These should be of the form "/path/to/your/website/folder/.well-known/acme-challenge"
# where "/path/to/your/website/folder/" is the path, on your web server, to the web root for your domain.
# Acme Challenge Location.
ACL=('/var/www/html/.well-known/acme-challenge')
# 'ssh:server5:/var/www/getssltest.hopto.org/web/.well-known/acme-challenge'
# 'ssh:sshuserid@server5:/var/www/getssltest.hopto.org/web/.well-known/acme-challenge'
# 'ftp:ftpuserid:ftppassword:getssltest.hopto.org:/web/.well-known/acme-challenge')
#Set USE_SINGLE_ACL="true" to use a single ACL for all checks
USE_SINGLE_ACL="false"
@ -43,11 +22,8 @@ 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} && service nginx restart >&3-"
RELOAD_CMD="cp /getssl/test/test-config/nginx-ubuntu-ssl ${NGINX_CONFIG} && /getssl/test/restart-nginx"
# Define the server type. This can be https, ftp, ftpi, imap, imaps, pop3, pop3s, smtp,
# smtps_deprecated, smtps, smtp_submission, xmpp, xmpps, ldaps or a port number which
# will be checked for certificate expiry and also will be checked after
# an update to confirm correct certificate is running (if CHECK_REMOTE) is set to true
# Define the server type and confirm correct certificate is installed
SERVER_TYPE="https"
CHECK_REMOTE="true"

+ 1
- 2
test/test_helper.bash View File

@ -19,7 +19,7 @@ setup_environment() {
curl -X POST -d '{"host":"'"$GETSSL_HOST"'", "addresses":["'"$GETSSL_IP"'"]}' http://10.30.50.3:8055/add-a
cp ${CODE_DIR}/test/test-config/nginx-ubuntu-no-ssl ${NGINX_CONFIG}
service nginx restart >&3-
/getssl/test/restart-nginx
}
@ -40,5 +40,4 @@ create_certificate() {
# Create certificate
cp "${CODE_DIR}/test/test-config/${CONFIG_FILE}" "${INSTALL_DIR}/.getssl/${GETSSL_HOST}/getssl.cfg"
run ${CODE_DIR}/getssl "$GETSSL_HOST"
#!FIXME test certificate has been placed in the expected location
}

Loading…
Cancel
Save