Notarizing Container images using JFrog’s API

Trust is a journey and not a state that lasts forever. Many customers we speak with store artifacts and container images in their private registry to keep them secure. The truth is that it is not only about vulnerabilities, but many other attributes, like licenses, existing contracts, or new versions.

Therefore, the trust level can change from one moment to the other. Codenotary allows for keeping the right trust level up to date by notarizing artifacts or container images with a different trust level (Trusted, Untrusted, or Unsupported). That happens without touching the file or container and does not require any redistribution.

This blog post covers a typical combination of JFrog Artifactory and Codenotary Community Attestation Service. The commercial offering Codenotary Cloud works similarly and has a richer feature set when it comes to user management, SBOMs, and vulnerability scanning.

Notarizing software artifacts shouldn’t be cumbersome. Ideally, it should be integrated into the DevOps processes and happen mostly in the background. But what are the best initial steps to set it up? A good starting point for implementing software artifact notarization is the Artifactory. A logical first step would be to notarize all images and/or artifacts that are already there. This blog looks into automated container image notarization using JFrog’s REST API and the Community Attestation Service from Codenotary.

Setting up a Docker Repository in JFrog

JFrog is either available as self hosted trial version or for free in the cloud. Another prerequisite is Docker. Login into JFrog and create 3 repositories:

Repository-KeyType
docker-dev-locallocal
docker-dev-remoteremote
dockervirtual

The local repository can be created with standard settings:

Local docker repository called docker-dev-local and created with standard settings

Creating the remote repository needs a little bit more attention as it is incorporating dockerhub. Dockerhub will just accept tokens so prepare a token on dockerhub.io. If manifest errors are occurring please uncheck: “Block pulling of image manifest V2 ….”

The remote repository called docker-dev-remote is created using docker.io, use the token for your account from dockerhub.

The virtual repository is using the local docker repository and the remote repository. We have to add the repositories and declare the local docker repository docker-dev-local to the Default Deployment Repository.

The virtual docker repository is called “docker”. Add the docker-dev-local and docker-hub-remote repositories and set docker-dev-local to Default Deployment Repository.

Getting Containers into the JFrog Repository

Our repositories are now still empty. So how do we add our images to the repositories?
docker login <your_jfrog_installation>.jfrog.io
docker tag <your_container_image> <your_jfrog_installation>jfrog.io/docker/<your_container_imagename>
docker push <your_jfrog_installation>.jfrog.io/docker/<your_container_imagename>:latest

Container images can be looked up by using "docker image ls". If you decided to use the self-hosted JFrog version without SSL and a domain, please add your local installation to docker’s daemon.json file first.

immudb and an example image called my-docker-image have been added to our local repository

Query the JFrog Api

We now want to query the images we have added to our repository. For that we need a Token and Query JFrogs API using the List Docker Repositories functionality. The API-Key can be obtained from your JFrog installation. Navigate to “Edit Profile”.

Generate the Identity Token.

The List Docker Repositories function of the jFrog API will list all images in your repository. The URL will be <your_jfrog_installation>.jfrog.io/artifactory/api/docker/<your_repository_name>/v2/_catalog.

Add the token as Bearer Token and send a request to the artifactory. The API retrieves a list of container images.

Creating a BASH Script that notarizes all Container Images from JFrog

We now create a BASH Script that will query JFrog for a list of docker images. Then pull these image to notarize them with the community attestation service. An open source service to help you secure and trust your software.

#!/bin/bash
export CAS_API_KEY=<your_api_key>; cas login
export SIGNER_ID=<your_cas_mail>
url=https://<your_jfrog_installation>.jfrog.io/artifactory/api/docker/docker/v2/_catalog
bearer="<bearer that can be created in edit profile of JFrog>"

DOCKER_LIST=($(curl -X GET ${url} -H "Accept: application/json" -H "Authorization: Bearer ${bearer}" | jq -r '.repositories' | tr -d '[],"'))

# iterate through the list of dockerimages
for i in "${DOCKER_LIST[@]}"
do
  echo "$i"
  docker pull codenotary.jfrog.io/docker/$i 
  cas notarize --bom docker://codenotary.jfrog.io/docker/$i
done

CNIL Metrics & Logs

Self-Hosted performance monitoring and compliant log analysis for VMware vSphere, container and much more.

immudb

Built on the fastest immutable ledger technology. Open Source and easy to use and integrate into existing application.

Codenotary Cloud

Trusted CI/CD, SBOM and artifact
protection with cryptographic proof.
One CLI to manage all.

Subscribe to Our Newsletter

Get the latest product updates, company news, and special offers delivered right to your inbox.

Subscribe to our newsletter

Use Case - Tamper-resistant Clinical Trials

Goal:

Blockchain PoCs were unsuccessful due to complexity and lack of developers.

Still the goal of data immutability as well as client verification is a crucial. Furthermore, the system needs to be easy to use and operate (allowing backup, maintenance windows aso.).

Implementation:

immudb is running in different datacenters across the globe. All clinical trial information is stored in immudb either as transactions or the pdf documents as a whole.

Having that single source of truth with versioned, timestamped, and cryptographically verifiable records, enables a whole new way of transparency and trust.

Use Case - Finance

Goal:

Store the source data, the decision and the rule base for financial support from governments timestamped, verifiable.

A very important functionality is the ability to compare the historic decision (based on the past rulebase) with the rulebase at a different date. Fully cryptographic verifiable Time Travel queries are required to be able to achieve that comparison.

Implementation:

While the source data, rulebase and the documented decision are stored in verifiable Blobs in immudb, the transaction is stored using the relational layer of immudb.

That allows the use of immudb’s time travel capabilities to retrieve verified historic data and recalculate with the most recent rulebase.

Use Case - eCommerce and NFT marketplace

Goal:

No matter if it’s an eCommerce platform or NFT marketplace, the goals are similar:

  • High amount of transactions (potentially millions a second)
  • Ability to read and write multiple records within one transaction
  • prevent overwrite or updates on transactions
  • comply with regulations (PCI, GDPR, …)


Implementation:

immudb is typically scaled out using Hyperscaler (i. e. AWS, Google Cloud, Microsoft Azure) distributed across the Globe. Auditors are also distributed to track the verification proof over time. Additionally, the shop or marketplace applications store immudb cryptographic state information. That high level of integrity and tamper-evidence while maintaining a very high transaction speed is key for companies to chose immudb.

Use Case - IoT Sensor Data

Goal:

IoT sensor data received by devices collecting environment data needs to be stored locally in a cryptographically verifiable manner until the data is transferred to a central datacenter. The data integrity needs to be verifiable at any given point in time and while in transit.

Implementation:

immudb runs embedded on the IoT device itself and is consistently audited by external probes. The data transfer to audit is minimal and works even with minimum bandwidth and unreliable connections.

Whenever the IoT devices are connected to a high bandwidth, the data transfer happens to a data center (large immudb deployment) and the source and destination date integrity is fully verified.

Use Case - DevOps Evidence

Goal:

CI/CD and application build logs need to be stored auditable and tamper-evident.
A very high Performance is required as the system should not slow down any build process.
Scalability is key as billions of artifacts are expected within the next years.
Next to a possibility of integrity validation, data needs to be retrievable by pipeline job id or digital asset checksum.

Implementation:

As part of the CI/CD audit functionality, data is stored within immudb using the Key/Value functionality. Key is either the CI/CD job id (i. e. Jenkins or GitLab) or the checksum of the resulting build or container image.

White Paper — Registration

We will also send you the research paper
via email.

CodeNotary — Webinar

White Paper — Registration

Please let us know where we can send the whitepaper on CodeNotary Trusted Software Supply Chain. 

Become a partner

Start Your Trial

Please enter contact information to receive an email with the virtual appliance download instructions.

Start Free Trial

Please enter contact information to receive an email with the free trial details.