Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 1346120 - (CVE-2016-4984) CVE-2016-4984 openldap-servers: /usr/libexec/openldap/generate-server-cert.sh create world readable password file
CVE-2016-4984 openldap-servers: /usr/libexec/openldap/generate-server-cert.sh...
Status: CLOSED WONTFIX
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
low Severity low
: ---
: ---
Assigned To: Red Hat Product Security
impact=low,public=20160613,reported=2...
: Security
Depends On: 1346121
Blocks: 1346019 1349160
  Show dependency treegraph
 
Reported: 2016-06-13 23:38 EDT by Kurt Seifried
Modified: 2016-10-13 05:04 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-10-13 04:45:44 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Kurt Seifried 2016-06-13 23:38:37 EDT
The openldap-servers rpm creates the password file using the following rpm postinstall called script:

# generate sample TLS certificate for server (will not replace)
/usr/libexec/openldap/generate-server-cert.sh -o &>/dev/null || :

the script in turn creates the file unsafely and changes the permissions after creating it:

certutil -d "$CERTDB_DIR" -f "$PASSWORD_FILE" -z "$CERT_RANDOM" \
        -S -x -n "$CERT_NAME" \
        -s "CN=$HOSTNAME_FQDN" \
        -t TC,, \password
        -k $CERT_KEY_TYPE -g $CERT_KEY_SIZE \
        -v $CERT_VALID_MONTHS \
        -8 "$ALT_NAMES" \
        &>/dev/null

rm -f $CERT_RANDOM

# tune permissions

if [ "$(id -u)" -eq 0 ]; then
        chgrp ldap "$PASSWORD_FILE"
        chmod g+r "$PASSWORD_FILE"
else
        printf "WARNING: The server requires read permissions on the password file in order to\n" >&2
        printf "         load it's private key from the certificate database.\n" >&2
fi

this can lead to the contents of the file being exposed between the time the file is created and the chmod command runs. I would suggest setting umask 077 first. 

Additionally this secret value needs to be unique per instance or install but this value is created at install-time and not during the first run. All container and image instances created would share the same password as this password is set at rpm install time, and each instance should recieve a unique password. 

This bug is being file because Product Security considers "first run problems" to be bugs with the source package and with the container or image only in the aggregate. This view is in collaboration with upstream Fedora. See: https://fedorahosted.org/fpc/ticket/506

The recommended resolution for services is to follow the "First-time Service Setup" pattern (see: https://fedoraproject.org/wiki/Packaging:Initial_Service_Setup ). Other packages may should use a runtime check and generation or similar procedure.
Comment 1 Kurt Seifried 2016-06-13 23:38:48 EDT
Acknowledgments:

Name: Kurt Seifried (Red Hat)
Comment 2 Kurt Seifried 2016-06-13 23:39:20 EDT
Created openldap tracking bugs for this issue:

Affects: fedora-all [bug 1346121]
Comment 3 Kurt Seifried 2016-06-24 23:09:44 EDT
Just a note, the first run issue can also be handled through orchestration (e.g. OpenStack, CloudForms, OpenShift Enterprise and so on). But the certificate creation MUST be removed from the rpm install scripts.

Note You need to log in before you can comment on or make changes to this bug.