-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
213 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
.vscode | ||
*.code-workspace | ||
.vagrant/ | ||
*.log |
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 |
---|---|---|
@@ -1,26 +1,12 @@ | ||
--- | ||
language: python | ||
services: docker | ||
dist: xenial | ||
env: | ||
- GOPATH=~/gopath | ||
|
||
install: | ||
- pip install "molecule>=2.22rc3" docker | ||
- mkdir -p $GOPATH | ||
- git clone https://github.com/letsencrypt/boulder/ $GOPATH/src/github.com/letsencrypt/boulder | ||
- cd $GOPATH/src/github.com/letsencrypt/boulder | ||
- patch -p1 < $TRAVIS_BUILD_DIR/molecule/boulder-allow-example.com.patch | ||
- "echo -e \"version: '3.0'\\nservices: {boulder: {environment: {FAKE_DNS: 10.77.77.1}}}\" > docker-compose.override.yml" | ||
- docker-compose up -d | ||
- until curl http://127.0.0.1:4001/directory; do sleep 0.5; done | ||
- cd - | ||
- mkdir -p /tmp/www/.well-known/acme-challenge | ||
- docker run --rm -d -v /tmp/www:/usr/share/nginx/html:ro -p 10.77.77.1:5002:80 nginx | ||
|
||
before_script: | ||
- cd .. | ||
- mv ansible-dehydrated clutterbox.dehydrated | ||
- cd clutterbox.dehydrated | ||
- ./molecule/setup.sh | ||
|
||
script: | ||
- molecule test |
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,28 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.configure("2") do |config| | ||
config.vm.box = "ubuntu/bionic64" | ||
|
||
|
||
config.vm.provider "virtualbox" do |vb| | ||
vb.linked_clone = true | ||
vb.cpus = 4 | ||
vb.memory = 4096 | ||
end | ||
|
||
config.vm.provision "shell-1", type: "shell", inline: <<-SHELL | ||
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true | ||
apt-get update | ||
apt-get -y install python3-pip jq | ||
curl -sSL "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | ||
chmod +x /usr/local/bin/docker-compose | ||
SHELL | ||
config.vm.provision "docker" do |d| | ||
d.pull_images "ubuntu:18.04" | ||
d.pull_images "ubuntu:16.04" | ||
end | ||
config.vm.provision "shell-2", type: "shell", inline: <<-SHELL | ||
sudo -u vagrant -H sh -c "cd /vagrant && ./molecule/setup.sh" | ||
SHELL | ||
end |
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,9 @@ | ||
FROM ubuntu:bionic | ||
ADD pdns.conf /etc/powerdns/pdns.conf | ||
RUN apt-get update && \ | ||
echo "pdns-backend-sqlite3 pdns-backend-sqlite3/dbconfig-install boolean true" | debconf-set-selections && \ | ||
apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install pdns-server pdns-backend-sqlite3 sqlite3 && \ | ||
apt-get clean | ||
|
||
EXPOSE 8081 53 53/udp | ||
CMD ["/usr/sbin/pdns_server", "--guardian=no", "--daemon=no", "--disable-syslog", "--log-timestamp=no", "--write-pid=no"] |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,14 +1,5 @@ | ||
--- | ||
- name: Converge | ||
hosts: all | ||
vars: | ||
dehydrated_contactemail: notused@example.com | ||
dehydrated_accept_letsencrypt_terms: true | ||
dehydrated_domains: | | ||
example.com www.example.com | ||
dehydrated_wellknown: /tmp/www/.well-known/acme-challenge | ||
dehydrated_use_lexicon: false | ||
dehydrated_ca: http://10.77.77.1:4001/directory | ||
dehydrated_cronjob: false | ||
roles: | ||
- role: clutterbox.dehydrated | ||
- role: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" |
This file was deleted.
Oops, something went wrong.
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,18 @@ | ||
import os | ||
|
||
import testinfra.utils.ansible_runner | ||
|
||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( | ||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('dns01') | ||
|
||
|
||
def test_certificate_file_exists(host): | ||
cert = host.file('/etc/dehydrated/certs/le3.wtf/cert.pem') | ||
chain = host.file('/etc/dehydrated/certs/le3.wtf/chain.pem') | ||
fullchain = host.file('/etc/dehydrated/certs/le3.wtf/fullchain.pem') | ||
privkey = host.file('/etc/dehydrated/certs/le3.wtf/privkey.pem') | ||
|
||
assert cert.exists | ||
assert chain.exists | ||
assert fullchain.exists | ||
assert privkey.exists |
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,18 @@ | ||
import os | ||
|
||
import testinfra.utils.ansible_runner | ||
|
||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( | ||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('http01') | ||
|
||
|
||
def test_certificate_file_exists(host): | ||
cert = host.file('/etc/dehydrated/certs/le2.wtf/cert.pem') | ||
chain = host.file('/etc/dehydrated/certs/le2.wtf/chain.pem') | ||
fullchain = host.file('/etc/dehydrated/certs/le2.wtf/fullchain.pem') | ||
privkey = host.file('/etc/dehydrated/certs/le2.wtf/privkey.pem') | ||
|
||
assert cert.exists | ||
assert chain.exists | ||
assert fullchain.exists | ||
assert privkey.exists |
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,14 @@ | ||
api=yes | ||
api-key=dummy | ||
include-dir=/etc/powerdns/pdns.d | ||
launch= | ||
local-address=0.0.0.0 | ||
local-port=53 | ||
local-ipv6= | ||
security-poll-suffix= | ||
setgid=pdns | ||
setuid=pdns | ||
webserver=yes | ||
webserver-address=0.0.0.0 | ||
webserver-allow-from=0.0.0.0/0 | ||
webserver-port=8081 |
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 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
# Install molecule | ||
pip3 install "molecule>=2.22rc3" docker | ||
|
||
# Let's Encrypt CA (boulder) | ||
export GOPATH=~/gopath | ||
mkdir -p $GOPATH | ||
git clone https://github.com/letsencrypt/boulder/ $GOPATH/src/github.com/letsencrypt/boulder | ||
cd $GOPATH/src/github.com/letsencrypt/boulder | ||
jq '.va.dnsResolvers = ["10.77.77.1:53"]' test/config/va.json > test/config/va.json.new | ||
mv test/config/va.json.new test/config/va.json | ||
docker-compose up -d | ||
until curl -s http://127.0.0.1:4001/directory; do sleep 0.5; done | ||
cd - | ||
|
||
# nginx for http-01 challenges | ||
mkdir -p /tmp/www/.well-known/acme-challenge | ||
docker run -d -v /tmp/www:/usr/share/nginx/html:ro -p 10.77.77.1:5002:80 nginx | ||
|
||
# powerdns for dns-01 challenges | ||
docker build -t pdns -f molecule/Dockerfile.pdns molecule/ | ||
docker run -d -p 10.77.77.1:53:53/udp -p 10.77.77.1:53:53 -p 10.77.77.1:8081:8081 pdns | ||
|
||
# create example.com dummy zone for http-01 | ||
curl -v -H 'X-API-Key: dummy' -X POST http://10.77.77.1:8081/api/v1/servers/localhost/zones \ | ||
-d '{ "name": "le2.wtf.", "kind": "Native", "nameservers": ["localhost."] }' | ||
curl -v -H 'X-API-Key: dummy' -X PATCH http://10.77.77.1:8081/api/v1/servers/localhost/zones/le2.wtf. \ | ||
-d '{"rrsets": [ | ||
{"name": "le2.wtf.", "type": "A", "ttl": 60, "changetype": "REPLACE", "records": [ | ||
{"content": "10.77.77.1", "disabled": false} | ||
]} | ||
]}' | ||
|
||
curl -v -H 'X-API-Key: dummy' -X POST http://10.77.77.1:8081/api/v1/servers/localhost/zones \ | ||
-d '{ "name": "le3.wtf.", "kind": "Native", "nameservers": ["localhost."] }' | ||
|
||
echo "Environment setup done!" |