Table: dockerhub_token - Query DockerHub Tokens using SQL
DockerHub Tokens are a feature of DockerHub, a cloud-based repository service where developers can manage, store, and distribute Docker images. Tokens allow secure access to DockerHub repositories, providing an additional layer of security for images and containers. They are used to authenticate Docker CLI and Docker API requests, replacing the need for using username and password.
Table Usage Guide
The dockerhub_token
table provides insights into DockerHub Tokens within DockerHub. As a DevOps engineer, explore token-specific details through this table, including token ID, status, and associated metadata. Utilize it to manage and monitor tokens, such as those currently active, their permissions, and the time of their creation.
Examples
Basic info
Explore which DockerHub tokens are active and when they were created. This can be useful for auditing purposes, to track user activity and ensure security compliance.
select uuid, is_active, generated_by, creator_ua, creator_ip, created_at, client_idfrom dockerhub_token;
select uuid, is_active, generated_by, creator_ua, creator_ip, created_at, client_idfrom dockerhub_token;
List inactive tokens
Discover the segments that are associated with inactive tokens in DockerHub. This can be beneficial in identifying potential security risks and maintaining optimal system performance.
select uuid, is_active, generated_by, creator_ua, creator_ip, created_at, client_idfrom dockerhub_tokenwhere not is_active;
select uuid, is_active, generated_by, creator_ua, creator_ip, created_at, client_idfrom dockerhub_tokenwhere is_active = 0;
List tokens which have never been used
Identify unused tokens within your DockerHub setup to assess potential security risks or inefficiencies. This helps in maintaining a clean, secure, and efficient environment by removing or updating unused tokens.
select uuid, is_active, generated_by, creator_ua, creator_ip, created_at, client_idfrom dockerhub_tokenwhere last_used is null;
select uuid, is_active, generated_by, creator_ua, creator_ip, created_at, client_idfrom dockerhub_tokenwhere last_used is null;
List manually generated tokens
Explore which tokens have been manually generated. This is beneficial in identifying potential security risks or anomalies related to token generation.
select uuid, is_active, generated_by, creator_ua, creator_ip, created_at, client_idfrom dockerhub_tokenwhere generated_by = 'manual';
select uuid, is_active, generated_by, creator_ua, creator_ip, created_at, client_idfrom dockerhub_tokenwhere generated_by = 'manual';
List tokens which are older than 90 days
Determine the areas in which DockerHub tokens have remained active for more than 90 days. This can be useful for identifying potential security risks associated with outdated tokens.
select uuid, is_active, generated_by, creator_ua, creator_ip, created_at, client_idfrom dockerhub_tokenwhere created_at < now() - interval '90' day;
select uuid, is_active, generated_by, creator_ua, creator_ip, created_at, client_idfrom dockerhub_tokenwhere created_at < datetime('now', '-90 day');
Schema for dockerhub_token
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | Docker Hub account ID. |
client_id | text | Client ID associated with the token. | |
created_at | timestamp with time zone | Timestamp indicating when the token was created. | |
creator_ip | text | IP address of the creator or originator of the token. | |
creator_ua | text | User-Agent (UA) string of the creator or originator of the token. | |
description | text | Description or additional information about the token. | |
generated_by | text | Entity that generated the token. | |
is_active | boolean | Boolean value indicating whether the token is active or not. | |
last_used | timestamp with time zone | Timestamp indicating the last time the token was used. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
title | text | Title of the resource. | |
token | text | Actual token value used for authentication or authorization purposes. | |
uuid | text | = | Universally Unique Identifier (UUID) of the token. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- dockerhub
You can pass the configuration to the command with the --config
argument:
steampipe_export_dockerhub --config '<your_config>' dockerhub_token