Experimental samba-in-containers config tool
d6e1262939e5 — John Mulligan default tip 2 years ago
sambacc: add initial support for checking JSON schema of config
0426d0c5878e — John Mulligan master 2 years ago
container: container build based on new home repo
208991d3f2ee — John Mulligan 2 years ago
readme: make github the canonical home for sambacc (sigh)


browse log



#sambacc - A Samba Container Configuration Tool


The sambacc is an experimental project that aims to consolidate configuration of samba, and related components, running in a container. The configuation of one or many containers is provided to the tool as JSON which then handles the low level details of actually configuring smbd and other parts of the container environment.


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 is to first automate all of the low level steps of setting up smbd, users, groups, and other supporting configuration files. The tool is also designed to consume one "global" configuration that can be maintained 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.


When installed a samba-container command will be available.

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

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

Additionally, there are subcommands:

  • 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


Currently the only method of install is from source control.

  • Clone the repo: git clone https://github.com/phlogistonjohn/sambacc
  • cd sambacc
  • Install locally: python setup.py install --user

The typical setup.py commands should work.


  • Run tests: tox


A lot.

Currently, the tool can create (local) users and groups, and configure and start smbd. In the short term it needs much more testing (real-world, not unit) to take it from just a proof-of-concept to something useful. It needs winbind support to make it useful for Active Directory use cases. Potentially, we also want to support scaling out across multiple instances, so we may also need to integrate with ctdb.

The test suite has OKish coverage, but needs to handle more, especially the samba passdb loader module.

Because of the system level dependencies, I've created a container image for testing and building sambacc. It lives at ./tests/container. I'd like to make this the canonical way to run all the tests, locally on the desktop or in CI, but it needs fleshing out.


GPLv3 as per the COPYING file.

This is the same license as used by Samba.


If you're reading this, you're probably one of my coworkers. For now, please email me directly (even if you're not).