#3 Start up will fail if Certificate directory is not available to Apache user
Closed: Fixed Opened by rcritten.

Cloned from BZ https://bugzilla.redhat.com/show_bug.cgi?id=1025799

As reported in mod_nss mailing list:

mod_nss has this code in it:

   if (chdir(mc->pCertificateDatabase) != 0) {
        ap_log_error(APLOG_MARK, APLOG_ERR, 0, base_server,
            "Unable to change directory to %s", mc->pCertificateDatabase);
        if (mc->nInitCount == 1)
            nss_die();
        else
            return;
    }
   rv = NSS_Initialize(mc->pCertificateDatabase, mc->pDBPrefix, mc->pDBPrefix, "secmod.db", NSS_INIT_READONLY);

Let's say the database is in /root/secure.

Apache starts as root during the initial face (nInitCount = 1) so this will succeed. Then it drops root and subsequent chdir's will fail with just a log message. It should probably die here too. I think the intention was that the caller would detect that things had failed, but it doesn't and it continues to do NSS calls which of course fail spectacularly.

I think the reason for not calling nss_die() is it just kills that child, which will be re-forked. Rinse and repeat.

I'm not entirely sure why I do the chdir at this point from this code snippet.


Also bug https://bugzilla.redhat.com/show_bug.cgi?id=1312583

Given the certificate database check for cert8.db/key3.db/secmod.db or cert9.db/key4.db depending on the sql: prefix.

Add option NSSSkipPermissionCheck on/off to skip this new behavior

master: 28283de7ce8557b60d475b0e138d19f3d92f0a2a

Metadata Update from @rcritten:
- Issue set to the milestone: mod_nss-1.0.13

Metadata