mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-30 23:38:13 +02:00
Renamed the mariadb, openldap and postgres database
This commit is contained in:
72
roles/svc-db-openldap/docs/Administration.md
Normal file
72
roles/svc-db-openldap/docs/Administration.md
Normal file
@@ -0,0 +1,72 @@
|
||||
# Administration
|
||||
|
||||
## Configuration
|
||||
|
||||
## Load env
|
||||
|
||||
To use the following commands firs load the env:
|
||||
```bash
|
||||
export $(grep -v '^[[:space:]]*#' ./.env/env \
|
||||
| sed -E 's/#.*$//; /^[[:space:]]*$/d; s/^[[:space:]]*//; s/[[:space:]]*$//; s/[[:space:]]*=[[:space:]]*/=/' \
|
||||
| xargs)
|
||||
```
|
||||
|
||||
### Show Configuration
|
||||
```bash
|
||||
docker exec -it ldap bash -c "ldapsearch -LLL -Y EXTERNAL -H ldapi:/// -b 'cn=config'"
|
||||
```
|
||||
|
||||
```bash
|
||||
docker exec -it ldap bash -c "ldapsearch -LLL -Y EXTERNAL -H ldapi:/// -b 'cn=config' -s base '(objectClass=*)'"
|
||||
```
|
||||
|
||||
```bash
|
||||
docker exec -it ldap bash -c "ldapsearch -LLL -Y EXTERNAL -H ldapi:/// -b 'cn=config' -s base '(objectClass=olcModuleList)'"
|
||||
```
|
||||
|
||||
### Databases Overview
|
||||
```bash
|
||||
docker exec -it ldap ldapsearch -Y EXTERNAL -H ldapi:/// -b "cn=config" "(olcDatabase=*)"
|
||||
```
|
||||
|
||||
## Data
|
||||
|
||||
### Set Credentials
|
||||
To execute the following commands set the credentials via:
|
||||
|
||||
```bash
|
||||
eval $(
|
||||
grep -v '^\s*#' .env/env \
|
||||
| sed -E 's/\s*#.*//' \
|
||||
| sed -E 's/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)\s*$/export \1="\2"/'
|
||||
)
|
||||
```
|
||||
|
||||
### Show all Entries
|
||||
```bash
|
||||
docker exec -it ldap bash -c "ldapsearch -LLL -o ldif-wrap=no -x -D \"\$LDAP_ADMIN_DN\" -w \"\$LDAP_ADMIN_PASSWORD\" -b \"\$LDAP_ROOT\"";
|
||||
```
|
||||
|
||||
### Delete Groups and Subgroup
|
||||
To delete the group inclusive all subgroups use:
|
||||
```bash
|
||||
docker exec -it ldap bash -c "ldapsearch -LLL -o ldif-wrap=no -x -D \"\$LDAP_ADMIN_DN\" -w \"\$LDAP_ADMIN_PASSWORD\" -b \"ou=applications,ou=groups,\$LDAP_ROOT\" dn | sed -n 's/^dn: //p' | tac | while read -r dn; do echo \"Deleting \$dn\"; ldapdelete -x -D \"\$LDAP_ADMIN_DN\" -w \"\$LDAP_ADMIN_PASSWORD\" \"\$dn\"; done"
|
||||
|
||||
# Works
|
||||
docker exec -it ldap \
|
||||
ldapdelete -x \
|
||||
-D "$LDAP_ADMIN_DN" \
|
||||
-w "$LDAP_ADMIN_PASSWORD" \
|
||||
-r \
|
||||
"ou=groups,$LDAP_ROOT"
|
||||
```
|
||||
|
||||
## Import RBAC
|
||||
```bash
|
||||
docker exec -i ldap \
|
||||
ldapadd -x \
|
||||
-D "$LDAP_ADMIN_DN" \
|
||||
-w "$LDAP_ADMIN_PASSWORD" \
|
||||
-c \
|
||||
-f "/tmp/ldif/data/01_rbac.ldif"
|
||||
```
|
Reference in New Issue
Block a user