Bug 1437456

Summary: auditFilePath is logging to master container instead of host.
Product: OpenShift Container Platform Reporter: Joel Rosental R. <jrosenta>
Component: InstallerAssignee: Giuseppe Scrivano <gscrivan>
Status: CLOSED ERRATA QA Contact: Gaoyun Pei <gpei>
Severity: low Docs Contact:
Priority: low    
Version: 3.4.0CC: aos-bugs, jokerman, jrosenta, mmccomas, myllynen, pweil, sdodson, smunilla
Target Milestone: ---   
Target Release: 3.4.z   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1440779 (view as bug list) Environment:
Last Closed: 2017-06-15 18:37:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1440779    

Description Joel Rosental R. 2017-03-30 11:10:16 UTC
Description of problem:
When audit logging is enabled in a containerized installation without specifying an auditFilePath option then audit entries can bee seen as expected within syslog, however when auditFilePath option is specified then the file gets created and populated inside the master container itself instead of the host, which seems to be a bit cumbersome.

Version-Release number of selected component (if applicable):
3.4.7
3.4.10

How reproducible:
Always

Steps to Reproduce:
1. Setup auditFilePath option in an OCP 3.4 containerized installation
2. Restart atomic-openshift-master.service and see the file specified as value in auditFilePath does not get created automatically in the host but in the master container.


Actual results:
File gets created inside the master container.

Expected results:
File created in the host instead of inside the master container.

Additional info:

Comment 1 Marko Myllynen 2017-04-06 11:36:33 UTC
Remotely related: https://bugzilla.redhat.com/show_bug.cgi?id=1439619 .

Comment 6 Giuseppe Scrivano 2017-04-06 16:28:56 UTC
Proposed fix:

https://github.com/openshift/openshift-ansible/pull/3872

And for the system container version:

https://github.com/openshift/origin/pull/13657

Comment 7 Giuseppe Scrivano 2017-04-10 08:14:39 UTC
backported to 1.4:

https://github.com/openshift/openshift-ansible/pull/3886

Comment 9 Gaoyun Pei 2017-06-05 06:30:46 UTC
Verify this bug with openshift-ansible-3.4.93-1.git.0.a6c353e.el7.noarch.rpm

Enable audit config for a containerized installation in ansible inventory file:
openshift_master_audit_config={"enabled": true, "auditFilePath": "/var/log/audit-ocp.log", "maximumFileRetentionDays": 10,"maximumRetainedFiles": 10,"maximumFileSizeMegabytes": 100}


After installation, check master config file
auditConfig:
  auditFilePath: /var/log/audit-ocp.log
  enabled: true
  maximumFileRetentionDays: 10
  maximumFileSizeMegabytes: 100
  maximumRetainedFiles: 10


On master host, check the log file
-bash-4.2# tail /var/log/audit-ocp.log
2017-06-05T06:22:12.504559595Z AUDIT: id="0b6fca69-d7e3-4e6b-b5fa-2fbef4ff8f7e" ip="172.18.2.189" method="GET" user="system:node:ip-172-18-2-189.ec2.internal" as="<self>" asgroups="<lookup>" namespace="<none>" uri="/api/v1/watch/services?resourceVersion=4835&timeoutSeconds=587"
2017-06-05T06:22:12.504981404Z AUDIT: id="0b6fca69-d7e3-4e6b-b5fa-2fbef4ff8f7e" response="200"


Inside the master contaier, check the log file
[root@ip-172-18-4-224 origin]# tail /var/log/audit-ocp.log
2017-06-05T06:22:50.780492517Z AUDIT: id="dbedd68c-48e8-49d6-beb2-4015dda16dfb" ip="172.18.4.224" method="GET" user="system:serviceaccount:openshift-infra:job-controller" as="<self>" asgroups="<lookup>" namespace="<none>" uri="/apis/batch/v2alpha1/jobs"
2017-06-05T06:22:50.780854646Z AUDIT: id="dbedd68c-48e8-49d6-beb2-4015dda16dfb" response="200"
2017-06-05T06:22:52.27943335Z AUDIT: id="78cc8182-d921-407a-a08c-aea48f48e10d" ip="172.18.4.224" method="GET" user="system:openshift-master" as="<self>" asgroups="<lookup>" namespace="<none>" uri="/api/v1/nodes?resourceVersion=0"

Comment 11 errata-xmlrpc 2017-06-15 18:37:12 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-2017:1425