Skip to content

Commit 5df6026

Browse files
committed
Test using pebble and docker
1 parent 7f1b94c commit 5df6026

5 files changed

Lines changed: 209 additions & 0 deletions

File tree

docker-compose.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: '3'
2+
services:
3+
pebble:
4+
image: letsencrypt/pebble:latest
5+
# TODO enable -strict
6+
command: pebble -config /test/config/pebble-config.json
7+
environment:
8+
# with Go 1.13.x which defaults TLS 1.3 to on
9+
GODEBUG: "tls13=1"
10+
ports:
11+
- 14000:14000 # HTTPS ACME API
12+
- 15000:15000 # HTTPS Management API
13+
networks:
14+
acmenet:
15+
ipv4_address: 10.30.50.2
16+
getssl:
17+
build:
18+
context: .
19+
dockerfile: test/Dockerfile
20+
container_name: getssl
21+
volumes:
22+
- .:/getssl
23+
networks:
24+
acmenet:
25+
ipv4_address: 10.30.50.4
26+
27+
networks:
28+
acmenet:
29+
driver: bridge
30+
ipam:
31+
driver: default
32+
config:
33+
- subnet: 10.30.50.0/24

test/Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM ubuntu:bionic
2+
# bionic = latest 18 version
3+
4+
# Update and install required software
5+
RUN apt-get update
6+
# TODO work out why default version of awk fails
7+
RUN apt-get install -y git curl dnsutils wget linux-libc-dev make gcc binutils nginx-light gawk
8+
RUN apt-get install -y vim dos2unix # for debugging
9+
# TODO test with drill, dig, host
10+
11+
WORKDIR /root
12+
RUN mkdir /etc/nginx/pki
13+
RUN mkdir /etc/nginx/pki/private
14+
COPY ./test/test-config/nginx-ubuntu-sites-enabled-default /etc/nginx/sites-enabled/default
15+
16+
# BATS (Bash Automated Testings)
17+
# RUN git clone https://github.com/bats-core/bats-core.git
18+
# RUN bats-core/install.sh /usr/local
19+
20+
COPY test/test-config/getssl-ubuntu.cfg getssl.cfg
21+
22+
EXPOSE 80 443
23+
24+
# Run eternal loop - for testing
25+
CMD ["/bin/bash", "-c", "while :; do sleep 10; done"]
26+
27+
# with Pebble
28+
# docker-compose -f "test\docker-compose.yml" up -d --build
29+
# docker exec -it test_getssl /bin/bash
30+
# /getssl/test/run-test.sh

test/run-test.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#! /bin/sh
2+
3+
wget --no-clobber https://raw.githubusercontent.com/letsencrypt/pebble/master/test/certs/pebble.minica.pem
4+
export CURL_CA_BUNDLE=/root/pebble.minica.pem
5+
6+
service nginx start
7+
/getssl/getssl -c getssl
8+
cp getssl.cfg /root/.getssl/getssl
9+
/getssl/getssl getssl

test/test-config/getssl-ubuntu.cfg

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Uncomment and modify any variables you need
2+
# see https://github.com/srvrco/getssl/wiki/Config-variables for details
3+
# see https://github.com/srvrco/getssl/wiki/Example-config-files for example configs
4+
#
5+
# The staging server is best for testing
6+
#CA="https://acme-staging.api.letsencrypt.org"
7+
# This server issues full certificates, however has rate limits
8+
#CA="https://acme-v01.api.letsencrypt.org"
9+
CA="https://pebble:14000/dir"
10+
SERVER_TYPE="5002"
11+
#PRIVATE_KEY_ALG="rsa"
12+
13+
# Additional domains - this could be multiple domains / subdomains in a comma separated list
14+
# Note: this is Additional domains - so should not include the primary domain.
15+
SANS=""
16+
17+
# Acme Challenge Location. The first line for the domain, the following ones for each additional domain.
18+
# If these start with ssh: then the next variable is assumed to be the hostname and the rest the location.
19+
# An ssh key will be needed to provide you with access to the remote server.
20+
# Optionally, you can specify a different userid for ssh/scp to use on the remote server before the @ sign.
21+
# If left blank, the username on the local server will be used to authenticate against the remote server.
22+
# If these start with ftp: then the next variables are ftpuserid:ftppassword:servername:ACL_location
23+
# These should be of the form "/path/to/your/website/folder/.well-known/acme-challenge"
24+
# where "/path/to/your/website/folder/" is the path, on your web server, to the web root for your domain.
25+
ACL=('/var/www/html/.well-known/acme-challenge')
26+
# 'ssh:server5:/var/www/getssltest.hopto.org/web/.well-known/acme-challenge'
27+
# 'ssh:sshuserid@server5:/var/www/getssltest.hopto.org/web/.well-known/acme-challenge'
28+
# 'ftp:ftpuserid:ftppassword:getssltest.hopto.org:/web/.well-known/acme-challenge')
29+
30+
#Set USE_SINGLE_ACL="true" to use a single ACL for all checks
31+
USE_SINGLE_ACL="false"
32+
33+
# Location for all your certs, these can either be on the server (full path name)
34+
# or using ssh /sftp as for the ACL
35+
DOMAIN_CERT_LOCATION="/etc/nginx/pki/server.crt"
36+
DOMAIN_KEY_LOCATION="/etc/nginx/pki/private/server.key"
37+
CA_CERT_LOCATION="/etc/nginx/pki/chain.crt"
38+
DOMAIN_CHAIN_LOCATION="" # this is the domain cert and CA cert
39+
DOMAIN_PEM_LOCATION="" # this is the domain_key, domain cert and CA cert
40+
41+
# The command needed to reload apache / nginx or whatever you use
42+
RELOAD_CMD="service nginx restart"
43+
44+
# Define the server type. This can be https, ftp, ftpi, imap, imaps, pop3, pop3s, smtp,
45+
# smtps_deprecated, smtps, smtp_submission, xmpp, xmpps, ldaps or a port number which
46+
# will be checked for certificate expiry and also will be checked after
47+
# an update to confirm correct certificate is running (if CHECK_REMOTE) is set to true
48+
#SERVER_TYPE="https"
49+
#CHECK_REMOTE="true"
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
##
2+
# You should look at the following URL's in order to grasp a solid understanding
3+
# of Nginx configuration files in order to fully unleash the power of Nginx.
4+
# http://wiki.nginx.org/Pitfalls
5+
# http://wiki.nginx.org/QuickStart
6+
# http://wiki.nginx.org/Configuration
7+
#
8+
# Generally, you will want to move this file somewhere, and start with a clean
9+
# file but keep this around for reference. Or just disable in sites-enabled.
10+
#
11+
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
12+
##
13+
14+
# Default server configuration
15+
#
16+
server {
17+
listen 5002 default_server;
18+
listen [::]:5002 default_server;
19+
20+
# SSL configuration
21+
#
22+
listen 5001 ssl default_server;
23+
listen [::]:5001 ssl default_server;
24+
#
25+
# Note: You should disable gzip for SSL traffic.
26+
# See: https://bugs.debian.org/773332
27+
#
28+
# Read up on ssl_ciphers to ensure a secure configuration.
29+
# See: https://bugs.debian.org/765782
30+
#
31+
# Self signed certs generated by the ssl-cert package
32+
# Don't use them in a production server!
33+
#
34+
# include snippets/snakeoil.conf;
35+
36+
root /var/www/html;
37+
38+
# Add index.php to the list if you are using PHP
39+
index index.html index.htm index.nginx-debian.html;
40+
41+
server_name _;
42+
# ssl_certificate /etc/nginx/pki/server.crt;
43+
# ssl_certificate_key /etc/nginx/pki/private/server.key;
44+
45+
location / {
46+
# First attempt to serve request as file, then
47+
# as directory, then fall back to displaying a 404.
48+
try_files $uri $uri/ =404;
49+
}
50+
51+
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
52+
#
53+
#location ~ \.php$ {
54+
# include snippets/fastcgi-php.conf;
55+
#
56+
# # With php7.0-cgi alone:
57+
# fastcgi_pass 127.0.0.1:9000;
58+
# # With php7.0-fpm:
59+
# fastcgi_pass unix:/run/php/php7.0-fpm.sock;
60+
#}
61+
62+
# deny access to .htaccess files, if Apache's document root
63+
# concurs with nginx's one
64+
#
65+
#location ~ /\.ht {
66+
# deny all;
67+
#}
68+
}
69+
70+
71+
# Virtual Host configuration for example.com
72+
#
73+
# You can move that to a different file under sites-available/ and symlink that
74+
# to sites-enabled/ to enable it.
75+
#
76+
#server {
77+
# listen 80;
78+
# listen [::]:80;
79+
#
80+
# server_name example.com;
81+
#
82+
# root /var/www/example.com;
83+
# index index.html;
84+
#
85+
# location / {
86+
# try_files $uri $uri/ =404;
87+
# }
88+
#}

0 commit comments

Comments
 (0)