LDAP/Active Directory - Login Failed

Hi,

I have spun up a Debian 12 vm for use with ownCloud Infinite Scale (latest version).

I have installed OCIS as bare metal with systemd.

OCIS itself works fine apart from there is one major thing which is stopping me from using it.

I have various homelab services and to try and ‘house keep’ a little bit, I would like to use Active Directory (Windows Server 2022) as the Identity Provider for my users.

I have used the example variables for the LDAP setup and I cannot get it to work, the values I think are setup correctly but I cannot get it to work still. Active Directory works fine for my other services so, I know there isn’t a problem with that as such, whatever the issue is, specifically affects OCIS.

Is there anything I am missing? I wanted to be able to create a user in AD, and as soon as they’re created, I wanted OCIS to let them login etc, but this is not the case, no matter what I change, I get a Login Failed error.

I know OCIS is able to talk to my AD server because if I mess with the ldap:// url, I get a HTTP 500 error, if the url is set correctly, I don’t get that error.

I tried looking at the logs (even with the log levels set to debug) but cannot see any errors or anything that resembles any login/ldap errors.

This is abit cheeky, but I wondered if someone could provide me step by step instructions on everything I need to do to get OCIS and Active Directory working? I’ve spent ages browsing the web but cannot find anything, and I love OCIS as a product, so any help in getting this up and running asap is greatly appreciated.

Kind Regards,

Connor

Hi! I’m having the exact same issue here (except for the fact that I am using OpenLDAP instead of AD). Looking through the log files, even if logs are set to “info”, this is the only log message that gets printed when the login button is pressed:

Blockquote
ocis_runtime | {“level”:“info”,“service”:“proxy”,“proto”:“HTTP/1.1”,“request-id”:“77378001dc83/D74VWDspjd-000001”,“remote-addr”:“REDACTED:52587”,“method”:“POST”,“status”:204,“path”:“/signin/v1/identifier/_/logon”,“duration”:14.526593,“bytes”:0,“time”:“2023-11-13T16:36:39.725203265Z”,“line”:“GITHUB/owncloud/ocis/v2/services/proxy/pkg/middleware/accesslog.go:31”,“message”:“access-log”}

Going back through all the log messages filtered for “idp”, there are not unusual messages and it says the ldap backend is properly setup.

Given that just this one message is being printed on login attempt, it’s almost like the “idp” never gets a login request. Anyone encountered this? Any suggestions on how to debug or at least get some more details from logs?

@paladincorners before AD I was using OpenLDAP but could not get that to work either.
Tonight, I am going to setup a new Authentication VM with OpenLDAP and Authelia and just have OCIS talk to Authelia instead

Wish there was a clearer guide on how to set this up as there is documentation in multiple places, but seems like this is now working at least for the admin role.

To debug it, check the logs on your AD or OpenLDAP server for the query being made. Owncloud was checking if the user is enabled using the default field name “ownCloudUserEnabled”. My users do not have that field.

To fix this, required setting the environmental variable OCIS_LDAP_USER_ENABLED_ATTRIBUTE to any field that would resolve to anything other than false. You may have an error elsewhere, but check the logs on the LDAP server.

Now the user was being authenticated, but can an error in the website saying they were logged out and there were errors in the OCIS logs stating that the user roles could not be obtained.

The issue is that you must clearly specify who the admin user is that can login with LDAP. Make sure OCIS_ADMIN_USER_ID, OCIS_LDAP_USER_SCHEMA_USERNAME, OCIS_LDAP_USER_SCHEMA_ID, IDP_LDAP_LOGIN_ATTRIBUTE and IDP_LDAP_UUID_ATTRIBUTE are set correctly.

Hi @paladincorners ,
Can you tell me the OpenLDAP fields you mapped each of the variables to?
I know your fields are going to be different to mine, but it should point me in the right direction at least :slight_smile:

@cjs321 Can you please share your configuration details? Also please share the logs of a failed login attempt with OCIS_LOG_LEVEL set to debug. With that we might be able to figure out what is going wrong.

Hi @rhaferkamp ,

Please see below config, i’ve removed/replaced my domain name for security.


TZ=Europe/London

OCIS_URL=https://mydomain.tech
PROXY_HTTP_ADDR=0.0.0.0:9200
PROXY_TLS=false
OCIS_INSECURE=false

OCIS_LOG_LEVEL=warn

OCIS_CONFIG_DIR=/mnt/CloudData/Config
OCIS_BASE_DATA_PATH=/mnt/CloudData/Data/
OCIS_CORS_ALLOW_ORIGINS=[*]

#Theme Settings
WEB_UI_THEME_SERVER=https://mydomain.tech
WEB_UI_THEME_PATH=/themes/custom/theme.json

#WEBDAV Settings
PROXY_INSECURE_BACKEND=true
PROXY_ENABLE_BASIC_AUTH=true
AUTH_BASIC_AUTH_PROVIDER=ldap
WEBDAV_VENDOR=owncloud
WEBDAV_URL=https://mydomain.tech/remote.php/webdav/
WEBDAV_HTTP_ROOT=/
WEBDAV_DISABLE_PREVIEWS=true
WEBDAV_WEBDAV_NAMESPACE=/users/{{.Id.OpaqueId}}
WEBDAV_CORS_ALLOW_METHODS=[GET POST PUT PATCH DELETE OPTIONS]
WEBDAV_CORS_ALLOW_ORIGINS=[*]
WEBDAV_CORS_ALLOW_HEADERS=[Authorization Origin Content-Type Accept X-Requested-With X-Request-Id Cache-Control]

OCIS_ASYNC_UPLOADS=true

ldap Active Directory Settings
OCIS_LDAP_URI=ldap://myldapserveripaddress:389
OCIS_LDAP_INSECURE=“true”
OCIS_LDAP_BIND_DN=“CN=LDAP Sync,OU=Service Accounts,OU=my domain Users,OU=my domain,DC=ad,DC=my,DC=domain”
OCIS_LDAP_BIND_PASSWORD=Phoebe76
OCIS_LDAP_DISABLE_USER_MECHANISM=“none”
OCIS_LDAP_GROUP_BASE_DN=“OU=my domain Groups,OU=my domain,DC=ad,DC=my,DC=domain”
OCIS_LDAP_GROUP_OBJECTCLASS=“group”
OCIS_LDAP_GROUP_SCHEMA_ID=“objectGUID”
OCIS_LDAP_GROUP_SCHEMA_ID_IS_OCTETSTRING=“true”
OCIS_LDAP_GROUP_SCHEMA_GROUPNAME=“cn”
#OCIS_LDAP_GROUP_SCHEMA_MEMBER=“member”
OCIS_LDAP_USER_BASE_DN=“OU=Standard Accounts,OU=my domain Users,OU=my domain,DC=ad,DC=my,DC=domain”
OCIS_LDAP_USER_OBJECTCLASS=“user”
OCIS_LDAP_USER_SCHEMA_ID=“objectGUID”
OCIS_LDAP_USER_SCHEMA_ID_IS_OCTETSTRING=“true”
OCIS_LDAP_USER_SCHEMA_USERNAME=“sAMAccountName”
OCIS_LDAP_USER_SCHEMA_DISPLAYNAME=“displayname”
OCIS_LDAP_USER_SCHEMA_MAIL=“mail”
OCIS_LDAP_LOGIN_ATTRIBUTES=“sAMAccountName”
IDP_LDAP_LOGIN_ATTRIBUTE=“sAMAccountName”
IDP_LDAP_UUID_ATTRIBUTE=“objectGUID”
IDP_LDAP_UUID_ATTRIBUTE_TYPE=binary
GRAPH_LDAP_SERVER_WRITE_ENABLED=“false”
OCIS_EXCLUDE_RUN_SERVICES=idm
OCIS_ADMIN_USER_ID=“DC29C0A9-67D1-4BE7-B627-7DEC81870CF7”
OCIS_LDAP_USER_ENABLED_ATTRIBUTE=“ms-DS-User-Account-Disabled”
#OCIS_LDAP_USER_FILTER=“(&(memberOf=CN=Cloud,OU=my domain Groups,OU=my domain,DC=ad,DC=my,DC=domain))”
#OCIS_LDAP_GROUP_FILTER=“(& (cn={0}) (objectclass=group) )”
#AUTH_BASIC_AUTH_PROVIDER=“ldap”

#Log Settings
#GRAPH_CONFIG_FILE=/home/connor/ocisg.log
#GRAPH_LOG_LEVEL=debug
#OCIS_LOG_LEVEL=debug
#OCIS_LOG_FILE=/home/connor/ocis.log
#OCIS_LOG_PRETTY=true
#OCIS_LOG_COLOR=true

The above config is what i’m trying to get working with Active Directory - Windows Server 2022.
I’ve tested my AD Config with Proxmox and Proxmox is able to see the users/groups just fine, with the same IP Address and port number, so I am unsure why OCIS is having an issue. I have also set the log level to debug, please see below output for a login attempt i’ve just tried:

Nov 14 12:49:21 CSSVRCLOUD01 ocis[655]: {“level”:“debug”,“service”:“proxy”,“policy”:“ocis”,“method”:“POST”,“prefix”:“/signin/”,“path”:“/signin/v1/identifier//logon",“routeType”:“prefix”,“time”:“2023-11-14T12:49:21.272763249Z”,“line”:“github.com/owncloud/ocis/v2/services/proxy/pkg/router/router.go:222",“message”:"director found”}
Nov 14 12:49:21 CSSVRCLOUD01 ocis[655]: {“level”:“debug”,“service”:“idp”,“request-id”:“”,“proto”:“HTTP/1.1”,“method”:“POST”,“status”:204,“path”:"/signin/v1/identifier/
/logon”,“duration”:5.485554,“bytes”:0,“time”:“2023-11-14T12:49:21.27864593Z”,“line”:“github.com/owncloud/ocis/v2/ocis-pkg/middleware/logger.go:27”}
Nov 14 12:49:21 CSSVRCLOUD01 ocis[655]: {“level”:“info”,“service”:“proxy”,“proto”:“HTTP/1.1”,“request-id”:“CSSVRCLOUD01/x6cUvgQTDV-000009”,“remote-addr”:“87.102.113.249”,“method”:“POST”,“status”:204,“path”:“/signin/v1/identifier/_/logon”,“duration”:6.284009,“bytes”:0,“time”:“2023-11-14T12:49:21.27886789Z”,“line”:“github.com/owncloud/ocis/v2/services/proxy/pkg/middleware/accesslog.go:31",“message”:"access-log”}

There should be a lot more log messages from the proxy and idp services than just that. We really need the full log to get a better understanding.

Hi @rhaferkamp , I have messaged you on here with my log file (cannot upload a 12mb/13mb file to this post)

1 Like