Sign inSign up

bostongov/ldap-sampling

By bostongov

•Updated about 7 years ago

Image
1

247

bostongov/ldap-sampling repository overview

⁠COB OpenLDAP Docker Image for testing

⁠Based on 'rroemhild' Docker⁠ LDAP Testing Server Repo⁠

⁠Usage

# Docker Image:
docker pull bostongov/ldap-sampling
docker run --privileged -d -p 389:389 bostongov/ldap-sampling

# OR

# Repo: Use this method if you plan on running the node server
git clone [email protected]:CityOfBoston/ldap-sampling.git
# cd into the directory
docker build -t ldap-mock-1 --no-cache . && docker run --privileged -d -p 389:389 --name ldap-mock-1 ldap-mock-1

⁠Requests

# Search on `CN`
ldapsearch -x -H ldap://localhost:388 -b "dc=boston,dc=cob" '(cn=000296)'
# The request above request all and filters by the provided 'cn'
# ----
# filter: (cn=000296)
# requesting: ALL
# ----
# -b basedn  base dn for search: "dc=boston,dc=cob"


# Add User
ldapadd -x -D cn=admin,dc=boston,dc=cob -H ldap://localhost:388 -w 'GoodNewsEveryone' <<!
dn: cn=Celes Chere, cn=Internal Users,dc=boston,dc=cob
objectClass: inetorgperson
objectClass: top
objectClass: organizationalPerson
objectClass: person
employeetype: Full-Time
mail: [email protected]
sn: Chere
givenname: Celes
cn: Celes Chere
uid: Celes Chere
!
# Binding DN: 'cn=admin,dc=boston,dc=dob'
# Group/Ldap Password: -w 'GoodNewsEveryone'
# Fields between <<! and ! set the entries attributes

# Modify Group, add new member 'uniqueMember'
ldapmodify -x -D cn=admin,dc=boston,dc=cob -H ldap://localhost:388 -w 'GoodNewsEveryone' <<!
dn: cn=ANML02_LostFound,cn=Lagan_Groups,cn=Groups,dc=boston,dc=cob
changetype: modify
add: uniquemember
uniquemember: cn=132367,cn=Internal Users,dc=boston,dc=cob
!

⁠LDAP JS

We use ldapjs⁠ to interact with the Active Directory System we just stood up with Docker. We use Hapi.js to standup a node web server at http://localhost:8000⁠. These are some of the commands that can be run against ldapjs to fetch and modify Groups.

⁠Postman Workspace⁠

# POST Fetch All Groups: localhost:8000/manage-groups/search/groups
curl --location --request POST "localhost:8000/manage-groups/search/groups" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data "filter=%28objectClass%3DgroupOfUniqueNames%29&attributes=%20dc%2Ccn%2CuniqueMember"

# POST Get Groups by name (3 letter min): localhost:8000/manage-groups/search/groups
curl --location --request POST "localhost:8000/manage-groups/search/groups" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data "filter=%28%26%28objectClass%3DgroupOfUniqueNames%29%28cn%3DBP*%29%29&attributes=%20dc%2Ccn%2CuniqueMember"

# POST Find User by 'cn': localhost:8000/manage-groups/search/person
curl --location --request POST "localhost:8000/manage-groups/search/person" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data "filter=%28%26%28objectClass%3DorganizationalPerson%29%28cn%3DLag*%29%29"

# POST Find User by 'displayName': localhost:8000/manage-groups/search/person
curl --location --request POST "localhost:8000/manage-groups/search/person" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data "filter=%28%26%28objectClass%3DorganizationalPerson%29%28cn%3DLag*%29%29"

# PATCH Add uniqueMember - localhost:8000/manage-groups/update/group
curl --location --request PATCH "localhost:8000/manage-groups/update/group" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data "dn=cn%3DBPD_Administrative%2Ccn%3DLagan_Groups%2Ccn%3DGroups%2Cdc%3Dboston%2Cdc%3Dcob&operation=add&uniqueMember=cn%3DFreya%20Crescent%2Ccn%3DInternal%20Users%2Cdc%3Dboston%2Cdc%3Dcob"

# PATCH Delete Group uniqueMember - localhost:8000/manage-groups/update/group
curl --location --request PATCH "localhost:8000/manage-groups/update/group" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data "dn=cn%3DBPD_Administrative%2Ccn%3DLagan_Groups%2Ccn%3DGroups%2Cdc%3Dboston%2Cdc%3Dcob&operation=delete&uniqueMember=cn%3DFreya%20Crescent%2Ccn%3DInternal%20Users%2Cdc%3Dboston%2Cdc%3Dcob"


⁠LDAP structure

⁠Base DN: dc=boston,dc=cob
AdminSecret
cn=admin,dc=boston,dc=cobGoodNewsEveryone

⁠Internal Users

⁠Internal Users: cn=Internal Users,dc=boston,dc=cob
⁠cn=000296,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cn000296
snHoward
displayNameTerra Howard
givenNameTerra
mail[email protected]⁠
uid000296
⁠cn=050086,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cn050086
snPalazzo
displayNameKefka Palazzo
givenNameKefka
mail[email protected]⁠
uid050086
⁠cn=052947,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cn052947
snHarvey
displayNameCecil Harvey
givenNameCecil
mail[email protected]⁠
uid052947
⁠cn=053342,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cn053342
snGainsborough
displayNameAeris Gainsborough
givenNameAeris
mail[email protected]⁠
uid053342
⁠cn=053355,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cn053355
snFair
displayNameZack Fair
givenNameZack
mail[email protected]⁠
uid053355
⁠cn=054363,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cn054363
snWallace
displayNameBarret Wallace
givenNameBarret
mail[email protected]⁠
uid054363
⁠cn=081782,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cn081782
snTrepe
displayNameQuistis Trepe
givenNameQuistis
mail[email protected]⁠
uid081782
⁠cn=087028,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cn087028
snValentine
displayNameVincent Valentine
givenNameVincent
mail[email protected]⁠
uid087028
⁠cn=097738,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cn097738
snOrunitia
displayNameVivi Orunitia
givenNameVivi
mail[email protected]⁠
uid097738
⁠cn=100992,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cn100992
snHeartilly
displayNameRinoa Heartilly
givenNameRinoa
mail[email protected]⁠
uid100992
⁠cn=132367,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cn132367
snStrife
displayNameCloud Strife
givenNameCloud
mail[email protected]⁠
uid132367
⁠cn=143523,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cn143523
snTribal
displayNameZidane Tribal
givenNameZidane
mail[email protected]⁠
uid143523
⁠cn=Celes Chere,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cnCeles Chere
snTribal
displayNameCeles Chere
givenNameCeles
mail[email protected]⁠
uidCeles Chere
⁠cn=Edea Kramer,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cnEdea Kramer
snKramer
displayNameEdea Kramer
givenNameEdea
mail[email protected]⁠
uidEdea Kramer
⁠cn=Freya Crescent,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cnEdea Kramer
snKramer
displayNameEdea Kramer
givenNameEdea
mail[email protected]⁠
uidEdea Kramer
⁠cn=Garnet Alexandros,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cnEdea Kramer
snAlexandros
displayNameGarnet Alexandros
givenNameGarnet
mail[email protected]⁠
uidGarnet Alexandros
⁠cn=Ignis Scientia,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cnIgnis Scientia
snScientia
displayNameIgnis Scientia
givenNameIgnis
mail[email protected]⁠
uidIgnis Scientia
⁠cn=Laguna Loire,ou=Internal Users,dc=boston,dc=cob
AttributeValue
objectClassinetOrgPerson
cnLaguna Loire
snScientia
displayNameLaguna Loire
givenNameIgnis
mail[email protected]⁠
uidIgnis Scientia

Tag summary

Content type

Image

Digest

Size

37.6 MB

Last updated

about 7 years ago

docker pull bostongov/ldap-sampling