Red Hat Bugzilla – 1346097 – foreman creates Rails secret tokens, needs to be unique per instance or install but this value is created at install-time and not during the first run
Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Version-Release number of selected component (if applicable):
foreman-1.7.2.56-1.el7sat.noarch
How reproducible:
Always.
postinstal:
# secret token used for cookie signing etc.
if [ ! -f /usr/share/foreman/config/initializers/local_secret_token.rb ]; then
touch /usr/share/foreman/config/initializers/local_secret_token.rb
chmod 0660 /usr/share/foreman/config/initializers/local_secret_token.rb
chgrp foreman /usr/share/foreman/config/initializers/local_secret_token.rb
/usr/sbin/foreman-rake security:generate_token >/dev/null 2>&1 || :
chmod 0640 /usr/share/foreman/config/initializers/local_secret_token.rb
fi
# encryption key used to encrypt DB contents
# move the generated key file to /etc/foreman/ so users back it up, symlink to it from ~foreman
if [ ! -e /usr/share/foreman/config/initializers/encryption_key.rb -a \
! -e /etc/foreman/encryption_key.rb ]; then
touch /usr/share/foreman/config/initializers/encryption_key.rb
chmod 0660 /usr/share/foreman/config/initializers/encryption_key.rb
chgrp foreman /usr/share/foreman/config/initializers/encryption_key.rb
/usr/sbin/foreman-rake security:generate_encryption_key >/dev/null 2>&1 || :
chmod 0640 /usr/share/foreman/config/initializers/encryption_key.rb
mv /usr/share/foreman/config/initializers/encryption_key.rb /etc/foreman/
fi
if [ ! -e /usr/share/foreman/config/initializers/encryption_key.rb -a \
-e /etc/foreman/encryption_key.rb ]; then
ln -s /etc/foreman/encryption_key.rb /usr/share/foreman/config/initializers/
fi
Steps to Reproduce:
1. Install to a container or image.
2. Run new instance of container or image.
3.
Actual results:
All container and image instances share the same key/cert.
Expected results:
Each instance should receive a unique key/cert.
Additional info:
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.
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.
Comment 3Daniel Lobato Garcia
2016-09-12 09:29:36 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the foreseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.
Version-Release number of selected component (if applicable): foreman-1.7.2.56-1.el7sat.noarch How reproducible: Always. postinstal: # secret token used for cookie signing etc. if [ ! -f /usr/share/foreman/config/initializers/local_secret_token.rb ]; then touch /usr/share/foreman/config/initializers/local_secret_token.rb chmod 0660 /usr/share/foreman/config/initializers/local_secret_token.rb chgrp foreman /usr/share/foreman/config/initializers/local_secret_token.rb /usr/sbin/foreman-rake security:generate_token >/dev/null 2>&1 || : chmod 0640 /usr/share/foreman/config/initializers/local_secret_token.rb fi # encryption key used to encrypt DB contents # move the generated key file to /etc/foreman/ so users back it up, symlink to it from ~foreman if [ ! -e /usr/share/foreman/config/initializers/encryption_key.rb -a \ ! -e /etc/foreman/encryption_key.rb ]; then touch /usr/share/foreman/config/initializers/encryption_key.rb chmod 0660 /usr/share/foreman/config/initializers/encryption_key.rb chgrp foreman /usr/share/foreman/config/initializers/encryption_key.rb /usr/sbin/foreman-rake security:generate_encryption_key >/dev/null 2>&1 || : chmod 0640 /usr/share/foreman/config/initializers/encryption_key.rb mv /usr/share/foreman/config/initializers/encryption_key.rb /etc/foreman/ fi if [ ! -e /usr/share/foreman/config/initializers/encryption_key.rb -a \ -e /etc/foreman/encryption_key.rb ]; then ln -s /etc/foreman/encryption_key.rb /usr/share/foreman/config/initializers/ fi Steps to Reproduce: 1. Install to a container or image. 2. Run new instance of container or image. 3. Actual results: All container and image instances share the same key/cert. Expected results: Each instance should receive a unique key/cert. Additional info: 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.