Browse Source

Enalbe ldap auth for webdav

Johannes Zellner 9 năm trước cách đây
mục cha
commit
be7136ff3b
2 tập tin đã thay đổi với 15 bổ sung4 xóa
  1. 10 4
      apache2-app.conf
  2. 5 0
      start.sh

+ 10 - 4
apache2-app.conf

@@ -14,13 +14,19 @@
         </IfModule>
     </Directory>
 
+    ### WARNING the following lines will be updated dynamically by start.sh
     Alias /webdav /app/data/public
 
     <Location /webdav>
         DAV on
-        #AuthType Basic
-        #AuthName "webdav"
-        #AuthUserFile /etc/apache2/webdav.password
-        #Require valid-user
+        AuthType Basic
+        AuthBasicProvider ldap
+        AuthName "Cloudron Authorization"
+        AuthLDAPURL ldap://url/basedn?username??(objectclass=user)
+        AuthLDAPBindDN abouttochange
+        AuthLDAPBindPassword abouttochange
+        Require valid-user
     </Location>
+    ### WARNING END
+
 </VirtualHost>

+ 5 - 0
start.sh

@@ -12,6 +12,11 @@ if [ ! -f "/app/data/apache2-app.conf" ]; then
     cp /app/code/apache2-app.conf /app/data/apache2-app.conf
 fi
 
+sed -e "s@AuthLDAPURL .*@AuthLDAPURL ${LDAP_URL}/${LDAP_USERS_BASE_DN}?username??(objectclass=user)@" \
+    -e "s@AuthLDAPBindDN .*@AuthLDAPBindDN ${LDAP_BIND_DN}@" \
+    -e "s@AuthLDAPBindPassword .*@AuthLDAPBindPassword ${LDAP_BIND_PASSWORD}@" \
+    -i /app/data/apache2-app.conf
+
 chown -R www-data:www-data /app/data /run/app
 
 echo "Starting apache"