Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4638 implement es256 #4705

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b85ce87
Update CMAKE to be compatible with versions about 3.5
bak-minsu Mar 17, 2024
b51af27
Implement base ACME Algorithm class
bak-minsu Mar 17, 2024
679063e
Remove isSupported as it was not needed
bak-minsu Mar 17, 2024
08510ef
Implement ACMEAlgorithm in ACMEEngine
bak-minsu Mar 17, 2024
cecb00e
Add Author
bak-minsu Mar 17, 2024
9d8ea30
Move RFC comment
bak-minsu Mar 17, 2024
5be877e
Move web app error back to ACMEengine
bak-minsu Mar 17, 2024
c5c23fb
Remove unused imports
bak-minsu Mar 17, 2024
3ba8594
Merge branch 'master' into 4638-implement-ES256
bak-minsu Mar 17, 2024
339a7ea
Simplify ACME Algorithm string conversion
bak-minsu Mar 22, 2024
f90f2b1
Add new line
bak-minsu Mar 22, 2024
8126c16
Specify an exact argument fromString should throw
bak-minsu Mar 22, 2024
79ce58d
Remove unsupported algorithms
bak-minsu Mar 24, 2024
79eb75e
Add test for ES256
bak-minsu Mar 24, 2024
8f1fb62
Check against the correct serial number
bak-minsu Mar 24, 2024
dc6ba9e
Correct parameters for openssl csr generation
bak-minsu Mar 26, 2024
f113955
Add line separator
bak-minsu Mar 26, 2024
87d5d0e
Add install instructions for openssl
bak-minsu Mar 27, 2024
ba81084
Move instructions to near where they're used
bak-minsu Mar 27, 2024
1108684
Mirror tests for RS256
bak-minsu Mar 27, 2024
6a31b85
Remove openssl install step, as it is already inside client's container
bak-minsu Mar 28, 2024
a0f8e74
Add verbosity to open ssl command
bak-minsu Mar 28, 2024
d74ce1d
Replace -nodes for -noenc
bak-minsu Mar 28, 2024
6d74573
Insert pipe character at the start of command
bak-minsu Mar 28, 2024
7170ccd
Update count checks
bak-minsu Mar 28, 2024
69a3a4b
Move algorithm tests to its own file
bak-minsu Mar 28, 2024
2b83e79
Return certbot test to its original form
bak-minsu Mar 28, 2024
6f70a80
Ensure post test counts are valid
bak-minsu Mar 28, 2024
ad8910e
Add TODO for HMAC algorithms
bak-minsu Mar 28, 2024
c36af7d
Remove duplicate tests
bak-minsu Mar 28, 2024
b6c38ea
Merge branch 'dogtagpki:master' into 4638-implement-ES256
bak-minsu Mar 28, 2024
2c3f163
Add verbose flag
bak-minsu Mar 29, 2024
8a39298
Configure cerbot to use correct signature algorithm
bak-minsu Mar 29, 2024
c686329
Set domain for certbot
bak-minsu Mar 29, 2024
a5d7ce9
Add line separator
bak-minsu Mar 29, 2024
248266e
Add RS256
bak-minsu Mar 29, 2024
01931d7
Add a revocation step
bak-minsu Mar 29, 2024
63e3184
Create duplicate cert
bak-minsu Mar 29, 2024
57552c4
Use standard RFC naming
bak-minsu Mar 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
308 changes: 308 additions & 0 deletions .github/workflows/acme-algorithm-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,308 @@
name: ACME with certbot

on: workflow_call

env:
DB_IMAGE: ${{ vars.DB_IMAGE || 'quay.io/389ds/dirsrv' }}

jobs:
# docs/installation/acme/Installing_PKI_ACME_Responder.md
# docs/user/acme/Using_PKI_ACME_Responder_with_Certbot.md
test:
name: Test
runs-on: ubuntu-latest
env:
SHARED: /tmp/workdir/pki
steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Retrieve ACME images
uses: actions/cache@v4
with:
key: acme-images-${{ github.sha }}
path: acme-images.tar

- name: Load ACME images
run: docker load --input acme-images.tar

- name: Create network
run: docker network create example

- name: Set up DS container
run: |
tests/bin/ds-container-create.sh ds
env:
IMAGE: ${{ env.DB_IMAGE }}
HOSTNAME: ds.example.com
PASSWORD: Secret.123

- name: Connect DS container to network
run: docker network connect example ds --alias ds.example.com

- name: Set up PKI container
run: |
tests/bin/runner-init.sh pki
env:
HOSTNAME: pki.example.com

- name: Connect PKI container to network
run: docker network connect example pki --alias pki.example.com

- name: Install CA in PKI container
run: |
docker exec pki pkispawn \
-f /usr/share/pki/server/examples/installation/ca.cfg \
-s CA \
-D pki_ds_url=ldap://ds.example.com:3389 \
-v

- name: Install CA admin cert
run: |
docker exec pki pki-server cert-export ca_signing --cert-file ca_signing.crt
docker exec pki pki client-cert-import ca_signing --ca-cert ca_signing.crt
docker exec pki pki pkcs12-import \
--pkcs12 /root/.dogtag/pki-tomcat/ca_admin_cert.p12 \
--pkcs12-password Secret.123
docker exec pki pki -n caadmin ca-user-show caadmin

- name: Set up ACME database in DS container
run: |
docker exec ds ldapmodify \
-H ldap://ds.example.com:3389 \
-D "cn=Directory Manager" \
-w Secret.123 \
-f $SHARED/base/acme/database/ds/schema.ldif
docker exec ds ldapadd \
-H ldap://ds.example.com:3389 \
-D "cn=Directory Manager" \
-w Secret.123 \
-f $SHARED/base/acme/database/ds/create.ldif
docker exec ds ldapadd \
-H ldap://ds.example.com:3389 \
-D "cn=Directory Manager" \
-w Secret.123 \
-f $SHARED/base/acme/realm/ds/create.ldif

- name: Install ACME in PKI container
run: |
docker exec pki pki-server acme-create
docker exec pki pki-server acme-database-mod \
--type ds \
-D url=ldap://ds.example.com:3389
docker exec pki pki-server acme-issuer-mod --type pki
docker exec pki pki-server acme-realm-mod \
--type ds \
-D url=ldap://ds.example.com:3389
docker exec pki pki-server acme-deploy --wait

- name: Run PKI healthcheck in PKI container
run: docker exec pki pki-healthcheck --failures-only

- name: Verify ACME in PKI container
run: docker exec pki pki acme-info

- name: Set up client container
run: |
tests/bin/runner-init.sh client
env:
HOSTNAME: client.example.com

- name: Connect client container to network
run: docker network connect example client --alias client.example.com

- name: Install certbot in client container
run: docker exec client dnf install -y certbot

- name: Register ACME account
run: |
docker exec client certbot register \
--server http://pki.example.com:8080/acme/directory \
--email [email protected] \
--agree-tos \
--non-interactive

- name: Enroll using RS256 CSR
run: |
docker exec client certbot certonly \
--server http://pki.example.com:8080/acme/directory \
--key-type rsa \
--rsa-key-size 2048 \
--domain client.example.com \
--standalone \
--non-interactive \
--verbose

- name: Check RS256 client locally
run: |
docker exec client pki client-cert-import \
--cert /etc/letsencrypt/live/client.example.com/fullchain.pem \
rs256

# store serial number
docker exec client pki nss-cert-show rs256 | tee output
sed -n 's/^ *Serial Number: *\(.*\)/\1/p' output > rs256.txt

# subject should be CN=client.example.com
echo "CN=client.example.com" > expected
sed -n 's/^ *Subject DN: *\(.*\)/\1/p' output > actual
diff expected actual

- name: Check ACME orders after RS256 enrollment
run: |
docker exec ds ldapsearch \
-H ldap://ds.example.com:3389 \
-D "cn=Directory Manager" \
-w Secret.123 \
-b ou=orders,dc=acme,dc=pki,dc=example,dc=com \
-s one \
-o ldif_wrap=no \
-LLL | tee output

# there should be one order
echo "1" > expected
grep "^dn:" output | wc -l > actual
diff expected actual

- name: Check ACME authorizations after RS256 enrollment
run: |
docker exec ds ldapsearch \
-H ldap://ds.example.com:3389 \
-D "cn=Directory Manager" \
-w Secret.123 \
-b ou=authorizations,dc=acme,dc=pki,dc=example,dc=com \
-s one \
-o ldif_wrap=no \
-LLL | tee output

# there should be one authorization
echo "1" > expected
grep "^dn:" output | wc -l > actual
diff expected actual

- name: Check ACME challenges after RS256 enrollment
run: |
docker exec ds ldapsearch \
-H ldap://ds.example.com:3389 \
-D "cn=Directory Manager" \
-w Secret.123 \
-b ou=challenges,dc=acme,dc=pki,dc=example,dc=com \
-s one \
-o ldif_wrap=no \
-LLL | tee output

# there should be one challenge
echo "1" > expected
grep "^dn:" output | wc -l > actual
diff expected actual

- name: Check CA certs after RS256 enrollments
run: |
docker exec pki pki ca-cert-find | tee output

# there should be 7 certs
echo "7" > expected
grep "Serial Number:" output | wc -l > actual
diff expected actual

# check client cert
SERIAL=$(cat rs256.txt)
docker exec pki pki ca-cert-show $SERIAL | tee output

# subject should be CN=client.example.com
echo "CN=client.example.com" > expected
sed -n 's/^ *Subject DN: *\(.*\)/\1/p' output > actual
diff expected actual

- name: Enroll using ES256 CSR
run: |
docker exec client certbot certonly \
--server http://pki.example.com:8080/acme/directory \
--domain client.example.com \
--key-type ecdsa \
--elliptic-curve secp256r1 \
--standalone \
--non-interactive \
--duplicate \
--verbose

- name: Check ES256 client locally
run: |
docker exec client pki client-cert-import \
--cert /etc/letsencrypt/live/client.example.com/fullchain.pem \
es256

# store serial number
docker exec client pki nss-cert-show es256 | tee output
sed -n 's/^ *Serial Number: *\(.*\)/\1/p' output > es256.txt

# subject should be CN=client.example.com
echo "CN=client.example.com" > expected
sed -n 's/^ *Subject DN: *\(.*\)/\1/p' output > actual
diff expected actual

- name: Check ACME orders after ES256 enrollment
run: |
docker exec ds ldapsearch \
-H ldap://ds.example.com:3389 \
-D "cn=Directory Manager" \
-w Secret.123 \
-b ou=orders,dc=acme,dc=pki,dc=example,dc=com \
-s one \
-o ldif_wrap=no \
-LLL | tee output

# there should be two orders
echo "2" > expected
grep "^dn:" output | wc -l > actual
diff expected actual

- name: Check ACME authorizations after ES256 enrollment
run: |
docker exec ds ldapsearch \
-H ldap://ds.example.com:3389 \
-D "cn=Directory Manager" \
-w Secret.123 \
-b ou=authorizations,dc=acme,dc=pki,dc=example,dc=com \
-s one \
-o ldif_wrap=no \
-LLL | tee output

# there should be two authorizations
echo "2" > expected
grep "^dn:" output | wc -l > actual
diff expected actual

- name: Check ACME challenges after ES256 enrollment
run: |
docker exec ds ldapsearch \
-H ldap://ds.example.com:3389 \
-D "cn=Directory Manager" \
-w Secret.123 \
-b ou=challenges,dc=acme,dc=pki,dc=example,dc=com \
-s one \
-o ldif_wrap=no \
-LLL | tee output

# there should be two challenges
echo "2" > expected
grep "^dn:" output | wc -l > actual
diff expected actual

- name: Check CA certs after enrollments
run: |
docker exec pki pki ca-cert-find | tee output

# there should be 8 certs
echo "8" > expected
grep "Serial Number:" output | wc -l > actual
diff expected actual

# check client cert
SERIAL=$(cat es256.txt)
docker exec pki pki ca-cert-show $SERIAL | tee output

# subject should be CN=client.example.com
echo "CN=client.example.com" > expected
sed -n 's/^ *Subject DN: *\(.*\)/\1/p' output > actual
diff expected actual
5 changes: 5 additions & 0 deletions .github/workflows/acme-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ jobs:
needs: build
uses: ./.github/workflows/acme-postgresql-test.yml

acme-algorithm-test:
name: ACME CSRs with different signatures
needs: build
uses: ./.github/workflows/acme-algorithm-test.yml

publish:
if: github.event_name == 'push' && github.ref_name == 'master'
name: Publishing ACME images
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Required cmake version
cmake_minimum_required(VERSION 3.0.0)
cmake_minimum_required(VERSION 3.5)

project(pki)

Expand Down Expand Up @@ -35,9 +35,9 @@ if (NOT DEFINED THEME)
set(THEME "dogtag")
endif(NOT DEFINED THEME)

string(REGEX REPLACE "^([0-9]+).*" "\\1" APPLICATION_VERSION_MAJOR ${VERSION})
string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" APPLICATION_VERSION_MINOR ${VERSION})
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" APPLICATION_VERSION_PATCH ${VERSION})
string(REGEX REPLACE "^([0-9]+).*" "\\1" "APPLICATION_VERSION_MAJOR" "${VERSION}")
string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" "APPLICATION_VERSION_MINOR" "${VERSION}")
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" "APPLICATION_VERSION_PATCH" "${VERSION}")

set(APP_SERVER "tomcat-9.0" CACHE STRING "Application server")

Expand Down
Loading
Loading