public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
From: Daniel Gomez <da.gomez@kernel.org>
To: Chuck Lever <chuck.lever@oracle.com>,
	kdevops@lists.linux.dev, Luis Chamberlain <mcgrof@kernel.org>
Cc: Daniel Gomez <da.gomez@samsung.com>
Subject: Re: [PATCH] update_ssh_config_guestfs: fix incorrect task privilege
Date: Wed, 21 May 2025 09:41:16 +0200	[thread overview]
Message-ID: <a8296a66-4d32-4e8b-9e9a-a8c7d8256c2f@kernel.org> (raw)
In-Reply-To: <a7d87057-3415-456b-8a97-1f618b0e292c@oracle.com>



On 20/05/2025 15.21, Chuck Lever wrote:
> On 5/20/25 3:43 AM, Daniel Gomez wrote:
>> From: Daniel Gomez <da.gomez@samsung.com>
>>
>> This task does not require elevated privileges, so become: true is
>> unnecessary and can be removed. Its use was also causing the task to run
>> as root (the default become_user [1]), which led to the following error:
>>
>> task path:
>> /home/cel/src/kdevops/buildbot-configs/playbooks/roles/
>> update_ssh_config_guestfs/tasks/main.yml:73
>> fatal: [localhost]: FAILED! => {
>>      "changed": false,
>>      "path": "/root/.ssh/config",
>>      "state": "absent"
>> }
>>
>> MSG:
>>
>> file (/root/.ssh/config) is absent, cannot continue
>>
>> Ensure the task is only run when the conditions are appropiate, i.e.
>> when the file exists.
>>
>> [1]
>> https://docs.ansible.com/ansible/latest/playbook_guide/
>> playbooks_privilege_escalation.html#become-directives
>>
>> Fixes f301c9a ("guestfs: ensure right permissions for ssh config")
>>
>> Reported-by: Chuck Lever <chuck.lever@oracle.com>
>> Closes: https://lore.kernel.org/all/b2fb6337-f737-4ab9-94a5-f6d5d94db749@oracle.com/
>> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
>> ---
>>   playbooks/roles/update_ssh_config_guestfs/tasks/main.yml | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/playbooks/roles/update_ssh_config_guestfs/tasks/main.yml b/playbooks/roles/update_ssh_config_guestfs/tasks/main.yml
>> index 6c6c49034d8a0313cda5fd5ca673093f1a8054cf..6606a6c6b0e9393d5d3b455d5d0c3851636e2c59 100644
>> --- a/playbooks/roles/update_ssh_config_guestfs/tasks/main.yml
>> +++ b/playbooks/roles/update_ssh_config_guestfs/tasks/main.yml
>> @@ -71,9 +71,7 @@
>>         Include ~/.ssh/config_kdevops_*
>>   
>>   - name: Ensure ~/.ssh/config permissions
>> -  become: true
>> -  become_flags: 'su - -c'
>> -  become_method: ansible.builtin.sudo
>>     ansible.builtin.file:
>>       path: ~/.ssh/config
>>       mode: "0600"
>> +  when: ssh_config.stat.exists
>>
>> ---
>> base-commit: 3eaf4e7dd4fedff773d7ca1882329109b133911f
>> change-id: 20250520-fix-update_ssh_config_guestfs-10e989459fc4
>>
>> Best regards,
> 
> Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
> 
>    or
> 
> Tested-by: Chuck Lever <chuck.lever@oracle.com>
> 
> Take your pick!

b4 picked the best option: both.

Applied, thanks!


      reply	other threads:[~2025-05-21  7:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-20  7:43 [PATCH] update_ssh_config_guestfs: fix incorrect task privilege Daniel Gomez
2025-05-20 13:21 ` Chuck Lever
2025-05-21  7:41   ` Daniel Gomez [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a8296a66-4d32-4e8b-9e9a-a8c7d8256c2f@kernel.org \
    --to=da.gomez@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=da.gomez@samsung.com \
    --cc=kdevops@lists.linux.dev \
    --cc=mcgrof@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox