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.
Bug 1269227 - MongoDB logs are directed to incorrect location / incorrect selinux context
Summary: MongoDB logs are directed to incorrect location / incorrect selinux context
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Installation
Version: 6.1.2
Hardware: Unspecified
OS: Linux
high
high
Target Milestone: Unspecified
Assignee: Justin Sherrill
QA Contact: Stephen Benjamin
URL:
Whiteboard:
: 1317479 (view as bug list)
Depends On:
Blocks: 1122832 1296845 1317008
TreeView+ depends on / blocked
 
Reported: 2015-10-06 18:05 UTC by Craig Donnelly
Modified: 2019-12-16 05:00 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 08:57:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 2067593 0 None None None Never
Red Hat Product Errata RHBA-2016:1500 0 normal SHIPPED_LIVE Red Hat Satellite 6.2 Base Libraries 2016-07-27 12:24:38 UTC

Internal Links: 1317479

Description Craig Donnelly 2015-10-06 18:05:12 UTC
Description of problem:

Upon installation of Satellite 6.1.2, MongoDB logs are directed to /var/lib/mongodb which automatically assigned them the selinux context: mongod_var_lib_t.
This prevents the logs from being managed by logrotate even though Satellite provides configuration for them to be rotated.

Version-Release number of selected component (if applicable): Satellite 6.1.2

How reproducible: 100%

Steps to Reproduce:
1. Install Satellite 6.1.2.
2. Observe that mongodb logs are placed in /var/lib/mongodb

Actual results: Logs for MongoDB placed in /var/lib/mongodb, wrong selinux context applied. logrotate is setup to control logs in /var/log/mongodb. To have correct logrotate, customer would need to configure the logpath correctly in /etc/mongodb.conf.

They receive selinux context based on this rule: 
/var/lib/mongo.*  all files  system_u:object_r:mongod_var_lib_t:s0
Rule for the logs:
/var/log/mongo.*  all files  system_u:object_r:mongod_log_t:s0

Expected results: MongoDB logs should be pushed to /var/log/mongodb, as this would solve any selinux context issues and work with the current implementation of /etc/logrotate.d/mongodb.

Additional info:

Appears that the logpatch is configured via puppet during install:
  class { 'mongodb':
    logpath     => '/var/lib/mongodb/mongodb.log',
    dbpath      => '/var/lib/mongodb',
    pidfilepath => $mongodb_pidfilepath,
  } ~>

Comment 7 Justin Sherrill 2016-03-14 13:35:47 UTC
This should now be handled properly with the newer pulp puppet module.  I verified on an installation it was logging to the correct place and log rotate was occuring.

Comment 8 Justin Sherrill 2016-03-14 13:44:10 UTC
Also to note, the files in this new location appear to have the correct selinux context:

[root@sat-r220-04 ~]# ls -lZ /var/log/mongodb/
-rw-r--r--. mongodb mongodb system_u:object_r:mongod_log_t:s0 mongodb.log
-rw-r--r--. mongodb mongodb system_u:object_r:mongod_log_t:s0 mongodb.log.2016-03-12T18-29-57
-rw-r--r--. mongodb mongodb system_u:object_r:mongod_log_t:s0 mongodb.log-20160313
-rw-r--r--. mongodb mongodb system_u:object_r:mongod_log_t:s0 mongodb.log.2016-03-13T07-14-03

Comment 9 Stephen Benjamin 2016-03-24 16:57:18 UTC
Logs go to right place, with right context:

[root@sat-r220-06 mongodb]# ls -lZ /var/log/mongodb/
-rw-r--r--. mongodb mongodb system_u:object_r:mongod_log_t:s0 mongodb.log
-rw-r--r--. mongodb mongodb system_u:object_r:mongod_log_t:s0 mongodb.log.2016-03-24T16-12-24

Comment 12 errata-xmlrpc 2016-07-27 08:57:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1500

Comment 13 Michael Hrivnak 2017-01-04 21:31:46 UTC
*** Bug 1317479 has been marked as a duplicate of this bug. ***


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