HUB
Sign inSign up
samba logo

dgcosenza/samba

By dgcosenza

•Updated about 12 hours ago

Hardened Samba (SMB3) file server on Debian 13 (trixie) with env-driven setup and daily CVE gates.

Image
1

2.7K

dgcosenza/samba repository overview

⁠Samba (SMB3) File Server on Debian 13 (trixie)

Daily CI OpenSSF Scorecard Workflow Gitleaks Secret Scan Public Content Check OpenSSF Scorecard OpenSSF Best Practices

Trivy + Grype: 0 Fixable CVEs Signed: Cosign OIDC SLSA Build L3 SBOM: SPDX + CycloneDX Base OS Architectures Healthcheck: CI Verified Renovate Enabled Dependabot Enabled Daily Rebuilds

Latest Release Release Date Last Commit Docker Pulls Docker Image Size Registries: Docker Hub + GHCR Packaging License: MIT Upstream License GitHub Issues FNX Labs Catalog

A hardened, multi-arch Samba (SMB3) file server container image on Debian 13 (trixie-slim), featuring drop-in environment-driven user/share configuration (ACCOUNT_*, UID_*, SAMBA_VOLUME_CONFIG_*), clean read-only mounted /etc/samba/smb.conf support, 0600 password database permissions, tini PID 1, and functional smbclient healthchecks, maintained by Daniel G. Cosenza from FNX Labs.


⁠Current Versions

ComponentResolved Version
Samba4.22.11 (2:4.22.11+dfsg-0+deb13u1)
Base OSDebian 13.8 (trixie-slim)
Architectureslinux/amd64, linux/arm64
Uncompressed size (per arch)amd64: 68.5 MB, arm64: 216.9 MB
Last verified build (UTC)2026-11-28
Published multi-arch digestdgcosenza/samba@sha256:316fd672cff1aef7724f5f2564cf7c62b93463943782d78d464a2fe59ac77837
GHCR mirrorghcr.io/dgcosenza/samba@sha256:316fd672cff1aef7724f5f2564cf7c62b93463943782d78d464a2fe59ac77837
Supply chainCosign OIDC signed + SPDX & CycloneDX SBOM attestations + SLSA Build L3 provenance
Security gate (Trivy + Grype on SBOM)0 fixable findings of any severity (32 upstream-unfixed)

Recent upstream changes:

  • Samba: 4.22.11 (2:4.22.11+dfsg-0+deb13u1) -> 4.22.11 (2:4.22.11+dfsg-0+deb13u1)
  • Upstream version changed: no
  • Official Debian 13 (trixie) Samba package 2:4.22.11+dfsg-0+deb13u1 (upstream Samba 4.22.11).

⁠Supported Tags & Tag Policy

Identical multi-arch OCI digests are published to Docker Hub (dgcosenza/samba) and GHCR (ghcr.io/dgcosenza/samba), accompanied by an automated signed GitHub Release⁠:

TagPolicyDescription
<version>-<YYYYMMDD> (e.g. 4.22.11-20261125)ImmutableDate-stamped daily rebuild pinning the Samba version and UTC build date.
sha-<short>ImmutablePackaging repository Git commit tag.
<version> (e.g. 4.22.11)MovingLatest verified Debian 13 security rebuild of that Samba release.
latestMovingLatest verified build tracking the newest official Debian 13 Samba package.

Production pinning: Pin by immutable registry digest rather than an unpinned moving tag:

image: dgcosenza/samba:latest@sha256:<digest>
# or via GitHub Container Registry (identical digest):
image: ghcr.io/dgcosenza/samba:latest@sha256:<digest>

⁠Supported Architectures

ArchitectureStatusVerification
linux/amd64Published & natively testedBuilt, smoke-tested (env-driven + :ro smb.conf, SMB3 auth R/W, 0600 smbpasswd, env secret scrub), Dive-gated, Syft/Trivy/Grype-scanned, and Cosign-signed on native x86_64 CI runners.
linux/arm64Published & natively testedBuilt, smoke-tested, Dive-gated, Syft/Trivy/Grype-scanned, and Cosign-signed on native ARM64 CI runners.

⁠Quick Start

⁠Docker CLI
docker run -d --name samba \
  --cap-drop ALL \
  --cap-add NET_BIND_SERVICE \
  --cap-add SETUID \
  --cap-add SETGID \
  --cap-add CHOWN \
  --cap-add DAC_OVERRIDE \
  --cap-add FOWNER \
  --security-opt no-new-privileges:true \
  -p 127.0.0.1:445:445 \
  -e NETBIOS_DISABLE=1 \
  -e AVAHI_DISABLE=1 \
  -e WSDD2_DISABLE=1 \
  -e SAMBA_CONF_MAP_TO_GUEST=Never \
  -e ACCOUNT_alice=change_me_password \
  -e UID_alice=1000 \
  -e SAMBA_VOLUME_CONFIG_media="[media]; path = /shares/media; valid users = alice; guest ok = no; read only = no; browseable = yes" \
  -v ./media:/shares/media \
  dgcosenza/samba:latest
⁠Hardened Docker Compose

See docker-compose.example.yml⁠:

services:
  samba:
    image: dgcosenza/samba:latest
    restart: unless-stopped
    cap_drop:
      - ALL
    cap_add:
      - NET_BIND_SERVICE
      - SETUID
      - SETGID
      - CHOWN
      - DAC_OVERRIDE
      - FOWNER
    security_opt:
      - no-new-privileges:true
    network_mode: host
    env_file:
      - ./samba.env
    environment:
      TZ: UTC
      FAIL_FAST: "1"
      NETBIOS_DISABLE: "1"
      AVAHI_DISABLE: "1"
      WSDD2_DISABLE: "1"
    volumes:
      - ./smb.conf:/etc/samba/smb.conf:ro
      - ./shares/data:/shares/data
    healthcheck:
      test: ["CMD-SHELL", "smbclient -L 127.0.0.1 -N >/dev/null 2>&1"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 30s

⁠Configuration

⁠Environment Variables

Drop-in compatible with the ServerContainers/samba env-driven scheme:

VariableDescriptionDefault
ACCOUNT_<user>Create Samba user with plaintext password or pre-hashed smbpasswd entry (scrubbed from env before exec smbd)—
UID_<user>Numeric UID (and matching primary GID) for <user>Auto
GROUPS_<user>Comma-separated supplementary groups for <user>—
GROUP_<name>Create group <name> with the given GID—
SAMBA_VOLUME_CONFIG_<id>Semicolon- or newline-delimited share stanza (when /etc/samba/smb.conf is not mounted :ro)—
SAMBA_CONF_SERVER_ROLEGlobal server rolestandalone server
SAMBA_CONF_WORKGROUPGlobal workgroupWORKGROUP
SAMBA_CONF_SERVER_STRINGGlobal server stringSamba Server
SAMBA_CONF_MAP_TO_GUESTGlobal map to guestBad User
SAMBA_CONF_LOG_LEVELGlobal log level1
SAMBA_GLOBAL_STANZASemicolon-separated extra [global] directives—
SAMBA_GLOBAL_CONFIG_<key>Individual [global] setting (_SPACE_ -> space, _COLON_ -> :)—
DISABLE_FRUIT_DEFAULTSStrip macOS vfs_fruit defaults when setUnset
MODELmacOS / Avahi model identifier (fruit:model)TimeCapsule
NETBIOS_DISABLEDisable nmbd and NetBIOS when setUnset
AVAHI_DISABLEDisable avahi-daemon when setUnset
WSDD2_DISABLEDisable wsdd2 (WS-Discovery) when setUnset
FAIL_FASTExit immediately on startup configuration errorsUnset
TZContainer timezoneUTC
⁠Volumes, Ports, and Privileges
Path / PortPurpose
/sharesBase mount point for shared host directories
/etc/samba/smb.confOptional read-only custom smb.conf mount (preserved verbatim when :ro while still provisioning ACCOUNT_*/UID_*/GROUP_*)
445/tcpSMB2/SMB3 over TCP
139/tcp, 137/udp, 138/udpOptional NetBIOS (disabled when NETBIOS_DISABLE=1)

smbd starts as root strictly to bind privileged port 445 and switch effective UID/GID per authenticated SMB session and force user directive; dropping all capabilities except NET_BIND_SERVICE, SETUID, SETGID, CHOWN, DAC_OVERRIDE, and FOWNER alongside no-new-privileges:true minimizes container privileges. Account passwords are stored with strict 0600 permissions inside 0700 /var/lib/samba/private and scrubbed from smbd's environment before exec.


⁠Healthcheck

smbclient -L 127.0.0.1 -N >/dev/null 2>&1

⁠Upgrade and Migration from ghcr.io/servercontainers/samba

  1. Keep your existing samba.env (ACCOUNT_*, UID_*), volume mounts, and optional /etc/samba/smb.conf:ro mount unchanged.
  2. Any previous post_start workaround to chmod 0600 /var/lib/samba/private/smbpasswd is no longer needed because the entrypoint enforces 0600 automatically.
  3. Tag the outgoing image locally for rollback, switch image: to dgcosenza/samba:latest@sha256:<digest> (or GHCR), and run docker compose up -d samba.

⁠Supply-Chain Verification

Every published digest (multi-arch index and per-architecture manifests) on both Docker Hub and GHCR is keyless-signed with Sigstore Cosign (GitHub OIDC), attested with SPDX and CycloneDX SBOMs, and backed by SLSA Build L3 provenance (actions/attest-build-provenance).

⁠Verify image signature with Cosign
cosign verify \
  --certificate-identity-regexp="^https://github\.com/dgcosenza/samba-docker/\.github/workflows/daily\.yml@refs/heads/main$" \
  --certificate-oidc-issuer="https://token.actions.githubusercontent.com" \
  ghcr.io/dgcosenza/samba:latest

# Or against Docker Hub (identical digest):
cosign verify \
  --certificate-identity-regexp="^https://github\.com/dgcosenza/samba-docker/\.github/workflows/daily\.yml@refs/heads/main$" \
  --certificate-oidc-issuer="https://token.actions.githubusercontent.com" \
  dgcosenza/samba:latest
⁠Verify SPDX / CycloneDX SBOM attestations
cosign verify-attestation \
  --type spdxjson \
  --certificate-identity-regexp="^https://github\.com/dgcosenza/samba-docker/\.github/workflows/daily\.yml@refs/heads/main$" \
  --certificate-oidc-issuer="https://token.actions.githubusercontent.com" \
  ghcr.io/dgcosenza/samba@sha256:<arch-digest>
⁠Verify SLSA Build Provenance
gh attestation verify oci://ghcr.io/dgcosenza/samba:latest --owner dgcosenza

⁠Security

  • Preflight gates: Every push and PR runs Hadolint (blocking on warning+), Gitleaks secret scanning across git history, and public-content/attribution checks.
  • Vulnerability scan policy (all severities with a fix): Every build generates SPDX and CycloneDX SBOMs with Syft per architecture, scans with Trivy (table, JSON, SARIF upload, blocking --ignore-unfixed gate) and Grype scanning the SPDX SBOM (--only-fixed --fail-on negligible), and enforces a Dive efficiency gate (>= 95%).
  • Runtime hardening: 0600 smbpasswd, 0700 /var/lib/samba/private, ACCOUNT_* scrubbed from smbd environment, tini PID 1, no-new-privileges:true compatible.
  • Dependency automation: Renovate (renovate.json) pins base image digests and GitHub Action commit SHAs; Dependabot security alerts and OpenSSF Scorecard monitoring are enabled.
  • See SECURITY.md⁠ for responsible disclosure.

⁠Build Locally

docker buildx build --platform linux/amd64 --load -t dgcosenza/samba:local .

⁠Update Policy

.github/workflows/daily.yml⁠ runs automatically every day at 05:32 UTC, on pushes to main, on pull requests (verification only), and via workflow_dispatch:

  1. Preflight & upstream check: Runs public-content checks, Hadolint, and Gitleaks; queries Debian 13 (trixie, trixie-updates, trixie-security) APT feeds for the latest Samba package and resolves the latest debian:trixie-slim digest, emitting upstream-changes.md.
  2. Multi-arch no-cache rebuild: Rebuilds natively on linux/amd64 and linux/arm64 runners with --no-cache on schedule and apt-get upgrade.
  3. Smoke, Dive & vulnerability gates: Runs tests/smoke.sh⁠ natively on both architectures, enforces the Dive efficiency gate (>= 95%), generates Syft SPDX + CycloneDX SBOMs per arch, and gates publication on 0 fixable findings of any severity in both Trivy and Grype (scanning the SPDX SBOM).
  4. Dual-registry publish & supply-chain signing: Assembles the multi-arch OCI manifest index on GHCR (ghcr.io/dgcosenza/samba) and mirrors the identical digest to Docker Hub (dgcosenza/samba) with tags latest, <version>, <version>-<YYYYMMDD>, and sha-<short>; signs every digest and attaches SPDX/CycloneDX SBOM attestations via Cosign keyless OIDC; emits SLSA Build L3 provenance; and publishes a signed GitHub Release with checksums and SBOMs.
  5. Automated documentation sync: Commits updated versions.json, the README Current Versions block, and a dated CHANGELOG.md entry via github-actions[bot] ([skip ci], validated by public-check.sh), then syncs the Docker Hub overview and short description.
  6. Failure alerting: Opens or updates a single GitHub issue labeled ci-failure on any main or scheduled failure, and auto-closes it on the next green run.

⁠Design Decisions

  • Debian 13 (trixie-slim) native packages: Installs samba, smbclient, wsdd2, avahi-daemon, and tini directly from official Debian 13 repositories — no custom compilation of archived wsdd2 tarballs required.
  • Clean read-only smb.conf support: Detects read-only /etc/samba/smb.conf mounts and preserves them verbatim while still provisioning users and enforcing 0600 credentials.
  • Hadolint DL3008 ignore: Daily --no-cache security rebuilds intentionally pull the newest Debian 13 security updates via apt-get.
  • Dive highestUserWastedPercent: 0.15: Overall image efficiency remains strictly gated at >= 95%. Because daily apt-get -y upgrade overwrites ~5 MB of debian:trixie-slim base files against a compact Samba layer, highestUserWastedPercent is tuned to 0.15 rather than squashing away shared Debian base layers.

⁠License

This repository follows a clear packaging-vs-upstream license split:

  • Container packaging, entrypoint scripts, CI workflows, and documentation (packaging: MIT): Licensed under the MIT License⁠ — copyright Daniel G. Cosenza from FNX Labs.
  • Bundled upstream software — Samba (upstream: GPL-3.0-or-later): Copyright the Samba Team — licensed under the GNU General Public License v3.0 or later⁠.

Full third-party notices are maintained in THIRD-PARTY-NOTICES.md⁠. Release history is maintained in CHANGELOG.md⁠.

⁠Credits

Maintained by Daniel G. Cosenza from FNX Labs.

Tag summary

Content type

Image

Digest

sha256:316fd672c…

Size

65.3 MB

Last updated

about 12 hours ago

docker pull dgcosenza/samba