Skip to content

[tst] unittests

[tst] unittests #77

name: CA handler Tests - Digicert CertCentral
on:
push:
branches: [ 'devel', 'master']
pull_request:
branches: [ devel ]
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 2 * * 6'
jobs:
digicert_handler_tests:
name: "digicert_handler_tests"
runs-on: ubuntu-latest
strategy:
max-parallel: 1
fail-fast: false
matrix:
websrv: ['apache2']
dbhandler: ['wsgi', 'django']
steps:
- name: "checkout GIT"
uses: actions/checkout@v4
- name: "create folders"
run: |
mkdir lego
mkdir acme-sh
mkdir certbot
- name: "Build container"
uses: ./.github/actions/container_prep
with:
DB_HANDLER: ${{ matrix.dbhandler }}
WEB_SRV: ${{ matrix.websrv }}
NAME_SPACE: acme.dynamop.de
- name: "Setup a2c with digicert_ca_handler"
run: |
sudo cp .github/openssl_ca_handler.py_acme_srv_default_handler.cfg examples/Docker/data/acme_srv.cfg
sudo chmod 777 examples/Docker/data/acme_srv.cfg
sudo cp test/ca/certsrv_ca_certs.pem examples/Docker/data/ca_certs.pem
sudo head -n -8 .github/openssl_ca_handler.py_acme_srv_default_handler.cfg > examples/Docker/data/acme_srv.cfg
sudo echo "handler_file: examples/ca_handler/digicert_ca_handler.py" >> examples/Docker/data/acme_srv.cfg
sudo echo "api_key: $DIGICERT_API_KEY" >> examples/Docker/data/acme_srv.cfg
sudo echo "organization_name: $DIGICERT_ORGNAME" >> examples/Docker/data/acme_srv.cfg
sudo echo "allowed_domainlist: [\"$DIGICERT_DOMAIN\", \"bar.local$\"]" >> examples/Docker/data/acme_srv.cfg
sudo sed -i "s/revocation_reason_check_disable: False/revocation_reason_check_disable: False\nenrollment_timeout:15/g" examples/Docker/data/acme_srv.cfg
cd examples/Docker/
docker-compose restart
env:
DIGICERT_API_KEY: ${{ secrets.DIGICERT_API_KEY }}
DIGICERT_ORGNAME: ${{ secrets.DIGICERT_ORGNAME }}
DIGICERT_DOMAIN: ${{ secrets.DIGICERT_DOMAIN }}
- name: "Test enrollment"
uses: ./.github/actions/acme_clients
with:
NAME_SPACE: acme.dynamop.de
USE_CERTBOT: false
- name: "EAB - Setup a2c with digicert_ca_handler"
run: |
mkdir -p examples/Docker/data
sudo cp .github/openssl_ca_handler.py_acme_srv_default_handler.cfg examples/Docker/data/acme_srv.cfg
sudo chmod 777 examples/Docker/data/acme_srv.cfg
sudo cp test/ca/certsrv_ca_certs.pem examples/Docker/data/ca_certs.pem
sudo head -n -8 .github/openssl_ca_handler.py_acme_srv_default_handler.cfg > examples/Docker/data/acme_srv.cfg
sudo echo "handler_file: examples/ca_handler/digicert_ca_handler.py" >> examples/Docker/data/acme_srv.cfg
sudo echo "api_key: $DIGICERT_API_KEY" >> examples/Docker/data/acme_srv.cfg
sudo echo "organization_name: $DIGICERT_ORGNAME" >> examples/Docker/data/acme_srv.cfg
sudo echo "allowed_domainlist: [\"$DIGICERT_DOMAIN\", \"bar.local$\"]" >> examples/Docker/data/acme_srv.cfg
sudo sed -i "s/revocation_reason_check_disable: False/revocation_reason_check_disable: False\nenrollment_timeout:15/g" examples/Docker/data/acme_srv.cfg
sudo echo "eab_profiling: True" >> examples/Docker/data/acme_srv.cfg
sudo sed -i "s/tnauthlist_support: False/tnauthlist_support: False\nheader_info_list: [\"HTTP_USER_AGENT\"]/g" examples/Docker/data/acme_srv.cfg
sudo echo -e "\n\n[EABhandler]" >> examples/Docker/data/acme_srv.cfg
sudo echo "eab_handler_file: /var/www/acme2certifier/examples/eab_handler/kid_profile_handler.py" >> examples/Docker/data/acme_srv.cfg
sudo echo "key_file: volume/kid_profiles.json" >> examples/Docker/data/acme_srv.cfg
sudo cp examples/eab_handler/kid_profiles.json examples/Docker/data/kid_profiles.json
sudo chmod 777 examples/eab_handler/kid_profiles.json
sudo sed -i "s/\"profile_id\"\: \[\"profile_1\", \"profile_2\", \"profile_3\"\]/\"cert_type\"\: \[\"ssl_basic\", \"ssl_securesite_pro\", \"ssl_securesite_flex\"\]/g" examples/Docker/data/kid_profiles.json
sudo sed -i "s/\"profile_id\"\: \"profile_2\"/\"cert_type\"\: \"ssl_securesite_pro\"/g" examples/Docker/data/kid_profiles.json
sudo sed -i "s/\"ca_name\": \"example_ca\",/\"unknown_key\": \"unknown_value\"/g" examples/Docker/data/kid_profiles.json
sudo sed -i "s/\"ca_name\": \"example_ca_2\",/\"unknown_key\": \"unknown_value\"/g" examples/Docker/data/kid_profiles.json
sudo sed -i "s/www.example.org/*.acme.dynamop.de/g" examples/Docker/data/kid_profiles.json
sudo sed -i '18,19d' examples/Docker/data/kid_profiles.json
sudo sed -i '8,9d' examples/Docker/data/kid_profiles.json
cd examples/Docker/
docker-compose restart
env:
DIGICERT_API_KEY: ${{ secrets.DIGICERT_API_KEY }}
DIGICERT_ORGNAME: ${{ secrets.DIGICERT_ORGNAME }}
DIGICERT_DOMAIN: ${{ secrets.DIGICERT_DOMAIN }}
- name: "EAB - Test enrollment"
uses: ./.github/actions/wf_specific/digicert_ca_handler/enroll_eab
- name: "Check container configuration"
uses: ./.github/actions/container_check
with:
DB_HANDLER: ${{ matrix.dbhandler }}
WEB_SRV: ${{ matrix.websrv }}
- name: "[ * ] collecting test logs"
if: ${{ failure() }}
run: |
mkdir -p ${{ github.workspace }}/artifact/upload
sudo cp -rp examples/Docker/data/ ${{ github.workspace }}/artifact/data/
sudo cp -rp acme-sh/ ${{ github.workspace }}/artifact/acme-sh/
sudo cp -rp certbot/ ${{ github.workspace }}/artifact/certbot/
sudo cp -rp lego/ ${{ github.workspace }}/artifact/lego/
cd examples/Docker
docker-compose logs > ${{ github.workspace }}/artifact/docker-compose.log
sudo tar -C ${{ github.workspace }}/artifact/ -cvzf ${{ github.workspace }}/artifact/upload/artifact.tar.gz docker-compose.log data acme-sh certbot lego
- name: "[ * ] uploading artificates"
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: digicert-${{ matrix.websrv }}-${{ matrix.dbhandler }}.tar.gz
path: ${{ github.workspace }}/artifact/upload/
digicert_ca_handler_tests_rpm:
name: "digicert_ca_handler_tests_rpm"
runs-on: ubuntu-latest
strategy:
max-parallel: 1
fail-fast: false
matrix:
rhversion: [8]
execscript: ['rpm_tester.sh', 'django_tester.sh']
steps:
- name: "checkout GIT"
uses: actions/checkout@v4
- name: "Prepare Alma environment"
uses: ./.github/actions/rpm_prep
with:
GH_SBOM_USER: ${{ secrets.GH_SBOM_USER }}
GH_SBOM_TOKEN: ${{ secrets.GH_SBOM_TOKEN }}
RH_VERSION: ${{ matrix.rhversion }}
NAME_SPACE: acme.dynamop.de
- name: "Setup a2c with digicert_ca_handler"
if: matrix.execscript == 'rpm_tester.sh'
run: |
sudo mkdir -p data/acme_ca/certs
sudo cp .github/openssl_ca_handler.py_acme_srv_default_handler.cfg data/acme_srv.cfg
sudo chmod 777 data/acme_srv.cfg
sudo cp test/ca/certsrv_ca_certs.pem data/ca_certs.pem
sudo head -n -8 .github/openssl_ca_handler.py_acme_srv_default_handler.cfg > data/acme_srv.cfg
sudo echo "handler_file: /opt/acme2certifier/examples/ca_handler/digicert_ca_handler.py" >> data/acme_srv.cfg
sudo echo "api_key: $DIGICERT_API_KEY" >> data/acme_srv.cfg
sudo echo "organization_name: $DIGICERT_ORGNAME" >> data/acme_srv.cfg
sudo echo "allowed_domainlist: [\"$DIGICERT_DOMAIN\", \"bar.local$\"]" >> data/acme_srv.cfg
sudo sed -i "s/revocation_reason_check_disable: False/revocation_reason_check_disable: False\nenrollment_timeout:15/g" data/acme_srv.cfg
env:
DIGICERT_API_KEY: ${{ secrets.DIGICERT_API_KEY }}
DIGICERT_ORGNAME: ${{ secrets.DIGICERT_ORGNAME }}
DIGICERT_DOMAIN: ${{ secrets.DIGICERT_DOMAIN }}
- name: "Setup a2c with digicert_ca_handler for django"
if: matrix.execscript == 'django_tester.sh'
run: |
sudo mkdir -p data/volume/acme_ca/certs
sudo cp .github/openssl_ca_handler.py_acme_srv_default_handler.cfg data/volume/acme_srv.cfg
sudo chmod 777 data/volume/acme_srv.cfg
sudo cp test/ca/certsrv_ca_certs.pem data/volume/ca_certs.pem
sudo head -n -8 .github/openssl_ca_handler.py_acme_srv_default_handler.cfg > data/volume/acme_srv.cfg
sudo echo "handler_file: /opt/acme2certifier/examples/ca_handler/digicert_ca_handler.py" >> data/volume/acme_srv.cfg
sudo echo "api_key: $DIGICERT_API_KEY" >> data/volume/acme_srv.cfg
sudo echo "organization_name: $DIGICERT_ORGNAME" >> data/volume/acme_srv.cfg
sudo echo "allowed_domainlist: [\"$DIGICERT_DOMAIN\", \"bar.local$\"]" >> data/volume/acme_srv.cfg
sudo sed -i "s/revocation_reason_check_disable: False/revocation_reason_check_disable: False\nenrollment_timeout:15/g" data/volume/acme_srv.cfg
env:
DIGICERT_API_KEY: ${{ secrets.DIGICERT_API_KEY }}
DIGICERT_ORGNAME: ${{ secrets.DIGICERT_ORGNAME }}
DIGICERT_DOMAIN: ${{ secrets.DIGICERT_DOMAIN }}
- name: "Execute install scipt"
run: |
docker exec acme-srv sh /tmp/acme2certifier/$EXEC_SCRIPT
env:
EXEC_SCRIPT: ${{ matrix.execscript }}
- name: "Test enrollment"
uses: ./.github/actions/acme_clients
with:
NAME_SPACE: acme.dynamop.de
USE_CERTBOT: false
- name: "EAB - Setup a2c with digicert_ca_handler"
if: matrix.execscript == 'rpm_tester.sh'
run: |
sudo mkdir -p data/acme_ca/certs
sudo cp .github/openssl_ca_handler.py_acme_srv_default_handler.cfg data/acme_srv.cfg
sudo cp test/ca/certsrv_ca_certs.pem data/ca_certs.pem
sudo head -n -8 .github/openssl_ca_handler.py_acme_srv_default_handler.cfg > data/acme_srv.cfg
sudo echo "handler_file: examples/ca_handler/digicert_ca_handler.py" >> data/acme_srv.cfg
sudo echo "api_key: $DIGICERT_API_KEY" >> data/acme_srv.cfg
sudo echo "organization_name: $DIGICERT_ORGNAME" >> data/acme_srv.cfg
sudo echo "allowed_domainlist: [\"$DIGICERT_DOMAIN\", \"bar.local$\"]" >> data/acme_srv.cfg
sudo sed -i "s/revocation_reason_check_disable: False/revocation_reason_check_disable: False\nenrollment_timeout:15/g" data/acme_srv.cfg
sudo echo "eab_profiling: True" >> data/acme_srv.cfg
sudo sed -i "s/tnauthlist_support: False/tnauthlist_support: False\nheader_info_list: [\"HTTP_USER_AGENT\"]/g" data/acme_srv.cfg
sudo echo -e "\n\n[EABhandler]" >> data/acme_srv.cfg
sudo echo "eab_handler_file: /opt/acme2certifier/examples/eab_handler/kid_profile_handler.py" >> data/acme_srv.cfg
sudo echo "key_file: /opt/acme2certifier/volume/acme_ca/kid_profiles.json" >> data/acme_srv.cfg
sudo cp examples/eab_handler/kid_profiles.json data/acme_ca/kid_profiles.json
sudo chmod 777 data/acme_ca/kid_profiles.json
sudo sed -i "s/\"profile_id\"\: \[\"profile_1\", \"profile_2\", \"profile_3\"\]/\"cert_type\"\: \[\"ssl_basic\", \"ssl_securesite_pro\", \"ssl_securesite_flex\"\]/g" data/acme_ca/kid_profiles.json
sudo sed -i "s/\"profile_id\"\: \"profile_2\"/\"cert_type\"\: \"ssl_securesite_pro\"/g" data/acme_ca/kid_profiles.json
sudo sed -i "s/\"ca_name\": \"example_ca\",/\"unknown_key\": \"unknown_value\"/g" data/acme_ca/kid_profiles.json
sudo sed -i "s/\"ca_name\": \"example_ca_2\",/\"unknown_key\": \"unknown_value\"/g" data/acme_ca/kid_profiles.json
sudo sed -i "s/www.example.org/*.acme.dynamop.de/g" data/acme_ca/kid_profiles.json
sudo sed -i '18,19d' data/acme_ca/kid_profiles.json
sudo sed -i '8,9d' data/acme_ca/kid_profiles.json
env:
DIGICERT_API_KEY: ${{ secrets.DIGICERT_API_KEY }}
DIGICERT_ORGNAME: ${{ secrets.DIGICERT_ORGNAME }}
DIGICERT_DOMAIN: ${{ secrets.DIGICERT_DOMAIN }}
- name: "EAB - Setup a2c with digicert_ca_handler"
if: matrix.execscript == 'django_tester.sh'
run: |
sudo mkdir -p data/volume/acme_ca/certs
sudo cp .github/openssl_ca_handler.py_acme_srv_default_handler.cfg data/volume/acme_srv.cfg
sudo chmod 777 data/volume/acme_srv.cfg
sudo cp test/ca/certsrv_ca_certs.pem data/ca_certs.pem
sudo head -n -8 .github/openssl_ca_handler.py_acme_srv_default_handler.cfg > data/volume/acme_srv.cfg
sudo echo "handler_file: examples/ca_handler/digicert_ca_handler.py" >> data/volume/acme_srv.cfg
sudo echo "api_key: $DIGICERT_API_KEY" >> data/volume/acme_srv.cfg
sudo echo "organization_name: $DIGICERT_ORGNAME" >> data/volume/acme_srv.cfg
sudo echo "allowed_domainlist: [\"$DIGICERT_DOMAIN\", \"bar.local$\"]" >> data/volume/acme_srv.cfg
sudo sed -i "s/revocation_reason_check_disable: False/revocation_reason_check_disable: False\nenrollment_timeout:15/g" data/volume/acme_srv.cfg
sudo echo "eab_profiling: True" >> data/volume/acme_srv.cfg
sudo sed -i "s/tnauthlist_support: False/tnauthlist_support: False\nheader_info_list: [\"HTTP_USER_AGENT\"]/g" data/volume/acme_srv.cfg
sudo echo -e "\n\n[EABhandler]" >> data/volume/acme_srv.cfg
sudo echo "eab_handler_file: /opt/acme2certifier/examples/eab_handler/kid_profile_handler.py" >> data/volume/acme_srv.cfg
sudo echo "key_file: /opt/acme2certifier/volume/acme_ca/kid_profiles.json" >> data/volume/acme_srv.cfg
sudo cp examples/eab_handler/kid_profiles.json data/volume/acme_ca/kid_profiles.json
sudo chmod 777 data/volume/acme_ca/kid_profiles.json
sudo sed -i "s/\"profile_id\"\: \[\"profile_1\", \"profile_2\", \"profile_3\"\]/\"cert_type\"\: \[\"ssl_basic\", \"ssl_securesite_pro\", \"ssl_securesite_flex\"\]/g" data/volume/acme_ca/kid_profiles.json
sudo sed -i "s/\"profile_id\"\: \"profile_2\"/\"cert_type\"\: \"ssl_securesite_pro\"/g" data/volume/acme_ca/kid_profiles.json
sudo sed -i "s/\"ca_name\": \"example_ca\",/\"unknown_key\": \"unknown_value\"/g" data/volume/acme_ca/kid_profiles.json
sudo sed -i "s/\"ca_name\": \"example_ca_2\",/\"unknown_key\": \"unknown_value\"/g" data/volume/acme_ca/kid_profiles.json
sudo sed -i "s/www.example.org/*.acme.dynamop.de/g" data/volume/acme_ca/kid_profiles.json
sudo sed -i '18,19d' data/volume/acme_ca/kid_profiles.json
sudo sed -i '8,9d' data/volume/acme_ca/kid_profiles.json
env:
DIGICERT_API_KEY: ${{ secrets.DIGICERT_API_KEY }}
DIGICERT_ORGNAME: ${{ secrets.DIGICERT_ORGNAME }}
DIGICERT_DOMAIN: ${{ secrets.DIGICERT_DOMAIN }}
- name: "Reconfigure a2c"
run: |
docker exec acme-srv sh /tmp/acme2certifier/$EXEC_SCRIPT restart
env:
EXEC_SCRIPT: ${{ matrix.execscript }}
- name: "EAB - Test enrollment"
uses: ./.github/actions/wf_specific/digicert_ca_handler/enroll_eab
- name: "[ * ] collecting test logs"
if: ${{ failure() }}
run: |
mkdir -p ${{ github.workspace }}/artifact/upload
docker exec acme-srv tar cvfz /tmp/acme2certifier/a2c.tgz /opt/acme2certifier
sudo cp -rp data/ ${{ github.workspace }}/artifact/data/
sudo rm ${{ github.workspace }}/artifact/data/*.rpm
sudo cp -rp acme-sh/ ${{ github.workspace }}/artifact/acme-sh/
sudo cp -rp certbot/ ${{ github.workspace }}/artifact/certbot/
sudo cp -rp lego/ ${{ github.workspace }}/artifact/lego/
docker exec acme-srv cat /etc/nginx/nginx.conf.orig > ${{ github.workspace }}/artifact/data/nginx.conf.orig
docker exec acme-srv cat /etc/nginx/nginx.conf > ${{ github.workspace }}/artifact/data/nginx.conf
docker exec acme-srv cat /var/log/messages > ${{ github.workspace }}/artifact/acme-srv.log
sudo tar -C ${{ github.workspace }}/artifact/ -cvzf ${{ github.workspace }}/artifact/upload/artifact.tar.gz data acme-srv.log acme-sh certbot lego
- name: "[ * ] uploading artificates"
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: digicert_ca_handler_tests_rpm-rh${{ matrix.rhversion }}-${{ matrix.execscript }}.tar.gz
path: ${{ github.workspace }}/artifact/upload/