#3020 sssd does not read in configuration file if changed during the last second
Opened 3 years ago by danielschmitz. Modified 2 years ago

Upon startup sssd checks wether it's configuration database is stale or not.
Therefore it compares the lastUpdate entry in the database with the mtime of the configuration file. If they match it considers it's config database to be in sync with the config file and does not update it.

Unfortunately mtime has a resolution of 1 second. If the configuration file was modified less than one second before this check, sssd ignores that modification.

A better check could be based on checksums instead of timestamps.


Fields changed

priority: major => minor

Sorry, the condition under which this bug occurs was stated wrongly. It should be:

If the configuration file was modified less than one second after the last database update, sssd ignores that modification.

This is a ding libs limitation AFAIR.
If I recall correctly we are talking about

int ini_config_changed(struct ini_cfgfile *file_ctx1,
                       struct ini_cfgfile *file_ctx2,
                       int *changed);

which is implemented in ini_fileobj.c. [[BR]]
A comment from the past (I felt it will bite one day...)

  /* Unfortunately the time is not granular enough
     * to detect the change if run during the unit test.
     * In future when a more granular version of stat
     * is available we should switch to it and update
     * the unit test.
     */

So I think the workaround is to pause before restarting SSSD.
Creating a hash might be an option though it will be a bit more work. If help needed with implementing hashing in ding-libs let me know, I can outline what needs to be done and how.

It seems that stat structure should already have nanosecond granularity.

From man fstat():

Notes

Since kernel 2.5.48, the stat structure supports nanosecond resolution for the three file timestamp fields. Glibc exposes the nanosecond component of each field using names of the form st_atim.tv_nsec if the _BSD_SOURCE or _SVID_SOURCE feature test macro is defined. These fields are specified in POSIX.1-2008, and, starting with version 2.12, glibc also exposes these field names if _POSIX_C_SOURCE is defined with the value 200809L or greater, or _XOPEN_SOURCE is defined with the value 700 or greater. If none of the aforementioned macros are defined, then the nanosecond values are exposed with names of the form st_atimensec. On file systems that do not support subsecond timestamps, the nanosecond fields are returned with the value 0.

so it might be easy to just add nanosecond field validation into the function.

Fields changed

cc: => lslebodn

Fields changed

rhbz: => todo

Fields changed

milestone: NEEDS_TRIAGE => SSSD 1.15 beta

Metadata Update from @danielschmitz:
- Issue set to the milestone: SSSD Future releases (no date set yet)

2 years ago

Login to comment on this ticket.

Metadata