Skip to content

v0.0.4

Choose a tag to compare

@github-actions github-actions released this 09 Jun 10:10
· 34 commits to main since this release

Added

  • Extensible entrypoint hook system: a child image adds a launch mode by dropping
    a handle_<command> hook into /docker-entrypoint-hook.d/ (sourced and
    ownership-vetted as root before any privilege drop), and the entrypoint became a
    thin dispatcher over a reusable core library (docker-entrypoint-common.sh) of
    logging, daemon lifecycle, config appliers, privilege drop, and user
    provisioning. Downstream images inherit every base robustness/security fix
    without overwriting /docker-entrypoint.sh.
  • examples/cron-hook/: an example of the hook system — one image runs in two
    roles, the Unit web server and a long-lived supercronic cron runner, selected
    per container by the command (supercronic is pinned and SHA256-verified).
  • test/entrypoint-lib.sh gained checks for the hook dispatch contract
    (dispatch_handler), the exec_as_user privilege drop, setup_user id
    validation and idempotency, the dir_has_content empty/non-empty boundary, and
    newline-less / non-numeric pidfiles. The host-side CLI parser and image build
    shared by both test drivers were extracted into test/lib.sh.

Changed

  • apply_config now warns when more than one *.json is present in
    /docker-entrypoint.d, since PUT /config replaces the whole configuration and
    only the lexically-last file survives.
  • wait_for_control_socket bounds each probe with curl --max-time, and
    run_entrypoint_scripts now reports which user script failed.
  • examples/ reorganised so each example is a self-contained subdirectory
    (examples/basic/, examples/cron-hook/) with an index README.md.
  • CI pins ShellCheck to the version used locally — the runner's bundled one
    flagged false positives on the library's optional-argument and
    trap/dispatch-invoked functions — and now lints each example's README.md.

Fixed

  • A child-hook handle_<cmd> that exits non-zero no longer aborts the entrypoint
    silently under set -e before its diagnostic. Dispatch moved into
    dispatch_handler, which reports both a non-zero exit and a return-without-exec
    with an actionable message.
  • stop_unit no longer skips kill -TERM when the pidfile has no trailing
    newline (read returns non-zero at EOF even after assigning the value). The new
    read_pid helper decouples the value from read's exit status and ignores a
    non-numeric pid, so a corrupt pidfile cannot become a broad kill.
  • dir_has_content treats an existing-but-unreadable directory as an error rather
    than "empty", so a transient EACCES on the state dir cannot trigger a
    re-initialisation over a populated state.

Security

  • exec_as_user now passes setpriv --no-new-privs, so a child-image hook's
    privilege drop is irreversible inside the image even if the operator omits
    --security-opt=no-new-privileges.
  • The first-run failure wipe (find … -delete) gained -xdev, so it stops at
    filesystem boundaries and never deletes through a host volume bind-mounted
    inside /var/lib/unit.
  • apply_certificates validates the bundle name to [A-Za-z0-9._-], so a crafted
    *.pem filename cannot retarget the control-API PUT at another endpoint.