Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Security] ssl-cert snakeoil private key baked into standard images (Trivy HIGH)

未关闭
#513 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
debian, docker, postgresql

调研方向

Inspect the Dockerfile steps that install the Debian ssl-cert package across the standard and minimal image variants. Reproduce the finding with the provided trivy image command, then verify that all affected PostgreSQL 13–18 bookworm and trixie images no longer contain the snakeoil key or certificate and pass the scan.

由索引模型根据 Issue 内容生成。

描述

Summary

Trivy flags a HIGH-severity secret in ghcr.io/cloudnative-pg/postgresql:16.14-standard-bookworm:

  • File: /etc/ssl/private/ssl-cert-snakeoil.key
  • Finding: AsymmetricPrivateKey (private-key) — HIGH
  • Added by: RUN |2 PG_VERSION=16.14 PG_MAJOR=16 /bin (during apt install ssl-cert package)

Root Cause

The Debian ssl-cert package generates a self-signed snakeoil certificate during installation. When installed at Docker build time, the private key is baked into the image layer and ships in every container derived from this image.

Impact

  • All containers running this image share the same private key — extractable by anyone with pull access
  • Trivy, Grype, and Snyk all flag this as HIGH, blocking security-gated CI/CD pipelines

Reproduction

trivy image --ignore-unfixed ghcr.io/cloudnative-pg/postgresql:16.14-standard-bookworm

Output:

/etc/ssl/private/ssl-cert-snakeoil.key (secrets)
Total: 1 (HIGH: 1)
HIGH: AsymmetricPrivateKey (private-key)

Suggested Fix

Remove the snakeoil key after package installation in the Dockerfile:

RUN apt-get install ... &&     rm -f /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/certs/ssl-cert-snakeoil.pem

Or skip the ssl-cert package entirely if it is not required by PostgreSQL.

Affected Images

All PostgreSQL major versions (13–18) on both standard and minimal variants using bookworm and trixie bases.

主要语言
HCL
星标
156
派生
67
平均合并
1 天 15 小时
30 天内合并 PR
15

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cloudnative-pg/postgres-containers 的其他 Issue

查看 cloudnative-pg/postgres-containers 的全部 Issue

相似的 Issue

更多 DevOps Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。