Skip to content

Commit

Permalink
created anonymous binding database + test
Browse files Browse the repository at this point in the history
  • Loading branch information
babagreensheep authored and ViViDboarder committed Jan 22, 2025
1 parent c554c8a commit daade33
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,24 @@ itest: itest-up itest-run itest-stop
.PHONY: itest-up-anon
itest-up-anon:
docker compose -f docker-compose.yml \
-f itest/docker-compose.itest.yml \
-f itest/docker-compose.itest-anon.yml \
build
docker compose -f docker-compose.yml \
-f itest/docker-compose.itest.yml \
-f itest/docker-compose.itest-anon.yml \
up -d vaultwarden ldap

.PHONY: itest-run-anon
itest-run-anon:
docker compose -f docker-compose.yml \
-f itest/docker-compose.itest.yml \
run ldap_sync
-f itest/docker-compose.itest-anon.yml \
run --rm ldap_sync

.PHONY: itest-stop-anon
itest-stop-anon:
docker compose stop

.PHONY: itest-anon
itest: itest-up-anon itest-run-anon itest-stop-anon
itest-anon: itest-up-anon itest-run-anon itest-stop-anon

# Run bootstrapped integration test using env for config
.PHONY: itest-env
Expand Down
8 changes: 8 additions & 0 deletions itest/config-anon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
vaultwarden_url = "http://vaultwarden:80"
vaultwarden_admin_token = "admin"
ldap_host = "ldap"
# ldap_bind_dn = "cn=readonly,dc=example,dc=org"
# ldap_bind_password = "readonly"
ldap_search_base_dn = "dc=example,dc=org"
ldap_search_filter = "(&(objectClass=*)(uid=*))"
ldap_sync_loop = false
3 changes: 2 additions & 1 deletion itest/docker-compose.itest-anon-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ services:
ldap:
command: ["--copy-service"]
volumes:
- ./itest/50-seed-user.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/50-seed-user.ldif
- ./itest/ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom
- ./itest/schema/anon.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/anon.ldif
3 changes: 2 additions & 1 deletion itest/docker-compose.itest-anon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ services:
ldap:
command: ["--copy-service"]
volumes:
- ./itest/50-seed-user.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/50-seed-user.ldif
- ./itest/ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom
- ./itest/schema/anon.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/anon.ldif
Empty file added itest/ldif/anon.ldif
Empty file.
15 changes: 15 additions & 0 deletions itest/schema/anon.ldif
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
dn: olcDatabase={1}mdb,cn=config
changetype: modify
replace: olcAccess
olcAccess: to *
by dn.exact=gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth manage
by * break
olcAccess: to attrs=userPassword,shadowLastChange
by self write
by dn="cn=admin,dc=example,dc=org" write
by anonymous auth
by * none
olcAccess: to *
by anonymous read
by dn="cn=admin,dc=example,dc=org" write
by * none

0 comments on commit daade33

Please sign in to comment.