diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-02-09 03:17:13 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-02-09 03:34:12 +0000 |
| commit | 092aa81983335b2346a725eebd2a75fc785bb42b (patch) | |
| tree | 4cae1a055b5027c9a049004a339bc3f752cbf8f1 /recipes-containers/container-registry/files | |
| parent | 4ed680e32e3670a4e50038387572ee7a35374c0e (diff) | |
| download | meta-virtualization-092aa81983335b2346a725eebd2a75fc785bb42b.tar.gz | |
container-registry: add secure registry infrastructure with TLS and auth
Add opt-in secure registry mode with auto-generated TLS certificates
and htpasswd authentication.
New BitBake variables:
CONTAINER_REGISTRY_SECURE - Enable TLS (HTTPS) for local registry
CONTAINER_REGISTRY_AUTH - Enable htpasswd auth (requires SECURE=1)
CONTAINER_REGISTRY_USERNAME/PASSWORD - Credential configuration
CONTAINER_REGISTRY_CERT_DAYS/CA_DAYS - Certificate validity
CONTAINER_REGISTRY_CERT_SAN - Custom SAN entries
The bbclass validates conflicting settings (AUTH without SECURE) and
provides credential helper functions for skopeo push operations.
PKI infrastructure (CA + server cert with SAN) is auto-generated at
bitbake build time via openssl-native. The generated helper script
supports both TLS-only and TLS+auth modes.
The script now supports environment variable overrides for
CONTAINER_REGISTRY_STORAGE, CONTAINER_REGISTRY_URL, and
CONTAINER_REGISTRY_NAMESPACE, uses per-port PID files to allow
multiple instances, and auto-generates config files when running
from an overridden storage path.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'recipes-containers/container-registry/files')
| -rw-r--r-- | recipes-containers/container-registry/files/container-registry-secure.yml | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/recipes-containers/container-registry/files/container-registry-secure.yml b/recipes-containers/container-registry/files/container-registry-secure.yml new file mode 100644 index 00000000..73036d99 --- /dev/null +++ b/recipes-containers/container-registry/files/container-registry-secure.yml | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | # Container Registry Secure Configuration (TLS + htpasswd authentication) | ||
| 2 | # ============================================================================ | ||
| 3 | # | ||
| 4 | # This configuration enables HTTPS with TLS certificates and htpasswd auth. | ||
| 5 | # Certificates and credentials are auto-generated on first start. | ||
| 6 | # | ||
| 7 | # Usage: | ||
| 8 | # Enable secure mode in local.conf: | ||
| 9 | # CONTAINER_REGISTRY_SECURE = "1" | ||
| 10 | # | ||
| 11 | # Run: container-registry.sh start | ||
| 12 | # This auto-generates: | ||
| 13 | # - pki/ca.crt, ca.key (CA certificate) | ||
| 14 | # - pki/server.crt, server.key (server certificate with SAN) | ||
| 15 | # - auth/htpasswd (bcrypt credentials) | ||
| 16 | # - auth/password (plaintext password for reference) | ||
| 17 | # | ||
| 18 | # See: https://distribution.github.io/distribution/about/configuration/ | ||
| 19 | |||
| 20 | version: 0.1 | ||
| 21 | |||
| 22 | log: | ||
| 23 | level: info | ||
| 24 | formatter: text | ||
| 25 | fields: | ||
| 26 | service: container-registry-secure | ||
| 27 | |||
| 28 | storage: | ||
| 29 | filesystem: | ||
| 30 | # Storage directory - replaced at generation time | ||
| 31 | rootdirectory: __STORAGE_PATH__ | ||
| 32 | # Enable deletion of images/tags | ||
| 33 | delete: | ||
| 34 | enabled: true | ||
| 35 | # Don't redirect to external storage | ||
| 36 | redirect: | ||
| 37 | disable: true | ||
| 38 | # Maintenance settings | ||
| 39 | maintenance: | ||
| 40 | uploadpurging: | ||
| 41 | enabled: true | ||
| 42 | age: 168h # 1 week | ||
| 43 | interval: 24h | ||
| 44 | dryrun: false | ||
| 45 | |||
| 46 | http: | ||
| 47 | addr: :5000 | ||
| 48 | headers: | ||
| 49 | X-Content-Type-Options: [nosniff] | ||
| 50 | # TLS configuration - paths replaced at generation time | ||
| 51 | tls: | ||
| 52 | certificate: __PKI_DIR__/server.crt | ||
| 53 | key: __PKI_DIR__/server.key | ||
| 54 | |||
| 55 | # htpasswd authentication | ||
| 56 | auth: | ||
| 57 | htpasswd: | ||
| 58 | realm: "Yocto Container Registry" | ||
| 59 | path: __AUTH_DIR__/htpasswd | ||
| 60 | |||
| 61 | # Health check endpoint | ||
| 62 | health: | ||
| 63 | storagedriver: | ||
| 64 | enabled: true | ||
| 65 | interval: 10s | ||
| 66 | threshold: 3 | ||
