Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2087282

Summary: Getting "can't open file" for ipadnszone.py module when using fapolicyd
Product: Red Hat Enterprise Linux 9 Reporter: Mike Ralph <mralph>
Component: fapolicydAssignee: Radovan Sroka <rsroka>
Status: CLOSED MIGRATED QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: dapospis, twoerner
Target Milestone: rcKeywords: MigratedToJIRA, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-16 14:29:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mike Ralph 2022-05-17 18:54:50 UTC
Description of problem:
  When attempting to use the ipadnszone module on a RHEL 9.0 server that has fapolicyd running I am receiving:

module_stdout": "/usr/bin/python3: can't open file '/home/<user>/.ansible/tmp/ansible-tmp-1652812850.798601-56968-125412819555844/AnsiballZ_ipadnszone.py': [Errno 1] Operation not permitted\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 2


Version-Release number of selected component (if applicable):
  RHEL 9.0
  ansible-freeipa-1.7.0-1.fc35
  ansible-core-2.12.5-1.fc35

How reproducible:
  everytime


Steps to Reproduce:
1. install/enable/start fapolicyd
2. attempt to run module against a RHEL 9 server

Actual results:
  fails

Expected results:
  succeeds


Additional info:
  Role I am trying to run, it succeeds on RHEL 7&8:

- name: Allow PTR Sync on forward zone
  ipadnszone:
    ipaadmin_password: "{{ ipaadmin_password }}"
    name: "{{ ipaserver_domain }}"
    allow_sync_ptr: true
    dynamic_update: true
    state: present
- name: Allow PTR Sync on reverse zone
  ipadnszone:
    ipaadmin_password: "{{ ipaadmin_password }}"
    name: "{{ ipaserver_reverse_zones }}"
    allow_sync_ptr: true
    dynamic_update: true
    state: present

Comment 2 Thomas Woerner 2022-05-18 12:13:18 UTC
Is this issue only happening with ansible-freeipa modules or also with modules from ansible and other projects?

Comment 3 Thomas Woerner 2022-05-19 11:49:17 UTC
I verified this with a fresh RHEL-9 installation. After enabling fapolicyd I am only able to use Ansible with the root user, but not with the normal user.

This is a know bug: https://bugzilla.redhat.com/show_bug.cgi?id=1903549

Enabling gather_facts, the issue is happening already in

TASK [Gathering Facts] *********************************************************
fatal: [ipaserver..........]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.setup": {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "failed": true, "module_stderr": "Shared connection to ipaserver....... closed.\r\n", "module_stdout": "/usr/bin/python3: can't open file '/home/....../.ansible/tmp/ansible-tmp-1652960237.7173314-113125-237253228314937/AnsiballZ_setup.py': [Errno 1] Operation not permitted\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 2}}, "msg": "The following modules failed to execute: ansible.legacy.setup\n"}

This is no ansible-freeipa issue. Assigning to fapolicyd.

Comment 4 Radovan Sroka 2023-01-12 17:05:20 UTC
(In reply to Thomas Woerner from comment #3)
> I verified this with a fresh RHEL-9 installation. After enabling fapolicyd I
> am only able to use Ansible with the root user, but not with the normal user.
> 
> This is a know bug: https://bugzilla.redhat.com/show_bug.cgi?id=1903549
> 
> Enabling gather_facts, the issue is happening already in
> 
> TASK [Gathering Facts]
> *********************************************************
> fatal: [ipaserver..........]: FAILED! => {"ansible_facts": {}, "changed":
> false, "failed_modules": {"ansible.legacy.setup": {"ansible_facts":
> {"discovered_interpreter_python": "/usr/bin/python3"}, "failed": true,
> "module_stderr": "Shared connection to ipaserver....... closed.\r\n",
> "module_stdout": "/usr/bin/python3: can't open file
> '/home/....../.ansible/tmp/ansible-tmp-1652960237.7173314-113125-
> 237253228314937/AnsiballZ_setup.py': [Errno 1] Operation not permitted\r\n",
> "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 2}},
> "msg": "The following modules failed to execute: ansible.legacy.setup\n"}
> 
> This is no ansible-freeipa issue. Assigning to fapolicyd.

Yes, you are right. The original problem is that fapolicyd does not support non root users for ansible.

There are few possibilities how to allow something like that. E.g. you can add some rule to the rules.d directory.

Comment 6 Radovan Sroka 2023-08-16 14:29:43 UTC
This bug is going to be migrated.

Contact point for migration questions or issues: rsroka
Guidance for Bugzilla users to test their Jira account or create one if needed:

https://redhat.service-now.com/help?id=kb_article_view&sysparm_article=KB0016394
https://redhat.service-now.com/help?id=kb_article_view&sysparm_article=KB0016694
https://redhat.service-now.com/help?id=kb_article_view&sysparm_article=KB0016774