Johannes Zellner hace 9 años
padre
commit
7a4b406b70
Se han modificado 5 ficheros con 43 adiciones y 9 borrados
  1. 2 1
      CloudronManifest.json
  2. 8 0
      build.sh
  3. 1 0
      conf.json
  4. 19 0
      local.py
  5. 13 8
      start.sh

+ 2 - 1
CloudronManifest.json

@@ -10,7 +10,8 @@
   "addons": {
     "localstorage": {},
     "sendmail": {},
-    "postgresql": {}
+    "postgresql": {},
+    "ldap": {}
   },
   "minBoxVersion": "0.0.1",
   "manifestVersion": 1,

+ 8 - 0
build.sh

@@ -18,3 +18,11 @@ easy_install pip
 echo "install taiga deps"
 cd /app/code/taiga-back
 pip install -r requirements.txt
+
+echo "install taiga-contrib-ldap-auth"
+pip install taiga-contrib-ldap-auth
+
+echo "run migration scripts"
+cd /app/code/taiga-back
+python manage.py collectstatic --noinput
+python manage.py compilemessages

+ 1 - 0
conf.json

@@ -9,6 +9,7 @@
     "privacyPolicyUrl": null,
     "termsOfServiceUrl": null,
     "maxUploadFileSize": null,
+    "loginFormType": "ldap",
     "contribPlugins": []
 }
 

+ 19 - 0
local.py

@@ -37,3 +37,22 @@ DATABASES = {
         "PORT": "",
     }
 }
+
+INSTALLED_APPS += ["taiga_contrib_ldap_auth"]
+
+LDAP_SERVER = "ldap://ldap.example.com"
+LDAP_PORT = 389
+
+# Full DN of the service account use to connect to LDAP server and search for login user's account entry
+# If LDAP_BIND_DN is not specified, or is blank, then an anonymous bind is attempated
+LDAP_BIND_DN = ""
+LDAP_BIND_PASSWORD = ""
+# Starting point within LDAP structure to search for login user
+LDAP_SEARCH_BASE = "OU=DevTeam,DC=example,DC=net"
+# LDAP property used for searching, ie. login username needs to match value in sAMAccountName property in LDAP
+LDAP_SEARCH_PROPERTY = "sAMAccountName"
+LDAP_SEARCH_SUFFIX = None # '@example.com'
+
+# Names of LDAP properties on user account to get email and full name
+LDAP_EMAIL_PROPERTY = "mail"
+LDAP_FULL_NAME_PROPERTY = "displayname"

+ 13 - 8
start.sh

@@ -5,19 +5,26 @@
 echo "========= Start ========="
 
 echo "local.py"
+# toplevel variables
 sed -e "s/MEDIA_URL = \".*\"/MEDIA_URL = \"https:\/\/${HOSTNAME}\/media\/\"/" \
     -e "s/STATIC_URL = \".*\"/STATIC_URL = \"https:\/\/${HOSTNAME}\/static\/\"/" \
     -e "s/ADMIN_MEDIA_PREFIX = \".*\"/ADMIN_MEDIA_PREFIX = \"https:\/\/${HOSTNAME}\/static\/admin\/\"/" \
     -e "s/SITES\[\"front\"\]\[\"scheme\"\] = \".*\"/SITES\[\"front\"\]\[\"scheme\"\] = \"https\"/" \
     -e "s/SITES\[\"front\"\]\[\"domain\"\] = \".*\"/SITES\[\"front\"\]\[\"domain\"\] = \"${HOSTNAME}\"/" \
-    -e "s/\"NAME\": \".*\",/\"NAME\": \"${POSTGRESQL_DATABASE}\",/" \
+    -e "s/EMAIL_HOST = \".*\"/EMAIL_HOST = \"${MAIL_SMTP_SERVER}\"/" \
+    -e "s/EMAIL_PORT = \".*\"/EMAIL_PORT = \"${MAIL_SMTP_PORT}\"/" \
+    -e "s/EMAIL_HOST_USER = \".*\"/EMAIL_HOST_USER = \"${MAIL_SMTP_USERNAME}\"/" \
+    -e "s/LDAP_SERVER = \".*\"/LDAP_SERVER = \"ldap:\/\/${LDAP_SERVER}\"/" \
+    -e "s/LDAP_PORT = .*/LDAP_PORT = ${LDAP_PORT}/" \
+    -e "s/LDAP_SEARCH_BASE = \".*\"/LDAP_SEARCH_BASE = \"${LDAP_USERS_BASE_DN}\"/" \
+    -i /app/code/taiga-back/settings/local.py
+
+# object properties
+sed -e "s/\"NAME\": \".*\",/\"NAME\": \"${POSTGRESQL_DATABASE}\",/" \
     -e "s/\"USER\": \".*\",/\"USER\": \"${POSTGRESQL_USERNAME}\",/" \
     -e "s/\"PASSWORD\": \".*\",/\"PASSWORD\": \"${POSTGRESQL_PASSWORD}\",/" \
     -e "s/\"HOST\": \".*\",/\"HOST\": \"${POSTGRESQL_HOST}\",/" \
     -e "s/\"PORT\": \".*\",/\"PORT\": \"${POSTGRESQL_PORT}\",/" \
-    -e "s/\"EMAIL_HOST\": \".*\",/\"EMAIL_HOST\": \"${MAIL_SMTP_SERVER}\",/" \
-    -e "s/\"EMAIL_PORT\": \".*\",/\"EMAIL_PORT\": \"${MAIL_SMTP_PORT}\",/" \
-    -e "s/\"EMAIL_HOST_USER\": \".*\",/\"EMAIL_HOST_USER\": \"${MAIL_SMTP_USERNAME}\",/" \
     -i /app/code/taiga-back/settings/local.py
 
 echo "update conf.json"
@@ -35,11 +42,9 @@ source /app/code/taiga/bin/activate
 echo "run migration scripts"
 cd /app/code/taiga-back
 python manage.py migrate --noinput
-python manage.py loaddata initial_user
+# python manage.py loaddata initial_user
 python manage.py loaddata initial_project_templates
-python manage.py loaddata initial_role
-python manage.py collectstatic --noinput
-python manage.py compilemessages
+# python manage.py loaddata initial_role
 
 cd /app/code