diff --git a/start.sh b/start.sh index f3cda7f..c82d89d 100755 --- a/start.sh +++ b/start.sh @@ -4,27 +4,6 @@ set -eu -o pipefail mkdir -p /run/gitea/tmp/uploads /run/sshd /run/gitea/sessions -setup_ldap_source() { - set -eu - - echo "==> Setup LDAP source" - - # Get the existing LDAP source status. This allows the user to disable LDAP - # Note that this method is deprecated since this app now supports optionalSso - ldap_status=$(mysql -u"${CLOUDRON_MYSQL_USERNAME}" -p"${CLOUDRON_MYSQL_PASSWORD}" -h mysql --database="${CLOUDRON_MYSQL_DATABASE}" -N -B -e "select is_active from login_source WHERE name='cloudron';") - [[ -z "${ldap_status}" ]] && ldap_status="1" - - now=$(date +%s) - - if mysql -u"${CLOUDRON_MYSQL_USERNAME}" -p"${CLOUDRON_MYSQL_PASSWORD}" -h mysql --database="${CLOUDRON_MYSQL_DATABASE}" \ - -e "REPLACE INTO login_source (id, type, name, is_active, cfg, created_unix, updated_unix) VALUES (1,2,'cloudron',${ldap_status},'{\"Name\":\"cloudron\",\"Host\":\"${CLOUDRON_LDAP_SERVER}\",\"Port\":${CLOUDRON_LDAP_PORT},\"UseSSL\":false,\"SkipVerify\":true,\"BindDN\":\"${CLOUDRON_LDAP_BIND_DN}\",\"BindPassword\":\"${CLOUDRON_LDAP_BIND_PASSWORD}\",\"UserBase\":\"${CLOUDRON_LDAP_USERS_BASE_DN}\",\"AttributeUsername\":\"username\",\"AttributeName\":\"displayname\",\"AttributeSurname\":\"\",\"AttributeMail\":\"mail\",\"Filter\":\"(\\\\u007C(mail=%[1]s)(username=%[1]s))\"}','${now}','${now}');"; then - echo "==> LDAP Authentication was setup with activation status ${ldap_status}" - else - echo "==> Failed to setup LDAP authentication" - exit 1 - fi -} - migrate_ldap_users_to_oidc() { set -eu @@ -66,10 +45,6 @@ setup_auth() { echo "==> Gitea is up, setting up auth" - if [[ -n "${CLOUDRON_LDAP_SERVER:-}" ]]; then - setup_ldap_source - fi - if [[ -n "${CLOUDRON_OIDC_ISSUER:-}" ]]; then setup_oidc_source migrate_ldap_users_to_oidc