The nova statedir ownership container fails to set SELinux attributes

Bug #1989405 reported by Cristian Le
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
High
Takashi Kajinami

Bug Description

Deploying with environment template of `/usr/share/openstack-tripleo-heat-templates/environments/services/ironic-overcloud.yaml`, the deployment fails with a permission error:
```
+ command -v python3
+ python3 /container-config-scripts/nova_statedir_ownership.py
INFO:nova_statedir:Applying nova statedir ownership
INFO:nova_statedir:Target ownership for /var/lib/nova: 42436:42436
INFO:nova_statedir:Checking uid: 0 gid: 0 path: /var/lib/nova/
INFO:nova_statedir:Changing ownership of /var/lib/nova from 0:0 to 42436:42436
ERROR:nova_statedir:Could not set selinux context of /var/lib/nova to system_u:object_r:container_file_t:s0:
Traceback (most recent call last):
  File "/container-config-scripts/nova_statedir_ownership.py", line 100, in chcon
    selinux.lsetfilecon(self.path, context)
  File "/usr/lib64/python3.9/site-packages/selinux/__init__.py", line 627, in lsetfilecon
    return _selinux.lsetfilecon(path, con)
PermissionError: [Errno 13] Permission denied
Traceback (most recent call last):
  File "/container-config-scripts/nova_statedir_ownership.py", line 247, in <module>
    NovaStatedirOwnershipManager('/var/lib/nova', exclude_paths=get_exclude_paths()).run()
  File "/container-config-scripts/nova_statedir_ownership.py", line 227, in run
    pathinfo.chcon(self.target_secontext)
  File "/container-config-scripts/nova_statedir_ownership.py", line 100, in chcon
    selinux.lsetfilecon(self.path, context)
  File "/usr/lib64/python3.9/site-packages/selinux/__init__.py", line 627, in lsetfilecon
    return _selinux.lsetfilecon(path, con)
PermissionError: [Errno 13] Permission denied
```

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-heat-templates (master)
Changed in tripleo:
status: New → In Progress
Changed in tripleo:
importance: Undecided → High
milestone: none → zed-1
assignee: nobody → Takashi Kajinami (kajinamit)
summary: - nova-ironic-container-puppet fails to set SELinux attributes
+ The nova statedir ownership container fails to set SELinux attributes
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-heat-templates (master)

Reviewed: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/857263
Committed: https://opendev.org/openstack/tripleo-heat-templates/commit/5060be800c8d771e5f1fbfa93d93e89287b5ae17
Submitter: "Zuul (22348)"
Branch: master

commit 5060be800c8d771e5f1fbfa93d93e89287b5ae17
Author: Takashi Kajinami <email address hidden>
Date: Tue Sep 13 14:43:58 2022 +0900

    nova-ironic: Fix selinux denial when relabeling /var/lib/nova

    This is partial revert of 6c26d3378dc313a530042e3484db32c66d564b3e and
    readds label=disable to reintroduce the fix[1] for denial when
    the command inside the container tries to relabel /var/lib/nova.

    [1] cb889805334a7cd7325b2a9a1efe2bd00bd48c31

    Closes-Bug: #1989405
    Change-Id: Ie18178c99a26c6cbdb52ac437965595224133217

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-heat-templates 17.0.0

This issue was fixed in the openstack/tripleo-heat-templates 17.0.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.