DISTRIBUTION: How to create and sign a release bundle with a GPG key
In this article, I will walk through how to create a distribution release bundle V1 and sign using a GPG key.
Prerequisites:
- Artifactory 7.x with Enterprise+ subscription
- Artifactory Edge node
- Distribution 2.x
- Circle of Trust is set up between my Artifactory 7.x instance and Artifactory Edge node
- The Edge node is added as a JPD on the Artifactory 7.x instance
Create a GPG key
* Make sure to note down your passphrase!
Using the above key highlighted above, create .key files for public and private keys:
Below file should be created:
Add keys to the keystore using: apt-key add <your_public.key>, then check if it was added by running: apt-key list.
Then, create gpg.json file like below using the generated public and private keys like in the below example:
{
"alias" : "GPG",
"public_key": "-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBGaPBlYBCACdTeLvvE0klW/yvP1r9ftCqYFc0pHyqOZfvgDB2giroqtwG/a5
ZW3ji/B7Yyn5A0MVAIpzJynldSWdtKQzm4zdNd1IOJxhdYEfeynTItoukxTjAfWU
…
…
DpmxBfejJk3/oFdhU/102Bw9P1ZvHrkB59gEyCyQB1HvYFo4BBLTRaJRn2ENA37N
PqEWrjRY56yLyopS1sZDnata
=tl0j
-----END PGP PUBLIC KEY BLOCK-----",
"private_key": "-----BEGIN PGP PRIVATE KEY BLOCK-----
lQPFBGaPBlYBCACdTeLvvE0klW/yvP1r9ftCqYFc0pHyqOZfvgDB2giroqtwG/a5
ZW3ji/B7Yyn5A0MVAIpzJynldSWdtKQzm4zdNd1IOJxhdYEfeynTItoukxTjAfWU
…
…
DpmxBfejJk3/oFdhU/102Bw9P1ZvHrkB59gEyCyQB1HvYFo4BBLTRaJRn2ENA37N
PqEWrjRY56yLyopS1sZDnata
=E2fA
-----END PGP PRIVATE KEY BLOCK-----"
}Upload the GPG signing key to DistributionUsing the “Upload GPG Signing Key for Distribution” REST API here, upload the above key pair to Distribution to sign release bundles.
root@dd4846e7fd13:~# curl -uadmin:password -H "Accept: application/json" -H "Content-Type: application/json" -X PUT "localhost:8082/distribution/api/v1/keys/gpg" -T gpg.json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5464 100 60 100 5404 51 4646 0:00:01 0:00:01 --:--:-- 4694^[[C
{"message":"Set PGP public & private key","status_code":200}Propagate the GPG signing keys to a Distribution EdgeThen, using the “Propagate GPG Signing Keys to a Distribution Edge” REST API here, propagate the gpg key to our edge node.
root@dd4846e7fd13:~# curl localhost:8082/distribution/api/v1/keys/gpg/propagate -uadmin:password -XPOST
{"status":"SUCCESS","details":[{"jpd_id":"JPD-1","name":"HOME","key_alias":"gpg-1720650291793","status":"SUCCESS"},{"jpd_id":"JPD-2","name":"edge","key_alias":"gpg-1720650291793","status":"SUCCESS"}]}
Create and sign a release bundle from the UI
Distribute version
Further, to distribute the signed release bundle, we can choose the ‘Distribute Version’ from the Version Actions drop down menu: