Bug 1447019 - Include Audit configuration in the installation process (Ansible OCP inventory)
Summary: Include Audit configuration in the installation process (Ansible OCP inventory)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Installer
Version: 3.5.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 3.5.z
Assignee: Russell Teague
QA Contact: Gaoyun Pei
URL:
Whiteboard:
Depends On:
Blocks: 1454370 1454377
TreeView+ depends on / blocked
 
Reported: 2017-05-01 08:29 UTC by Jaspreet Kaur
Modified: 2017-06-15 18:38 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Adjusted conditionals to allow audit configuration for non-ha environments.
Clone Of:
: 1454370 1454377 (view as bug list)
Environment:
Last Closed: 2017-06-15 18:38:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:1425 0 normal SHIPPED_LIVE OpenShift Container Platform 3.5, 3.4, 3.3, and 3.2 bug fix update 2017-06-15 22:35:53 UTC

Description Jaspreet Kaur 2017-05-01 08:29:33 UTC
1. Proposed title of this feature request

Include Audit configuration in the installation process (Ansible OCP inventory)

2. What is the nature and description of the request?

The OCP Audit configuration [1] can only be configured manually.
We would like to be able to configure it at installation time, setting Ansible variables in the inventory for the different options, the same way It is done for other configurations types [2].

These are the options that the audit config allows:
*enabled
*auditFilePath
*MaximumFileRetentionDays
*MaximumRetainedFiles
*MaximumFileSizeMegabytes


5. How would the customer like to achieve this? (List the functional requirements here)

The above parameters should be configured at installation time in inventory.

Comment 2 Brenton Leanhardt 2017-05-01 14:36:18 UTC
This is already possible today.  The value mentioned in https://github.com/openshift/openshift-ansible/pull/2149/files shows that the raw json is passed to Ansible which will be stored in the Master configuration.  All documented audit configuration parameters will work.

Comment 3 Jaspreet Kaur 2017-05-09 12:53:14 UTC
Tried to use below parameter in inventory for installation but I do not see this configuration added in master-config after successfull deployment :

openshift_master_audit_config={"enabled": true}


oc version
oc v3.4.1.18
kubernetes v1.4.0+776c994
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://ham1.example.com:8443
openshift v3.4.1.18
kubernetes v1.4.0+776c994

Comment 4 Brenton Leanhardt 2017-05-09 14:19:05 UTC
Jaspreet, can you attach the generated master configuration?

Comment 7 Brenton Leanhardt 2017-05-17 12:34:02 UTC
What version of openshift-ansible are you using?

Comment 8 Jaspreet Kaur 2017-05-17 12:45:30 UTC
Here are the details :

rpm -qa  | grep openshift
atomic-openshift-3.4.1.18-1.git.0.0f9d380.el7.x86_64
atomic-openshift-node-3.4.1.18-1.git.0.0f9d380.el7.x86_64
openshift-ansible-docs-3.4.74-1.git.0.6542413.el7.noarch
openshift-ansible-callback-plugins-3.4.74-1.git.0.6542413.el7.noarch
atomic-openshift-clients-3.4.1.18-1.git.0.0f9d380.el7.x86_64
atomic-openshift-master-3.4.1.18-1.git.0.0f9d380.el7.x86_64
tuned-profiles-atomic-openshift-node-3.4.1.18-1.git.0.0f9d380.el7.x86_64
openshift-ansible-3.4.74-1.git.0.6542413.el7.noarch
openshift-ansible-filter-plugins-3.4.74-1.git.0.6542413.el7.noarch
openshift-ansible-roles-3.4.74-1.git.0.6542413.el7.noarch
atomic-openshift-utils-3.4.74-1.git.0.6542413.el7.noarch
atomic-openshift-sdn-ovs-3.4.1.18-1.git.0.0f9d380.el7.x86_64
openshift-ansible-lookup-plugins-3.4.74-1.git.0.6542413.el7.noarch
openshift-ansible-playbooks-3.4.74-1.git.0.6542413.el7.noarch

Comment 9 Brenton Leanhardt 2017-05-17 13:13:14 UTC
Jianlin, would you mind confirming if we have a bug with our openshift_master_audit_config setting or not?

If could be that the logic we have to optionally set that code is no longer working.  Given that we branch for openshift-ansible now I think the "and openshift.common.version_gte_3_2_or_1_2" logic could be completely removed now.

roles/openshift_master/templates/master.yaml.v1.j2:{% if openshift.master.audit_config | default(none) is not none and openshift.common.version_gte_3_2_or_1_2 | bool %}

Comment 10 Johnny Liu 2017-05-18 02:16:51 UTC
@gepi, could you help answer comment 9, this is kind of similar to BZ#1439619.

Comment 11 Gaoyun Pei 2017-05-18 08:24:02 UTC
Brenton, not sure if Jaspreet was trying a non-ha master installation. In our master.yaml jinja2 template, there's another condition for auditConfig options to be added in master-config[1]

With openshift_master_audit_config={"enabled": true, "auditFilePath": "/var/log/audit-ocp.log", "maximumFileRetentionDays": 10,"maximumRetainedFiles": 10,"maximumFileSizeMegabytes": 100}
setting in ansible inventory, for ha master cluster installation, the Audit options could be configured correctly in master-config.yaml.
[root@ip-172-18-11-189 ~]# grep -A 4 audit /etc/origin/master/master-config.yaml
auditConfig:
  auditFilePath: /var/log/audit-ocp.log
  enabled: true
  maximumFileRetentionDays: 10
  maximumFileSizeMegabytes: 100
  maximumRetainedFiles: 10

Test with openshift-ansible-3.4.89-1.git.0.ac29ce8.el7.noarch.rpm

If the audit configurations were only expected to be used for ha-master cluster, I think we could add some additional description in the doc, or we could remove the openshift_master_ha condition check if not.

[1] https://github.com/openshift/openshift-ansible/blob/master/roles/openshift_master/templates/master.yaml.v1.j2#L47

Comment 12 Jaspreet Kaur 2017-05-18 08:46:08 UTC
Yes I was having a non-ha env. 

Shouldn't this feature be applicable for both ?

Comment 13 Brenton Leanhardt 2017-05-18 13:11:57 UTC
That's a great catch Gaoyun.  I think this is just a bug for non-ha environments.  It should be easy to move the audit logging configuration outside the {% if openshift_master_ha | bool %} block.

Comment 14 Russell Teague 2017-05-18 13:25:18 UTC
Proposed: https://github.com/openshift/openshift-ansible/pull/4226

Comment 15 openshift-github-bot 2017-05-20 03:50:05 UTC
Commit pushed to master at https://github.com/openshift/openshift-ansible

https://github.com/openshift/openshift-ansible/commit/ebb1b751b9623eb2f9b265737e6d032ba5c5da3c
Fix auditConfig for non-HA environments

Bug 1447019

Comment 16 Russell Teague 2017-05-22 15:14:38 UTC
Proposed (3.5 backport): https://github.com/openshift/openshift-ansible/pull/4258

Comment 17 Russell Teague 2017-05-23 13:32:24 UTC
Merged: https://github.com/openshift/openshift-ansible/pull/4258

Comment 18 Gaoyun Pei 2017-05-24 08:47:50 UTC
Verify this bug with openshift-ansible-3.5.5.19-1.git.0.ded7c89.el7.noarch

With audit options added in ansible inventory for non-ha master environment, the related configurations could be found in master config file after installation.
openshift_master_audit_config={"enabled": true, "auditFilePath": "/var/log/audit-ocp.log", "maximumFileRetentionDays": 10,"maximumRetainedFiles": 10,"maximumFileSizeMegabytes": 100}

[root@ip-172-18-11-206 ~]# grep -A 4 audit /etc/origin/master/master-config.yaml
auditConfig:
  auditFilePath: /var/log/audit-ocp.log
  enabled: true
  maximumFileRetentionDays: 10
  maximumFileSizeMegabytes: 100
  maximumRetainedFiles: 10

Will move this bug to verified after the openshift-ansible rpm package was attached to advisory 28675

Comment 19 Gaoyun Pei 2017-06-01 07:19:01 UTC
Verify this bug with openshift-ansible-3.5.74-1.git.0.4e9bb21.el7.noarch.rpm.

openshift_master_audit_config works as expected in non-ha master env.

Comment 21 errata-xmlrpc 2017-06-15 18:38:10 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


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