Guest mode. You can read posts without signing up. Comments, ratings, job contacts and your own posts open after you sign up and accept the rules. What is Kommit →

Редакция КоммитРедакция портала
commit 2d6a7ca · 10 days ago
Project

ad-testlab: a real domain controller in Docker to check AD services not on MOCs

🌐 Machine-translated from Russian. Show original

ad-testlab is a test bench in the AD Tools series: a real domain controller (Samba AD, domain LAB.TEST) in Docker, pre-filled with plausible organization, and integration tests that run real LDAP code from all 15 services in the series against this controller. Before the stand, services were tested only on mocks and demo data — this was the main risk of the series.

🔒 Since 17.11.2026, the source code of the AD Tools series is provided upon request: leave a request. The showcase of the series is github.com/WorkTime-kz/ad-tools.

Link
🧪ad-testlab — stand, data, and tests
🧩Common core of the series — ad-tools-core
📦Installation of the entire series — ad-tools-suite

In this part:

What's inside#

  • 🖥️ Controller — Samba AD DC (Ubuntu 24.04, Samba 4.19): LDAP, LDAPS, StartTLS, and Kerberos (KDC). The stand itself releases the root CA and LDAPS certificate and publishes out/ca.pem for clients.
  • 🏢 Data — data/lab.json: 38 employees with Russian and Kazakh full names, 6 service accounts, 35 groups with nesting up to 4 levels and managedBy, 12 computers with legacy LAPS and Windows LAPS; disabled and blocked accounts, "password does not expire," "change upon login," delegation of rights to OU. Tests take expected values from the same data.
  • ✅ Tests — by file for the service: login via UPN and LAB\user, page-by-page output, nested groups via 1.2.840.113556.1.4.1941, refusal of disabled, blocked, and out-of-database accounts, npm run check-ldap, and for ad-sspr, ad-onboarding, ad-access, and ad-laps — write to AD.
  • 🔁 CI is a reusable workflow for GitHub Actions: the service connects the booth with a single file, and the booth passwords are test. The series repositories are private, so the run needs a secret AD_TOOLS_TOKEN with only read rights to neighboring repositories; without it, the integration run does not crash but is skipped with an explanation.
  • 🎫 Kerberos — the booth exports keytab for HTTP/web.lab.test and krb5.conf for clients. On it, the ad-tools-core kernel checks for SPNEGO login with the real KDC.

Emulator --mock: tests without Docker#

Docker is not available everywhere, so the booth includes a directory emulator. It only replaces ldapts the Node bootloader hook and keeps the directory in memory, while services, their config.js, check-ldap , and tests work as is. Before tests, real population code is executed — schema expansion, plan, blocking with incorrect passwords.

The emulator replicates ldapts response formats, bind over UPN, ДОМЕН\user and DN, incorrect password counter and lock, filters with 803/804/1941rules, tokenGroups, confidential attributes, delegation from data/lab.json, password change with complexity and history checking, and error codes like Windows AD.

What it doesn't do: it doesn't check schema, ACL, TLS, and Kerberos Samba, models rights based on data/lab.jsonrather than real security descriptors, and doesn't know range output and referrals. Green --mock means "tests and services are coordinated with each other," not "works with AD"; the final word is after running on Samba.

What problems did the booth find and how were they solved#

Everything is made of docs/emulator.md, docs/connect-service.md , and docs/samba-vs-windows.md.

ProblemWhereSolution
LDAPTS returns the missing requested attribute as [], and str() converted it into a string "undefined": for an employee without mail, the address became "undefined"ad-onboarding, ad-rooms, ad-absencethe same edit str(): empty value — empty string; fixed in services
ldapts 9.2.0 bug: GUID and SID bytes from 0x80 in the filter are encoded as UTF-8, and the (objectGUID=...) filter does not match on either Samba or Windows AD. The emulator disguised thisad-laps, ad-sspr, ad-access,pass Buffer, not string, in the EqualityFilter for binary attributes
Samba 4.19 by default accepts the old password for another 60 minutes with simple bind (old password allowed period) — the ad-sspr password change test fellstandold password allowed period = 0 smb.conf: the old password is immediately rejected, as in Windows AD; this checks the stand self-check
Re-adding a member to the group: Windows responds with code 68, Samba can respond with 20; removing missing — 53 versus 16services writing to groupstests check idempotency, services catch both codes
Samba does not have SDProp, adminCount ad-audit and privilege checks are not setprivileged accounting is caught by membership, tokenGroups and SID — services should not rely solely on adminCount
The Samba schema does not have LAPSad-laps attributesthe stand adds them itself with the same OID and searchFlags
Samba stores NTACL in thestandcontainer needed privileged

What is deliberately not verified: real Windows clients, forest and trusts (one domain, one DC), replication, AD CS and GPO, large directories, browser SPNEGO.

How to launch#

Docker Engine 24+ with compose and Node.js 22+ are required. Service source codes are placed next to ad-testlab (another location — variable AD_SERVICES_ROOT):

# после получения доступа (репозиторий закрыт, запрос — github.com/WorkTime-kz/ad-tools):
git clone https://github.com/WorkTime-kz/ad-testlab.git && cd ad-testlab
npm ci
node scripts/lab.mjs up              # образ, домен, наполнение: 3–5 минут в первый раз
node scripts/run-tests.mjs --lab     # самопроверка стенда
node scripts/run-tests.mjs --all     # все сервисы, что лежат рядом
node scripts/lab.mjs down --volumes  # удалить домен целиком

Without Docker:

npm test             # 63 юнит-теста: данные, план, SDDL, реестр сервисов, workflow, эмулятор
npm run test:mock    # все 15 сервисов против эмулятора каталога

Connect your service to CI — one file .github/workflows/ad-integration.yml:

jobs:
  ad-testlab:
    uses: WorkTime-kz/ad-testlab/.github/workflows/integration.yml@main
    with:
      service: ad-sspr
    # для приватных репозиториев: секрет AD_TOOLS_TOKEN (см. README ad-testlab)
    secrets: inherit

The run takes about 5–8 minutes. node scripts/lab.mjs env <сервис> --write provides a ready-made service .env for manual work against the stand.

⚠️ The stand is for testing only: passwords in data/lab.json are known to everyone, ports are published only on local addresses. Do not run it on shared servers.

Project status#

  • GPL-3.0 license; source code is available upon request.
  • 63 unit tests are underway (removed on 11/15/2026). The stand has already been launched in GitHub Actions: it has undergone a Kerberos verification of the ad-tools-core kernel.
  • Samba is not Windows Server: the differences are collected in docs/samba-vs-windows.md, and some of them are tracked by the stand through self-checking.

How to help#

  • 🐳 Raise your booth and run the series services — tell us what fell.
  • 🔍 Do you know the differences between Samba AD and Windows AD that aren't in the table? Write in the Issues storefront.
  • ⭐ Place a star in the ad-tools showcase; after gaining access, send pull requests with new checks.

AD Tools Series#

Service projects: ad-tools-core: one core for 15 Active Directory services — LDAP, login, sessions, and dependency free Kerberos.

Services checked by the booth:

  • ad-portal — start page
  • ad-phonebook — telephone directory
  • ad-birthdays — birthdays and anniversaries
  • ad-absence — absence calendar
  • ad-polls — polls and voting
  • ad-certs — certificate expiration dates
  • ad-orgchart — organizational structure
  • ad-rooms — meeting rooms
  • ad-helpdesk — IT requests
  • ad-inventory — equipment accounting
  • ad-onboarding — hiring and firing
  • ad-sspr — password reset
  • ad-laps — local administrator passwords
  • ad-access — access requests
  • ad-audit — AD security audit
  • ad-toolkit-lite — a set of PowerShell scripts

All services are described in the github.com/WorkTime-kz/ad-tools series showcase.

👉 Repository: source code — upon request, leave a request. Series showcase — github.com/WorkTime-kz/ad-tools

Looking for:тестировщики с Dockerзнатоки Samba ADсверка с Windows Server ADконтрибьюторы
Comments 00 участников · 0 гостей🔒 Rate and discuss after signing up

Comments · 0

No comments yet.Sign in to comment, rate and see all comments.