Giter VIP home page Giter VIP logo

smblds-container's Introduction

Container image for smblds

Build OCI image Docker pulls OCI image size CodeFactor Grade

About

Source files and build instructions for an OCI image (compatible with e.g. Docker or Podman) to mimic Active Directory Lightweight Directory Services (AD LDS) using Samba more or less. AD LDS is an independent mode of Active Directory, minus infrastructure features (such as Kerberos KDC, Group Policies or DNS SRV records), that provides directory services for applications.

This “Samba (Active Directory) Lightweight Directory Services” container image is primarily intended for developers and CI/CD use cases. As such, the Samba AD DC configuration has been reduced to a bare minimum of run-time components to enable applications to access an LDAP service that feels and behaves like the one of a Samba AD DC, but without the overhead of a full Active Directory Domain Controller.

Usage

The OCI image automatically provisions and starts a lightweight Samba AD DC, if a valid configuration has been provided. It may be started with Docker using:

docker run --name smblds \
           --publish 389:389 \
           --publish 636:636 \
           --detach smblds/smblds:latest

And it may be started with Podman using:

podman run --name smblds \
           --publish 389:389 \
           --publish 636:636 \
           --detach quay.io/smblds/smblds:latest

Volumes

  • /entrypoint.d - Optional directory for customization scripts, any executable file is run before the start of the Samba daemon.
  • /etc/dropbear - Optional directory containing the SSH host keys for the Dropbear SSH server.
  • /etc/samba - Directory where, during the first run, the entrypoint script saves the default configuration file for the Samba daemon.
  • /root - Directory where, during the first run, the entrypoint script saves the configuration files for ldapadd, ldapvi, ldapmodify, ldapsearch etc. as well as optional SSH authorized keys.
  • /var/cache/samba - Directory where the Samba daemon writes its internal semi-persistent/run-time data into.
  • /var/lib/samba - Directory where the Samba daemon writes its internal *.tdb database files and the LDAP data into.
  • /var/log/samba - Directory where, if optionally configured, the Samba daemon writes its log files into.

While the typical developer and CI/CD use cases usually don't require persistent storage, /entrypoint.d might be handy for customization scripts that contain e.g. samba-tool user create.

Environment Variables

  • TZ - Time zone according to IANA's time zone database, e.g. Europe/Amsterdam, defaults to UTC.
  • REALM - Kerberos realm, the uppercase version of the AD DNS domain, defaults to SAMDOM.EXAMPLE.COM.
  • DOMAIN - NetBIOS domain name (workgroup), single word up to 15 characters without a dot, defaults to SAMDOM.
  • ADMINPASS - Domain administrator password, needs to match complexity requirements, defaults to Passw0rd.
  • INSECURE_LDAP - Set to true to allow simple LDAP binds over unencrypted connections, defaults to false.
  • INSECURE_PASSWORDSETTINGS - Set to true to disable ADMINPASS complexity requirements, defaults to false.
  • SSH_AUTHORIZED_KEYS - SSH public key(s) to enable SSH access to the container, e.g. for complex scenarios.
  • SERVER_SERVICES - Override option for the services that the Samba daemon will run, defaults to ldap cldap.

Exposed Ports

  • 22 - TCP port for optional SSH access to the container, requires SSH_AUTHORIZED_KEYS to be set.
  • 389 - TCP port for LDAP access (STARTTLS or plaintext if INSECURE_LDAP is enabled).
  • 389/udp - UDP port for optional CLDAP (Connection-less LDAP) access, usually not needed.
  • 636 - TCP port for LDAPS access (mandatory SSL/TLS encryption).
  • 3268 - TCP port for optional LDAP access to Global Catalog (STARTTLS or plaintext if INSECURE_LDAP is enabled).
  • 3269 - TCP port for optional LDAPS access to Global Catalog (mandatory SSL/TLS encryption).

Pipeline / Workflow

Docker Hub and Quay can both automatically build OCI images from a linked GitHub account and automatically push the built image to the respective container repository. However, as of writing, this leads to OCI images for only the amd64 CPU architecture. To support as many CPU architectures as possible (currently 386, amd64, arm/v6, arm/v7, arm64/v8, ppc64le, riscv64 and s390x), GitHub Actions are used. There, the current standard workflow "Build and push OCI image" roughly uses first a GitHub Action to install QEMU static binaries, then a GitHub Action to set up Docker Buildx and finally a GitHub Action to build and push Docker images with Buildx.

Thus the OCI images are effectively built within the GitHub infrastructure (using free minutes for public repositories) and then only pushed to both container repositories, Docker Hub and Quay (which are also free for public repositories). This not only saves repeated CPU resources but also ensures identical bugs independent from which container repository the OCI image gets finally pulled (and somehow tries to keep it distant from program changes such as Docker Hub Rate Limiting in 2020). The authentication for the pushes to the container repositories happen using access tokens, which at Docker Hub need to be bound to a (community) user and at Quay using a robot account as part of the organization. These access tokens are saved as "repository secrets" as part of the settings of the GitHub project.

Commits to Git trigger the workflow and lead to updated OCI images being pushed (except for GitHub pull requests) to public container image registries. Additionally, a cron-like option in the workflow leads to a daily updated OCI image.

License

This project is licensed under the GNU General Public License, version 3 or later - see the LICENSE file for details.

As with all OCI images, these also contain other software under other licenses (such as BusyBox, OpenLDAP, Python, Samba etc. from the base distribution, along with any direct or indirect dependencies).

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

smblds-container's People

Contributors

dependabot[bot] avatar robert-scheck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dolzenko

smblds-container's Issues

Loading test data - any adivice?

First of all - big thank you for this, very useful. Now to my question: I'm using this in test environment and assuming I want to load this with some data - how can I do this? One way is a bash script with samba-tool user add ... commands, works fine, until you need to use the SIDs which will differ on every container run (possibly). Is there any other solution I'm missing? Is it possible to add some parameter which will make SIDs generated by Samba stable/predictable?

Docker is sunsetting Free Team organizations

As also mentioned at docker/hub-feedback#2314, Docker is sunsetting Free Team organizations at April 13th, 2023. The initial notification was sent by Docker via e-mail yesterday.

Docker expects users switching to their paid Docker plans, alternatively there is a "specific Docker-Sponsored Open Source (DSOS) program for open-source projects" for which this project might or might not be eligible.

In difference to some other projects, all container images are pushed since ever to Docker Hub and Quay.io. It could be worth considering GHCR additionally.

Can't run ldapmodify from customization script

Currently customization scripts (placed in /entrypoint.d/ volume) run before Samba starts, but that means one can't use e.g.ldapmodify from such a script (it expects running server). It appears as one can use ldbmodify (from ldb-tools package) to modify the database directly. So my question is - would you consider adding this to your image? Seems like a useful addition since many manuals online provide examples on how to use ldbmodify to update Samba database. On other hand we can probably provide another mountpoint for scripts to run after the Samba is started.

Hello!tihs is not bug ,How to use smblds with Docker on NAS?(你好这不是bug,怎么在nas上的docker使用smblds)

I'm trying to use the Docker image (https://hub.docker.com/r/smblds/smblds) on my NAS, but there are many configurations to be made, and I couldn't find the default ports 455, 137, 139. As a beginner, how should I proceed? I'm mostly concerned about the port mapping, shared directories, and the startup command that doesn't require admin privileges. In fact, you don't need to worry about the NAS itself, as the important parameters to consider are the port mapping, shared directories, and non-admin startup command.
Can the documentation be more detailed? The parameters shown in the image below are required by default, but I have no idea what they mean, so I don't even know where to map the main directory.
image
image
我在nas上使用docker 镜像(https://hub.docker.com/r/smblds/smblds)
发现要配置的东西比较多,甚至默认的端口455,137,139都没看到。我是个小白应当如何使用,实际上你不需要关注nas,nas上比较关心的参数是要映射的端口号,要共享的目录,以及不涉及管理员权限的启动命令。
说明文档能够更详细点吗,我下面图片上的参数是默认出来必填的,我根本不知道他的意思,所以连映射主目录在哪都不知道

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.