Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,4 @@ jobs:
dist/agentlinux-*.tar.gz.sha256
dist/catalog-*.json
dist/agentlinux_*.deb
dist/VERSION
11 changes: 9 additions & 2 deletions packaging/curl-installer/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,15 @@ main() {
# HTTP 404 HTML body would land in the tarball path and sha256sum -c would
# emit a confusing "FAILED" verdict. Asserting the gzip magic bytes BEFORE
# sha256 gives a precise error.
if ! file -- "${tmpdir}/${tarball}" | grep -q 'gzip compressed'; then
die "downloaded ${tarball} is not a gzip archive — possible 404-as-HTML or proxy-rewrite; refusing to proceed"
#
# Read the first two bytes via `head` + `od` rather than `file(1)`: the
# `file` package is NOT preinstalled on minimal Ubuntu/Debian cloud images
# (and many Docker base images). `head` and `od` are coreutils, always
# present. Magic for gzip is 1f 8b (RFC 1952).
local _magic
_magic=$(head -c 2 "${tmpdir}/${tarball}" 2>/dev/null | od -An -tx1 | tr -d ' \n')
if [[ "$_magic" != "1f8b" ]]; then
die "downloaded ${tarball} is not a gzip archive (magic bytes: ${_magic:-empty}) — possible 404-as-HTML or proxy-rewrite; refusing to proceed"
fi

# SHA256 verification BEFORE extraction (T-06-02 — hard security gate).
Expand Down
10 changes: 10 additions & 0 deletions plugin/provisioner/20-sudoers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@

log_info "20-sudoers: starting"

# Minimal Ubuntu/Debian cloud images (and many Docker base images) ship without
# the `sudo` package, which provides both the `sudo` binary AND `visudo`. We
# need `visudo` to validate the drop-in before installing it (T-05.1-01), and
# the agent user obviously needs `sudo` afterwards. Mirror the pattern used by
# 10-agent-user.sh's `locales` install.
if ! command -v visudo >/dev/null 2>&1; then
log_warn "visudo not found; installing 'sudo' package"
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends sudo
fi

readonly SUDOERS_FILE="/etc/sudoers.d/agentlinux"
# Single-quoted heredoc — no shell expansion, byte-stable across re-runs. The
# meaningful policy is the single line `agent ALL=(ALL) NOPASSWD: ALL`; the
Expand Down
15 changes: 14 additions & 1 deletion scripts/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,19 @@ if [[ "$SRC_SHA" != "$SNAPSHOT_SHA" ]]; then
exit 1
fi

# ---------------------------------------------------------------------------
# 10b. VERSION sentinel asset.
# packaging/curl-installer/install.sh resolves an unpinned tag by
# following https://github.com/.../releases/latest/download/VERSION and
# capturing the redirect URL with curl -fsSIL. The asset itself doesn't
# need to be machine-parsed — but it MUST exist so curl -f doesn't fail
# on the redirect target. Without this file shipped on every release,
# `curl -fsSL https://agentlinux.org/install.sh | bash` fails with
# "could not resolve latest version" against any release that lacks the
# sentinel (dogfood-discovered against v0.3.2-rc1).
# ---------------------------------------------------------------------------
printf '%s\n' "$TAG" >dist/VERSION

# ---------------------------------------------------------------------------
# 11. Optional .deb via fpm (ADR-006 — optional v0.3.0 path).
# Skip gracefully if fpm is absent or SKIP_DEB=1 or --no-deb — the
Expand Down Expand Up @@ -345,4 +358,4 @@ fi
# ---------------------------------------------------------------------------
# 12. Final summary (stdout-only; no emojis per CLAUDE.md).
# ---------------------------------------------------------------------------
printf 'Built: %s + .sha256 + catalog-%s.json%s\n' "$TARBALL" "$TAG" "$DEB_SUFFIX"
printf 'Built: %s + .sha256 + catalog-%s.json + VERSION%s\n' "$TARBALL" "$TAG" "$DEB_SUFFIX"
Loading