foreman icon indicating copy to clipboard operation
foreman copied to clipboard

Allow remote execution become any user.

Open vhsantos opened this issue 1 year ago • 1 comments

This PR fix the sudoers.d/user_name configuration to allow the user to run playbooks with others users than root, for example:

- name: Simple playbook demonstrating become and become_user
  hosts: all

  tasks:
    - name: Create a file as the root user (works well)
      ansible.builtin.file:
        path: /tmp/root_file.txt
        state: touch
      become: true
      become_user: root

    - name: Create a file as a different user (dont works, because the users is other than root)
      ansible.builtin.file:
        path: /tmp/www_data_file.txt
        state: touch
      become: true
      become_user: www-data

vhsantos avatar Jul 04 '24 10:07 vhsantos

I'm not sure that's a big deal. If you can become root, you can then run things as any user anyway. Security wise I don't think there's a difference.

ekohl avatar Aug 15 '24 14:08 ekohl

Thank you for your contribution! This PR has been inactive for 3 months, closing for now. Feel free to reopen when you return to it. This is an automated process.

github-actions[bot] avatar Nov 21 '24 02:11 github-actions[bot]

Hi @adamruzicka and @ekohl can you reopen this ? I dont have the privileges to do it !! :-(

vhsantos avatar Nov 21 '24 10:11 vhsantos

Yes, sorry about this, this somehow fell through the cracks.

adamruzicka avatar Nov 21 '24 13:11 adamruzicka

Could you please reword the commit message to 'Fixes #38030 - Allow remote execution become any user' to link it to the redmine issue https://projects.theforeman.org/issues/38030 and make the redmine issues check pass ?

adamruzicka avatar Nov 21 '24 13:11 adamruzicka

Sadly, you'll need to reword the commit itself, changing just the title of the pull request isn't enough to make the check happy.

adamruzicka avatar Nov 21 '24 13:11 adamruzicka

I hope that is enough now !! :-)

vhsantos avatar Nov 21 '24 14:11 vhsantos

@vhsantos Thank you and congratulations on your first contribution to foreman 🎉

adamruzicka avatar Nov 25 '24 12:11 adamruzicka