homeserver/docker-compose/nextcloud_ldap/ldap.sh

50 lines
2.3 KiB
Bash
Raw Normal View History

2024-05-31 14:30:16 +02:00
#!/bin/bash
# Vorraussetzungen siehe https://github.com/lldap/lldap/blob/main/example_configs/nextcloud.md
# lldap_bind_user=nextcloud_bind_user
# lldap_bind_user_pass="{{ lookup('keepass', 'nextcloud_lldap_bind_user_pass', 'password') }}"
# lldap_bind_user_groups=lldap_strict_readonly
2024-05-31 14:35:20 +02:00
occ app:install user_ldap
occ app:enable user_ldap
occ ldap:create-empty-config
2024-05-31 14:30:16 +02:00
# EDIT: domain
2024-05-31 14:35:20 +02:00
occ ldap:set-config s01 ldapHost "ldap://ldap.mgrote.net."
occ ldap:set-config s01 ldapPort 3890
2024-05-31 14:30:16 +02:00
# EDIT: admin user
2024-05-31 14:35:20 +02:00
occ ldap:set-config s01 ldapAgentName "uid=nextcloud_bind_user,ou=people,dc=mgrote,dc=net"
2024-05-31 14:30:16 +02:00
# EDIT: password
2024-05-31 14:35:20 +02:00
occ ldap:set-config s01 ldapAgentPassword "{{ lookup('keepass', 'nextcloud_lldap_bind_user_pass', 'password') }}"
2024-05-31 14:30:16 +02:00
# EDIT: Base DN
2024-05-31 14:35:20 +02:00
occ ldap:set-config s01 ldapBase "dc=mgrote,dc=net"
occ ldap:set-config s01 ldapBaseUsers "dc=mgrote,dc=net"
occ ldap:set-config s01 ldapBaseGroups "dc=mgrote,dc=net"
occ ldap:set-config s01 ldapConfigurationActive 1
occ ldap:set-config s01 ldapLoginFilter "(&(objectclass=person)(uid=%uid))"
2024-05-31 14:30:16 +02:00
# EDIT: nextcloud group, contains the users who can login to Nextcloud
2024-05-31 14:35:20 +02:00
occ ldap:set-config s01 ldapUserFilter "(&(objectclass=person)(memberOf=cn=nextcloud,ou=groups,dc=mgrote,dc=net))"
occ ldap:set-config s01 ldapUserFilterMode 0
occ ldap:set-config s01 ldapUserFilterObjectclass person
occ ldap:set-config s01 turnOnPasswordChange 0
occ ldap:set-config s01 ldapCacheTTL 600
occ ldap:set-config s01 ldapExperiencedAdmin 0
occ ldap:set-config s01 ldapGidNumber gidNumber
occ ldap:set-config s01 ldapGroupMemberAssocAttr uniqueMember
occ ldap:set-config s01 ldapEmailAttribute "mail"
occ ldap:set-config s01 ldapLoginFilterEmail 0
occ ldap:set-config s01 ldapLoginFilterUsername 1
occ ldap:set-config s01 ldapMatchingRuleInChainState unknown
occ ldap:set-config s01 ldapNestedGroups 0
occ ldap:set-config s01 ldapPagingSize 500
occ ldap:set-config s01 ldapTLS 0
occ ldap:set-config s01 ldapUserAvatarRule default
occ ldap:set-config s01 ldapUserDisplayName displayname
occ ldap:set-config s01 ldapUserFilterMode 1
occ ldap:set-config s01 ldapUuidGroupAttribute auto
occ ldap:set-config s01 ldapUuidUserAttribute auto
occ ldap:set-config s01 ldapExpertUsernameAttr user_id
2024-05-31 14:30:16 +02:00
# diese script als template und als jinja fur l+oakles ausführenr ein templaten, oder vllt direkt als hook script