Skip to content

Latest commit

 

History

History
356 lines (259 loc) · 27.9 KB

README.md

File metadata and controls

356 lines (259 loc) · 27.9 KB

EU Digital COVID Certificate Gateway

AboutDevelopmentDocumentationSupportContributeContributorsLicensing

About

This repository contains the source code of the EU Digital COVID Certificate Gateway (DGCG).

DGCG is used to share validation and verification information across all national backend servers. By using DGCG, backend-to-backend integration is facilitated, and countries can onboard incrementally, while the national backends retain flexibility and can control data processing of their users.

Development

Prerequisites

  • OpenJDK 11 (with installed keytool CLI)
  • Maven
  • Authenticate to Github Packages

Authenticating to GitHub Packages

As some of the required libraries (and/or versions are pinned/available only from GitHub Packages) You need to authenticate to GitHub Packages The following steps need to be followed

  • Create PAT with scopes:
    • read:packages for downloading packages
GitHub Maven
  • Copy/Augment ~/.m2/settings.xml with the contents of settings.xml present in this repository
    • Replace ${app.packages.username} with your github username
    • Replace ${app.packages.password} with the generated PAT
GitHub Docker Registry
  • Run docker login docker.pkg.github.com/eu-digital-green-certificates before running further docker commands.
    • Use your GitHub username as username
    • Use the generated PAT as password

Additional Tools for starting Gateway locally

Build

Whether you cloned or downloaded the 'zipped' sources you will either find the sources in the chosen checkout-directory or get a zip file with the source code, which you can expand to a folder of your choice.

In either case open a terminal pointing to the directory you put the sources in. The local build process is described afterwards depending on the way you choose.

Maven based build for Tomcat WAR-File

mvn clean install

Maven based build for Docker Image

mvn clean install -P docker
docker-compose build

Start Local

In order to start the gateway on your local computer you have to follow these steps:

  • Create TrustAnchor
  • Create Database
  • Start Gateway
  • Insert Trusted Parties

Create TrustAnchor

The TrustAnchor is used to sign TrustedParty entries in the DB. To validate these signatures the gateway needs to public key of the TrustAnchor.

To create a TrustAnchor you can execute the following OpenSSL command:

openssl req -x509 -newkey rsa:4096 -keyout key_ta.pem -out cert_ta.pem -days 365 -nodes

afterwards the PublicKey has to be exported in a Java KeyStore.

keytool -importcert -alias dgcg_trust_anchor -file cert_ta.pem -keystore ta.jks -storepass dgcg-p4ssw0rd

Put the created ta.jks file in the "certs" directory of dgc-gateway. If you are using the Docker image then this folder must be in the root directory of your local workspace (on the same level as this readme file). Create directory it does not already exist.

Create Database

DGC Gateway needs a database to persist data. For local deployment a MySQL is recommended. A MySQL DB will be started when docker-compose file is started, so no additional tasks are required.

Start Gateway

To start the Gateway just start the docker-compose file. Please assure that the project was build for Docker build before.

docker-compose up --build

Common issues

ERROR: for dgc-gateway_dgc-gateway_1 Cannot create container for service dgc-gateway

This error occurs in Docker-for-Windows if Docker does not have access to the gateway folder. In Docker-for-Windows, go to Settings > Resources > File Sharing and add the root directory of the repository, then restart Docker-for-Windows.

Insert Trusted Parties

The data structure in the database should be now be created by DGC Gateway. In order to access the DGC Gateway it is required to onboard some certificates. You will need AUTHENTICATION, UPLOAD and CSCA certificates.

The certificates can be created with OpenSSL:

openssl req -x509 -newkey rsa:4096 -keyout key_auth.pem -out cert_auth.pem -days 365 -nodes
openssl req -x509 -newkey rsa:4096 -keyout key_csca.pem -out cert_csca.pem -days 365 -nodes 
openssl req -x509 -newkey rsa:4096 -keyout key_upload.pem -out cert_upload.pem -days 365 -nodes

To sign them with TrustAnchor you can use DGC-CLI:

dgc ta sign -c cert_ta.pem -k key_ta.pem -i cert_auth.pem
dgc ta sign -c cert_ta.pem -k key_ta.pem -i cert_csca.pem
dgc ta sign -c cert_ta.pem -k key_ta.pem -i cert_upload.pem

Afterwards you can create a new entry in the trusted_parties table and fill all of the fields with the data produced by the above commands.

Inserting Trusted Parties into the Database

Log on to the mysql container (using the docker commands or opening a shell with the docker UI) and open mysql cli like this:

mysql --user=root --password=admin dgc

To show the available tables:

 select * from INFORMATION_SCHEMA.tables where table_schema='dgc';

We're interested in the table trusted_party; you can see the structure of it by using this command:

describe trusted_party;

To insert your certificates you can do this (replacing this with your own information from the dgc command):

INSERT INTO trusted_party (created_at, country, thumbprint, raw_data, signature, certificate_type)
SELECT
	NOW() as created_at,
	'NL' as country,
	'{Certificate_Thumbprint}' as thumbprint,
	'{Certificate_Raw_Data}' as raw_data,
	'{TrustAnchor_Signature}' as signature,
	'{AUTHENTICATION|UPLOAD|CSCA}' as certificate_type;

Here is a set of example queries including all of the data:

-- Authentication certificate
insert into trusted_party (created_at, country, thumbprint, raw_data, signature, certificate_type)
select
	now() as created_at,
	'NL' as country,
	'397da9eb17467a2b3b83704ab6490a540bef43e84f06a6bd885e6621572da401' as thumbprint,
	'MIIFrzCCA5egAwIBAgIUPg0bGwARBnhfTWmOTpOOdYMKESMwDQYJKoZIhvcNAQELBQAwZzELMAkGA1UEBhMCTkwxDDAKBgNVBAgMA1RMUzEMMAoGA1UEBwwDVExTMQwwCgYDVQQKDANUTFMxDDAKBgNVBAsMA1RMUzEMMAoGA1UEAwwDVExTMRIwEAYJKoZIhvcNAQkBFgNUTFMwHhcNMjEwNTA1MTAxOTMwWhcNMjIwNTA1MTAxOTMwWjBnMQswCQYDVQQGEwJOTDEMMAoGA1UECAwDVExTMQwwCgYDVQQHDANUTFMxDDAKBgNVBAoMA1RMUzEMMAoGA1UECwwDVExTMQwwCgYDVQQDDANUTFMxEjAQBgkqhkiG9w0BCQEWA1RMUzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALiYJTlNwVftS7k794t/Zog54HQGTPrjreDa4c4eQT3fzjjFF7QnyLn1yERggBX3v0pVP8skTxTMbYc9uLFNYNcpMT6H6eNQDKLmyGIoh8Lq4HQ6vLUGse1IjOreJNtCyFB5z4hFeY/QmJykBza9HE+Pfw9O/otOqO2Jpupk1r+dxlL0+kugRFB+vepmeNMocbFT6mPzQdzToNdMMvuNKNxP/2NeDTzpxVdDQTHvqCK6bQuVcBj6NkLMTkdx2h0iPy7Xwoq8t5Wui/AF4c8lkdIu9/OlLMSCGTX6LaB9zxXEQVCZKml6TZ9snNe9T6OTEuFAGjKr+rpgSL3zNxfo0FurO/Rs+H1w7424yKGPL4WOBtXR9EHZz1/l8YR9tXCGlqarsFjzmZIsUvOFdRFCVAxzYsWRUdWn5wZ9YpG5wbUjzImnLm0nCBdyrnEHBhW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cNMjEwNTA1MTEyMDQ4WjAtBgkqhkiG9w0BCTQxIDAeMA0GCWCGSAFlAwQCAQUAoQ0GCSqGSIb3DQEBCwUAMC8GCSqGSIb3DQEJBDEiBCA5fanrF0Z6KzuDcEq2SQpUC+9D6E8Gpr2IXmYhVy2kATANBgkqhkiG9w0BAQsFAASCAgAen192W2aNcD/QSTAa0zlFPYN/vdKnzmt3c9ZdecHQLFHzw0qU/5DNlynW4kuDwFzC3uCVCRv0IkT/3uldvsNh+vpqRX2dy2DQVfC4D5wohnyoz72cqlbkKR2PQ1YESM5A2+0VUKYQ8e/hGkn+qo7cs+3BoXnxy7+2aTlKBY37vzqzpGNQ3pXTcMNDIaXI81pk2pXg4MioXuom0b6X80EIGsO/f+UA7pkQDSGlfiAbuhryYpjCHcQr7RFwDaSlM5isgspfIN03LkCbzoSDCWE/ehZB7eYfohWvfOXM4qhVo04WnQa9aPZIAiDF6xOZdfZuB3UBeCfyNkc1jfrIed+gaGc8nOQFAngIOiLuSBKKYSlgPDcQq3n9H7LUutMYvAaRAUii5TrDbbHUPFzZRo4Q7QsjdCsYLB/R2RV6toldVrdCOj2acYHia3Z+/ajs+A5JoHBH9J8VH6Iph6gw6eZSbydkmQyESGATY4Wf8RAoQ8E8iWhm3Qg1p8EGzX3fT3BHHaJTr5zlJ2yZFu5+xvPUfTCvXFDoe+eJ0O3EGg5v4uSv/r4g8e9jMKnWD/3Azvcm/dEIXl5X9VGLE3om4Pxk4jkZidYFK2rHKPCvTcOUTpSXUuB5aybSTfPr1e985tQKQCRvsXa8nAY6ExqAhpwBH19IHKg79M+lR6kTF2gnlQAAAAAAAA==' as signature,
	'AUTHENTICATION' as certificate_type;

-- Upload certificate
insert into trusted_party (created_at, country, thumbprint, raw_data, signature, certificate_type)
select
	now() as created_at,
	'NL' as country,
	'7a58cc85a1bcfecb1bc69822cc2a72dfb4fbc9fe23d588fa9b0660b929d368f9' as thumbprint,
	'MIIF0zCCA7ugAwIBAgIUZiCTld5e+Bhk5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9w0BAQsFAASCAgAD3PIekxk9r3Mnp6C1JV0p5mrRsZTjGyJksN82KketMSQYi3CFelpsUnBbkvI9IRl2NMyh3gvh0S5+CuehwXa/OSXQ2Trq/NSEzK3XZ1sVsOwmPvn1uUVnEw7heS8mK7/vsO2AwQlRuOjOgNSoGByPCceVrChSphy1kP7ZGbpDocTBRHxiVA9wuPQLu+0ffpXC7VX7YqtjdhrqL1+X0dcmqnGK5sX2++7vDF467lqStUkRBqDtqi+KoGC45n9z25ouKAnKAmV1nMuVf9cvwm3U8pIaHI8IMCXAAoGBTSfd0SWutS1aVegp7REigco91YUNjwq3YYLuwdrNvyZ6cR1Mkauy0+DvzghlSLTxWePJWAuVgWwELVqh4SFdi45vH9MckbG2dOd8JipCKotBogYjxsFdTRGHTfzS+OO9RCm8ZnEDrhD6K5ZlBqvQWD5aTGDJ2Uyys5UwPLRXYxO6RTgJ++hK64dAu+QnKxOckCH4yBjamnT4bFYf48GuWBZmNPWMgpFFJm5Bum56auUMdANoV6yO5NYiUenyo92DJzW5w21qYVV++YiXxJHnVkGfPcCqlPFGPd/b1wZuYjBg4ActRdEfJ7wunmEqyqLvNQX8fBVNiqs1itFreZihe0thGFm4ILIyapuABGrjsnT/FAbHVSbkdunb0UKc2YYFPkym8AAAAAAAAA==' as signature,
	'UPLOAD' as certificate_type;

-- CSCA certificate
insert into trusted_party (created_at, country, thumbprint, raw_data, signature, certificate_type)
select
	now() as created_at,
	'NL' as country,
	'a5d441bfa7fdbc2b64b73fb1d78e801bc131d670f6e97218a1625098b3ced707' as thumbprint,
	'MIIFuzCCA6OgAwIBAgIURm8BBiv9BHHG479oKAOOg0kGOvgwDQYJKoZIhvcNAQELBQAwbTELMAkGA1UEBhMCTkwxDTALBgNVBAgMBENTQ0ExDTALBgNVBAcMBENTQ0ExDTALBgNVBAoMBENTQ0ExDTALBgNVBAsMBENTQ0ExDTALBgNVBAMMBENTQ0ExEzARBgkqhkiG9w0BCQEWBENTQ0EwHhcNMjEwNTA1M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5pn//MZ7Fxev3d5VhCYi6BipC/+2km61rWnCCht9psAOfKsoP5x78mqMzpBzA2MDTh11A2VPQK4GKHcTHUS2VZqcwHOWB9bdxIBHOtY+HN4UjbT6IVHt/sX/GkpcJFHQjouePzpm/FekQlfZKkiiUnmaxMZegovBeOO1qSJsQft20yNjkCRKQLcBg5G9cHyqwgYUAKvufmDMeb4a9dsamMNO39iEChSjgZZ7W0XbxtU89ddhc5WfOH3nKgckuNXLcFDsR/4KxWNR8hRFfAsM5T7M3mbdz19YLBap8t86tSi8DqAxvkqZgFOw/Q3cXKOiAgpcecpxsVynUNkI8GL2/H/BzLGqQGkwlBCOhTsomqKW3HHF/EL92mc/r8Irz293OXvRbA8jNwJHEU6mH1bg1uynlaPT61rB1MEt3i++sk7TjVt889u1AFRJp0f63jEMLIJ51ZUeQngAAAAAAAA==' as signature,
	'CSCA' as certificate_type;

Testing that everything works

You can test that everything works quickly by using this curl:

curl -X GET http://localhost:8080/trustList -H "accept: application/json" -H "X-SSL-Client-SHA256: 397da9eb17467a2b3b83704ab6490a540bef43e84f06a6bd885e6621572da401" -H "X-SSL-Client-DN: C=NL"
  • Replace the example SHA with that of your own test certificate in the X-SSL-Client-SHA256 header
  • Replace the example country with your own country in the X-SSL-Client-DN header (i.e. US, CN, ZA)

That command will return something looking like this (but with large base64 strings)

[
  {
    "kid":"OX2p6xdGeis=",
    "timestamp":"2021-05-05T12:54:49Z",
    "country":"NL",
    "certificateType":"AUTHENTICATION",
    "thumbprint":"397da9eb17467a2b3b83704ab6490a540bef43e84f06a6bd885e6621572da401",
    "signature":"<snip>",
    "rawData":"<snip>"
  },
  {
    "kid":"eljMhaG8/ss=",
    "timestamp":"2021-05-05T12:57:26Z",
    "country":"NL",
    "certificateType":"UPLOAD",
    "thumbprint":"7a58cc85a1bcfecb1bc69822cc2a72dfb4fbc9fe23d588fa9b0660b929d368f9",
    "signature":"<snip>",
    "rawData":"<snip>"
  },
  {
    "kid":"pdRBv6f9vCs=",
    "timestamp":"2021-05-05T12:57:36Z",
    "country":"NL",
    "certificateType":"CSCA",
    "thumbprint":"a5d441bfa7fdbc2b64b73fb1d78e801bc131d670f6e97218a1625098b3ced707",
    "signature":"<snip>",
    "rawData":"<snip>"
  }
]

NOTE: the url uses mixed cases; it's trustList not trustlist!

If something goes wrong, the best place to look is in the logging.

Docker users can read the logs by copying them to their machine; use docker ps to get the ID of the running containers and docker cp [CONTAINER_ID]:/logs/dgcg.log . to copy the log file to the current directory.

Send requests

DGC Gateway does not do any mTLS termination. To simulate the LoadBalancer on your local deployment you have to send HTTP requests to the gateway and set two HTTP-Headers:

X-SSL-Client-SHA256: Containing the SHA-256 Hash of the AUTHENTICATION certificate (thumbprint from dgc ta command output) X-SSL-Client-DN: Containing the Distinguish Name (Subject) of the AUTHENTICATION certificate. (Must only contain Country Property, e.g. C=EU)

Coverting the certificate/private key into PKCS12

Windows users may wish to convert their certificate/private keys into a PKCS12 package so that it can be imported into the machine's certificate store. Thankfully that is pretty simple using openssl.

For example to convert the test authentication certificate created earlier:

     openssl pkcs12 -export -out auth.pfx -inkey key_auth.pem -in cert_auth.pem

Documentation

OpenAPI Spec

The latest OpenAPI specification can always be found here: https://eu-digital-green-certificates.github.io/dgc-gateway/

It is also possible to access OpenAPI when DGC Gateway is deployed on your local computer when Spring-Profile "dev" or " local" is enabled. In order to set authentication headers for authentication without a mTLS terminating LoadBalancer at least the profile "local" should be enabled. Then both headers can be set in Swagger UI.

http://localhost:8090/swagger-ui/index.html

Other Documentation

Support and feedback

The following channels are available for discussions, feedback, and support requests:

Type Channel
Gateway issues
Other requests

How to contribute

Contribution and feedback is encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines. By participating in this project, you agree to abide by its Code of Conduct at all times.

Contributors

Our commitment to open source means that we are enabling -in fact encouraging- all interested parties to contribute and become part of its developer community.

Licensing

Copyright (C) 2021 T-Systems International GmbH and all other contributors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the LICENSE for the specific language governing permissions and limitations under the License.