Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.4.4 fails due to wrong umask and error #13

Closed
shashank-singhal opened this issue May 28, 2020 · 3 comments · Fixed by #15
Closed

5.4.4 fails due to wrong umask and error #13

shashank-singhal opened this issue May 28, 2020 · 3 comments · Fixed by #15
Assignees
Labels
bug Something isn't working

Comments

@shashank-singhal
Copy link

shashank-singhal commented May 28, 2020

Ansible Version - 2.9.9

ISSUE

  1. The umask variable centos7cis_default_user_umask changes to 023 instead of 027 when executing. (not sure if it my system specific issue)

line: 'umask {{ centos7cis_default_user_umask }}'

line: 'umask {{ centos7cis_default_user_umask }}'

  1. The profiled_dir.files.path fails
    with_items: profiled_dir.files.path

with error as given below

TASK [CentOS7-CIS : SCORED | 5.4.4 | PATCH | Ensure default user umask is 027 or more restrictive] *********************************************************************
failed: [localhost] (item=profiled_dir.files[0].path) => {"ansible_loop_var": "item", "changed": false, "item": "profiled_dir.files[0].path", "msg": "Destination profiled_dir.files.path does not exist !", "rc": 257}
...ignoring

Workaround for centos7cis_default_user_umask changing to 023, run the ansible playbook with variables as command line argument by adding below argument
--extra-vars "centos7cis_default_user_umask=027"
which will overpower the internal variable value.

Viewpoint
The structure of the profiled_dir.files is an array of dictionaries. Not sure how to get through this one using ansible at the moment.

@shashank-singhal
Copy link
Author

I updated the centos7cis_default_user_umask in the main.yml to a string "027" and it picks 027 in the umask line.

@shashank-singhal
Copy link
Author

shashank-singhal commented May 28, 2020

Updated

with_items: profiled_dir.files.path

to

 with_items:
  - "{{ profiled_dir.files }}"

and

dest: "{{ item }}"

to
dest: "{{ item.path}}"

and now it works.

I am still learning ansible and was driven to the above refactoring by the errors provided by ansible. Please enlighten me if this change in syntax is due to the version I am using ansible 2.9.9

@radsec radsec self-assigned this May 28, 2020
@radsec radsec added the bug Something isn't working label May 28, 2020
@radsec
Copy link
Owner

radsec commented May 28, 2020

I will look into resolving the issue this evening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants