diff --git a/.travis.yml b/.travis.yml index b3cde5ea..191ebfdd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,4 +45,7 @@ install: script: - ansible-playbook deploy.yml --syntax-check - - ansible-playbook deploy.yml -t local,vpn,dns,ssh_tunneling,security -e "server_ip=$LXC_IP server_user=root IP_subject_alt_name=$LXC_IP local_dns=Y" --skip-tags apparmor + - ansible-playbook deploy.yml -t local,vpn,dns,ssh_tunneling,security,tests -e "server_ip=$LXC_IP server_user=root IP_subject_alt_name=$LXC_IP local_dns=Y" --skip-tags apparmor + +after_script: + - ./tests/update-users.sh diff --git a/deploy.yml b/deploy.yml index 649481e3..75d2063e 100644 --- a/deploy.yml +++ b/deploy.yml @@ -63,3 +63,9 @@ - debug: msg="{{ additional_information.split('\n') }}" tags: cloud + + - name: Save the CA key + local_action: > + shell echo "{{ easyrsa_CA_password }}" > /tmp/ca_password + become: no + tags: tests diff --git a/tests/update-users.sh b/tests/update-users.sh new file mode 100755 index 00000000..8a62d661 --- /dev/null +++ b/tests/update-users.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -e + +CAPW=`cat /tmp/ca_password` + +sed -i 's/- jack$/- jack_test/' config.cfg + +ansible-playbook users.yml -e "server_ip=$LXC_IP server_user=root ssh_tunneling_enabled=y IP_subject=$LXC_IP easyrsa_CA_password=sBo9uybTcflp" + +cd configs/$LXC_IP/pki/ + +if openssl crl -inform pem -noout -text -in crl/jack.crt | grep CRL + then + echo "The CRL check passed" + else + echo "The CRL check failed" + exit 1 +fi + +if openssl x509 -inform pem -noout -text -in certs/jack_test.crt | grep CN=jack_test + then + echo "The new user exist" + else + echo "The new user does not exist" + exit 1 +fi