Kurt Seifried of Red Hat reports: The dovecot rpm creates the SSL/TLS key files using the following rpm postinstall script in RHEL 4: # create a ssl cert if [ ! -f /usr/share/ssl/certs/dovecot.pem ]; then pushd /usr/share/ssl &>/dev/null umask 077 cat << EOF | openssl req -new -x509 -days 365 -nodes -out certs/dovecot.pem -keyout private/dovecot.pem &>/dev/null -- SomeState SomeCity SomeOrganization SomeOrganizationalUnit localhost.localdomain root EOF chown root:root private/dovecot.pem certs/dovecot.pem chmod 600 private/dovecot.pem certs/dovecot.pem And later versions use a postinstall of: # generate the ssl certificates if [ ! -f /etc/pki/dovecot/certs/dovecot.pem ]; then SSLDIR=/etc/pki/dovecot OPENSSLCONFIG=/etc/pki/dovecot/dovecot-openssl.cnf \ /usr/libexec/dovecot/mkcert.sh &> /dev/null fi from: /usr/libexec/dovecot/mkcert.sh $OPENSSL req -new -x509 -nodes -config $OPENSSLCONFIG -out $CERTFILE -keyout $KEYFILE -days 365 || exit 2 chown root:root $CERTFILE $KEYFILE chmod 0600 $CERTFILE $KEYFILE 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.
Acknowledgments: Name: Kurt Seifried (Red Hat)
Created dovecot tracking bugs for this issue: Affects: fedora-all [bug 1346056]
I don't understand this bug report. Could you clarify it a little bit more? > 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. 1) you suggest umask 077 first which is already there, just above the cat <<EOF line 2) what does it matter if it was exposed for a short moment (which it isn't) it the content is just a dummy template/placeholder. It is stored in post script which is known to everyone anyway. It can be queried from the system by regular user by: $ rpm -q --scripts dovecot AND the "quality" of the certificate data "SomeState" "SomeCity" etc. is something won't be trusted by anyone in real life even if someone tried to deploy dovecot with such a certificate which I doubt. It is just a placeholder template to allow to run dovecot for testing on localhost, nothing more. It's no secret whatsoever. Also you file a bug for "fedora-all" with recommendation of "First-time Service Setup" which is what fedora packages already do.
Basically everything has to be first run, even "test data", for container and related systems this stuff will cause problems, hence it needs to be removed/fixed.