mirror of https://github.com/ansible/ansible.git
atomic_move - fix creating file in directory with setgid bit (#83718)
* fix creating file in directory with setgid bit * add a test using the copy module's content option to create a file in a directory with setgid bit Co-authored-by: Martin Krizek <martin.krizek@gmail.com>pull/82681/merge
parent
0d6b034103
commit
2b91c57c85
@ -0,0 +1,2 @@
|
|||||||
|
bugfixes:
|
||||||
|
- atomic_move - fix using the setgid bit on the parent directory when creating files (https://github.com/ansible/ansible/issues/46742, https://github.com/ansible/ansible/issues/67177).
|
@ -1,2 +1,3 @@
|
|||||||
---
|
---
|
||||||
remote_unprivileged_user: tmp_ansible_test_user
|
remote_unprivileged_user: tmp_ansible_test_user
|
||||||
|
remote_unprivileged_user_group: test_ansible_test_group
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
- block:
|
||||||
|
- name: Create test directory
|
||||||
|
file:
|
||||||
|
path: "{{ remote_tmp_dir }}/test_setgid"
|
||||||
|
state: directory
|
||||||
|
mode: '2750'
|
||||||
|
recurse: yes
|
||||||
|
owner: '{{ remote_unprivileged_user }}'
|
||||||
|
group: '{{ remote_unprivileged_user_group }}'
|
||||||
|
|
||||||
|
- name: Test creating a file respects setgid on parent dir
|
||||||
|
copy:
|
||||||
|
content: |
|
||||||
|
test file
|
||||||
|
dest: "{{ remote_tmp_dir }}/test_setgid/test.txt"
|
||||||
|
|
||||||
|
- stat:
|
||||||
|
path: "{{ remote_tmp_dir }}/test_setgid/test.txt"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- result.stat.gr_name == remote_unprivileged_user_group
|
||||||
|
always:
|
||||||
|
- file:
|
||||||
|
path: "{{ remote_tmp_dir }}/test_setgid"
|
||||||
|
state: absent
|
Loading…
Reference in New Issue