Skip to main content

sambacc - A Samba Container Configuration Tool

About

The sambacc project aims to consolidate and coordinate configuration of Samba, and related components, when running in a container. The configuration of one or many server instances can be managed by the tool with the use of configuration files. These configuration files act as a superset of the well-known smb.conf, to configure Samba, as well as other low level details of the container environment.

Rationale

Samba is a powerful and unique tool for implementing the SMB protocol and a software stack to support it on unix-like systems. However, it's potentially challenging to set up and manage many instances of Samba by-hand, especially when running under a container orchestration system.

The idea behind sambacc is to automate much of the low level steps needed to set up samba daemons, users, groups, and other supporting components. The tool is also designed to consume configuration files that can be used across many container instances. sambacc is written in Python as samba provides Python bindings for some of the aspects of samba we need to control.

The sambacc library and samba-container CLI command are used by the samba-container project as part of the server container images.

Usage

File Server

The samba-container command is used to manage features related to the Samba file server and closely related components.

Without any additional arguments samba-container prints the synthesised samba (smb.conf) configuration based on the environment variables:

  • SAMBACC_CONFIG - configuration file(s)
  • SAMBA_CONTAINER_ID - Identity of this instance

Additionally, there are many other subcommands the tool supports. These include:

  • samba-container import - Import smb.conf-style settings into registry
  • samba-container import-users - Import users into /etc files and smb passdb
  • samba-container init - Initialize the container environment for use by samba services
  • samba-container run <service> - Initialize and run a named samba service

For a complete description of the subcommands supported, run:

samba-container --help

Active Directory Domain Controller

The samba-dc-container command is used to manage features related to the Samba AD DC server and related components.

Currently, samba-dc-container supports one subcommand. The run subcommand is used to start an AD DC server. This command supports various setup steps including steps to join an existing domain, provision a new domain, populate a domain with stock users/groups, etc.

For a complete description of the subcommands supported, run:

samba-dc-container --help

Features

  • Abstracts away some of the nitty-gritty details about what Samba expects in its environment
  • Imports specific smb.conf settings from "site wide" configuration files.
  • Imports users and groups
  • Starts smbd with container friendly settings
  • Starts winbindd with container friendly settings
  • Support for joining AD
  • Support for managing CTDB clustering
  • Support for creating/joining Samba Active Directory servers

Major TODOs

A lot. Various things that are missing include:

  • Features to perform more secure (password-less) domain joins
  • Better integration (as opposed to unit) testing
  • Better use of APIs versus executing CLI commands

Contributions and feedback would be very much appreciated.

Install

The sambacc library, samba-container command, and samba-dc-container are written assuming the software is being run within an OCI container environment. While there's nothing stopping you from trying to install it on something else the value of doing that will be rather limited.

The samba-container project includes sambacc and samba packages. If you are looking to use sambacc and not contribute to it, that's probably what you want.

Builds of sambacc are continuously produced within our COPR repository. These builds are then consumed by the container image builds.

Otherwise, the only method of install is from source control.

  • Clone the repo: git clone https://github.com/samba-in-kubernetes/sambacc
  • cd sambacc
  • Install locally: python -m pip install --user .

The test & build container may also be used to build source tarballs and wheels. Then you can distribute and install from the wheel if you need to.

Testing

Local testing

To run the entire unit test suite locally install tox and run tox in the repo root.

Because of the library and tooling that interacts with samba has some system level dependencies, not all tests can be run locally in isolated (virtualenv) environments.

Containerized testing

A more robust and isolated testing environment is provided in the form of the sambacc container image.

The container file and other sources are available at ./tests/container in the sambacc repo. This is the canonical way to run the test suite and is what is used by the CI tests. When run this way certain system packages can be installed, etc. to support running a wider range of test cases.

By default the container image is configured to check out sambacc master branch and execute the tests and build python source distributions, wheels, and RPM packages. You can test your local git checkout using the image by mounting it at /var/tmp/build/sambacc (example: podman run -v $PWD:/var/tmp/build/sambacc sambacc:ci).

To access the packages that are built using the container, mount a directory into the container at "/srv/dist" and set the environment variable SAMBACC_DISTNAME to a term of your choice (example: "latest"). This will then save the builds in a directory of that name in your output directory. Example:

$ mkdir -p $HOME/tmp/sambacc
$ podman run --rm \
  -v $HOME/tmp/sambacc:/srv/dist -e SAMBACC_DISTNAME=latest \
  quay.io/samba.org/sambacc:latest
$ ls $HOME/tmp/sambacc
latest
$ ls $HOME/tmp/sambacc/latest
sambacc-0.1.dev225+g10059ff-py3-none-any.whl  sha512sums
sambacc-0.1.dev225+g10059ff.tar.gz

You can combine the source directory mount and distribution directory mount in one command to produce builds for your own local development work if needed.

License

GPLv3 as per the COPYING file.

This is the same license as used by Samba.

Contributing/Contact

Patches, issues, comments, and questions are welcome.

Resources:

Metadata

Release files for sambacc 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sambacc 0.10
File Size Uploaded Provenance Actions
sambacc-0.10.tar.gz 181.4 kB Without provenance Details for sambacc-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sambacc 0.10
File Interpreter ABI Platform Actions
sambacc-0.10-py3-none-any.whl Python 3 none any Details for sambacc-0.10-py3-none-any.whl

Total release size: 353.6 kB

Release files / sambacc-0.10.tar.gz

Download URL sambacc-0.10.tar.gz
Size 181.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b315e264c12cb9e018226774067605f5c3502537d1f4d58267d52973de27a3f0
BLAKE2b-256 checksum
How to use checksums
2bd907da43973b642c6c1348186ade04b677020646e9ea6e71af5a469f86a329
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Release files / sambacc-0.10-py3-none-any.whl

Download URL sambacc-0.10-py3-none-any.whl
Size 172.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98239f512bfd407f6e7c6a7160e32f924cd854335978bf6ca5c57dd2c07c762d
BLAKE2b-256 checksum
How to use checksums
6403b40ad01cb4816feff98341cb94ca96aded5416ab836855a28bd92a7dde51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Security for sambacc 0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page