dnknth / ldap-ui

Minimalistic web frontend for OpenLDAP
MIT License
370 stars 28 forks source link

postfix schema not accessible within the UI after import to OpenLDAP #18

Closed financelurker closed 3 years ago

financelurker commented 3 years ago

Hi!

I've added the postfix schema (see here https://raw.githubusercontent.com/68b32/postfix-ldap-schema/master/postfix.ldif ) to my OpenLDAP instance.

A query with ldapsearch -Q -LLL -Y EXTERNAL -H ldapi:/// -b cn=config postfix* listed the following output:

dn: cn=config
dn: cn=schema,cn=config
dn: cn={0}core,cn=schema,cn=config
dn: cn={1}cosine,cn=schema,cn=config
dn: cn={2}inetorgperson,cn=schema,cn=config
dn: cn={3}nis,cn=schema,cn=config
dn: cn={4}postfix,cn=schema,cn=config
dn: olcDatabase={-1}frontend,cn=config
dn: olcDatabase={0}config,cn=config
dn: olcDatabase={1}monitor,cn=config
dn: olcDatabase={2}mdb,cn=config

A query with ldapsearch -H ldap://localhost:1389 -x -s base -b "cn=subschema" + lists the following output:

...
objectClasses: ( 1.3.6.1.4.1.4203.666.1.100 NAME 'postfixUser' DESC 'Postfix m
 ail user class' SUP top AUXILIARY MAY ( mailacceptinggeneralid $ maildrop ) )
entryDN: cn=Subschema
subschemaSubentry: cn=Subschema

Unfortunately, when refreshing the UI and opening the Schema-dropdown this postfix schema isn't listed and isn't accessible to set as objectClass on existing entries (or even new entries).

How can this be enabled? Is there some filtering within the python API service (since it's already missing when the "/api/schema" endpoint is responding)?

Thx in advance!

dnknth commented 3 years ago

Assuming that the LDAP schema is visible in general, please restart the app.py process (or Docker container, depending on your setup) and then reload the UI. The server side does not pick up any schema changes while it is running, but caches the initial version indefinitely.

Please check whether this fixes it.

financelurker commented 3 years ago

Thank you - that actually worked. Would you merge a patch/PR where you can toggle this caching vía an ENV param if I created one? Because I wouldn't mind the UI always getting the schema data freshly from the OpenLDAP in the background.

What's your take on that?

dnknth commented 3 years ago

Sure, that's possible. The proposed change should be made here. However, I'd prefer if the schema is not reloaded every time, a time-based caching (e.g. for 5 minutes) might be a good compromise.

dnknth commented 3 years ago

Can we close this, or are you planning to create a PR?

dnknth commented 3 years ago

Given that schema changes are rare, restarting the UI service may be considered as acceptable workaround.