Skip to content

Experimental samba-in-containers config tool

License

Notifications You must be signed in to change notification settings

ulkuderner/sambacc

 
 

Repository files navigation

sambacc - A Samba Container Configuration Tool

About

The sambacc is an young project that aims to consolidate and coordinate configuration of Samba, and related components, when running in a container. The configuation of one or many instances can be provided to the tool by way of a JSON file which then handles the low level details of actually configuring smbd and other elements in 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 mainly to automate all of the low level steps of setting up smbd, users, groups, and other supporting components. The tool is also designed to consume one "site-wide" configuration file 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.

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

Usage

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

For complete usage, run:

samba-container --help

Features

  • Abstracts away some of the nitty-gritty details about what Samba expects in it's environment
  • Imports specific smb.conf settings from "site wide" JSON configuration.
  • Imports users and groups
  • Starts smbd with container friendly settings
  • Starts winbindd with container friendly settings
  • Primitive and insecure support for joining AD

TODO

A lot. Important features that are missing include:

  • The ability to manage more secure domain joins
  • Better coordination around dependent actions, like being joined
  • Better integration (as opposed to unit) testing
  • (Possibly) CTDB integration for scale out use cases

Install

Currently 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 setup.py install --user

The typical setup.py commands should work.

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 test can be run locally.

Containerized testing

In addition to running the unit tests locally, I've created a container image for testing and building sambacc. It lives at ./tests/container. This is 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.

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:

About

Experimental samba-in-containers config tool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.8%
  • Shell 2.2%