Bug 1447086 - [Ansible Embedded] - Privilege escalation for playbook does not work
Summary: [Ansible Embedded] - Privilege escalation for playbook does not work
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.8.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.8.0
Assignee: Harpreet Kataria
QA Contact: Dmitry Misharov
URL:
Whiteboard: ansible_embed
Depends On: 1445377
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-01 17:00 UTC by Satoe Imaishi
Modified: 2017-05-31 15:07 UTC (History)
10 users (show)

Fixed In Version: 5.8.0.13
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1445377
Environment:
Last Closed: 2017-05-31 15:07:09 UTC
Category: ---
Cloudforms Team: Ansible
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
awx (43.97 KB, image/png)
2017-05-05 23:14 UTC, Saif Ali
no flags Details
error (48.08 KB, image/png)
2017-05-05 23:14 UTC, Saif Ali
no flags Details
ip (41.02 KB, image/png)
2017-05-07 23:45 UTC, Saif Ali
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:1367 0 normal SHIPPED_LIVE Moderate: CFME 5.8.0 security, bug, and enhancement update 2017-05-31 18:16:03 UTC

Comment 2 CFME Bot 2017-05-01 17:03:15 UTC
New commit detected on ManageIQ/manageiq-ui-classic/fine:
https://github.com/ManageIQ/manageiq-ui-classic/commit/3e989229cdf308b93118362d41971f77fdf363b2

commit 3e989229cdf308b93118362d41971f77fdf363b2
Author:     Dan Clarizio <dclarizi>
AuthorDate: Mon May 1 09:19:39 2017 -0700
Commit:     Satoe Imaishi <simaishi>
CommitDate: Mon May 1 13:02:46 2017 -0400

    Merge pull request #1207 from h-kataria/escalate_privilege_option
    
    Added "Escalate Privilege" checkbox
    (cherry picked from commit 4f45c537341088d8f1dfba252f4ae77822998bd8)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1447086

 .../controllers/catalog/catalog_item_form_controller.js   | 15 ++++++++++++++-
 app/controllers/catalog_controller.rb                     |  2 ++
 app/views/catalog/_sandt_tree_show.html.haml              | 10 ++++++++++
 .../angular/_ansible_form_options_angular.html.haml       | 13 ++++++++++++-
 spec/controllers/catalog_controller_spec.rb               | 12 ++++++++----
 .../catalog/catalog_item_form_controller_spec.js          |  1 +
 6 files changed, 47 insertions(+), 6 deletions(-)

Comment 3 CFME Bot 2017-05-01 17:06:04 UTC
New commit detected on ManageIQ/manageiq/fine:
https://github.com/ManageIQ/manageiq/commit/d5db6cd5b2c907327db5343d9c7a3d96e7771a8e

commit d5db6cd5b2c907327db5343d9c7a3d96e7771a8e
Author:     Greg McCullough <gmccullo>
AuthorDate: Fri Apr 28 10:52:58 2017 -0400
Commit:     Satoe Imaishi <simaishi>
CommitDate: Mon May 1 13:00:38 2017 -0400

    Merge pull request #14929 from bzwei/escalate_privilage
    
    Escalate privilege
    (cherry picked from commit 291254e928dd64a3e52caa9a07cb788ab62663c7)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1447086

 app/models/service_template_ansible_playbook.rb       | 5 +++--
 spec/models/service_template_ansible_playbook_spec.rb | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

Comment 4 Dmitry Misharov 2017-05-04 07:26:30 UTC
Verified in 5.8.0.13-rc2.20170502165848_0f98658. Privilege escalation works as expected.

Comment 5 Saif Ali 2017-05-05 23:14:10 UTC
Created attachment 1276707 [details]
awx

Comment 6 Saif Ali 2017-05-05 23:14:33 UTC
Created attachment 1276708 [details]
error

Comment 7 Saif Ali 2017-05-05 23:16:11 UTC
I'm still getting the error in fact the machine credential has no effect, and all the job seem to be running as awx user.

5.8.0.13-rc2-20170502165848_0f98658

Comment 8 Bill Wei 2017-05-07 23:06:40 UTC
Saif,
I guess the first screenshot was the case without privilege escalation, and the second screenshot was with the flag on.

This BZ is to enhance our integration with Ansible that at job execution we instruct it to use su command run the job. The screenshot illustrated it is working as designed. The system received the flag and attempted to run su command.

The actual execution failure may be caused by the setup. Please make sure the credential you choose for the playbook meets the requirement, for example you have chosen the correct su/sudo, and user/password.

Comment 9 Saif Ali 2017-05-07 23:44:40 UTC
Bill,
The user has sudo access without password. I notice the playbook fail only when the host is set to localhost. If i use the IP it work fine using the same user.

Comment 10 Saif Ali 2017-05-07 23:45:12 UTC
Created attachment 1276911 [details]
ip

Comment 11 Bill Wei 2017-05-08 01:51:22 UTC
Is the IP of the CFME appliance?

Comment 12 Saif Ali 2017-05-08 13:59:55 UTC
Yes thats appliance IP.

Comment 13 Bill Wei 2017-05-08 18:13:34 UTC
We did some the same test and understand what's going on. When a playbook executes in localhost Tower always logs in as awx and does not allow privilege escalation. This makes sense for security reason. When you use IP tower does not know it is actually localhost therefore it treats the host as a regular machine.

In conclusion privilege escalation works only in non-localhost.

Comment 14 Saif Ali 2017-05-08 18:15:39 UTC
Bill, Thats make sense.

Comment 16 errata-xmlrpc 2017-05-31 15:07:09 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/RHSA-2017:1367


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