diegogslomp / samba-ad-dc

🐳 Docker image of samba domain controller compiled from source
https://hub.docker.com/r/diegogslomp/samba-ad-dc
GNU General Public License v3.0
48 stars 19 forks source link

Added option for bootstrapping with users and ldaputils to dockerfiles #7

Closed Static-Flow closed 1 year ago

Static-Flow commented 1 year ago

Hi! Found your docker setup for samba-ad-dc and have been using it for the dev environment for a project so thanks for releasing this! While using it I found it useful to add a way to seed Active Directory with users during startup so I thought I'd make a PR in case you wanted to integrate it! Additionally, I added the ldap-utils package to all the dockerfiles for easy ldap debugging inside the container.

The way the bootstrapping works is it parses a JSON structure of "users" and "groups" like so:

{
    "users":[
        {"groups":["Alfred_Users"],"name":"user","password":"StrongUserPassword1!"},
        {"groups":["Alfred_Users","Alfred_PMs"],"name":"manager","password":"StrongUserPassword1!"}
    ],
    "groups":[
        "Alfred_Users",
        "Alfred_PMs"
    ]
}

then bash loops through the records and first creates the groups then the users with the samba-tool command.

diegogslomp commented 1 year ago

Hello!

Thank you for this PR!

Good idea to add LDAP as default with no TLS, I'll be adding it in the next image with some queries in the samba-tests script.

About the bind interfaces, you can remove the BIND_NETWORK_INTERFACES env var flag when using docker network mode. If you don't bind interfaces using network mode the docker ip will be delivered to the clients instead of the host ip, the flag is used in the samba-domain-provision and samba-domain-join scripts.

PS: Nice work with the jq parsed data loops