Bug 908773

Summary: python: seobject - Cannot modify selinux bool
Product: [Fedora] Fedora Reporter: Douglas Schilling Landgraf <dougsland>
Component: policycoreutilsAssignee: Daniel Walsh <dwalsh>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 17CC: bazulay, danken, dwalsh, fsimonce, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: policycoreutils-2.1.13-27.3.fc17 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-01 02:26:58 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 Douglas Schilling Landgraf 2013-02-07 13:40:32 UTC
Description of problem:

Unable to change selinux boolean, affecting VDSM installation.

# cat /etc/fedora-release
Fedora release 17 (Beefy Miracle)

kernel-3.7.4-104.fc17.x86_64
policycoreutils-2.1.13-27.2.fc17.x86_64
policycoreutils-sandbox-2.1.13-27.2.fc17.x86_64
policycoreutils-restorecond-2.1.13-27.2.fc17.x86_64
policycoreutils-python-2.1.13-27.2.fc17.x86_64

libselinux-utils-2.1.10-3.fc17.x86_64
selinux-policy-targeted-3.10.0-167.fc17.noarch
libselinux-python-2.1.10-3.fc17.x86_64
selinux-policy-devel-3.10.0-167.fc17.noarch
libselinux-2.1.10-3.fc17.x86_64
selinux-policy-3.10.0-167.fc17.noarch

# vdsm-tool sebool-config
Traceback (most recent call last):
  File "/bin/vdsm-tool", line 143, in <module>
    sys.exit(main())
  File "/bin/vdsm-tool", line 140, in main
    return tool_command[cmd]["command"](*args[1:])
  File "/usr/lib64/python2.7/site-packages/vdsm/tool/seboolsetup.py", line 57, in sebool_config
    setup_booleans(True)
  File "/usr/lib64/python2.7/site-packages/vdsm/tool/seboolsetup.py", line 46, in setup_booleans
    sebool_obj.modify(sebool_variable, SEBOOL_ENABLED)
  File "/usr/lib64/python2.7/site-packages/seobject.py", line 2041, in modify
    self.__mod(name, value)
  File "/usr/lib64/python2.7/site-packages/seobject.py", line 1995, in __mod
    name = selinux.selinux_boolean_sub(name)
AttributeError: 'module' object has no attribute 'selinux_boolean_sub'

Code
=============
import seobject
from vdsm.tool import expose

SEBOOL_ENABLED = "on"
SEBOOL_DISABLED = "off"

VDSM_SEBOOL_LIST = [
    "virt_use_fusefs",
    "virt_use_nfs",
    "virt_use_samba",
    "virt_use_sanlock",
    "sanlock_use_fusefs",
    "sanlock_use_nfs",
    "sanlock_use_samba",
]

def setup_booleans(status):
    sebool_obj = seobject.booleanRecords()
    sebool_status = sebool_obj.get_all()

    sebool_obj.start()

    for sebool_variable in VDSM_SEBOOL_LIST:
        if status and not all(sebool_status[sebool_variable]):
            sebool_obj.modify(sebool_variable, SEBOOL_ENABLED)

        if not status and any(sebool_status[sebool_variable]):
            sebool_obj.modify(sebool_variable, SEBOOL_DISABLED)

Comment 1 Daniel Walsh 2013-02-08 17:39:11 UTC
Fixed in policycoreutils-2.1.13-27.3.fc17

Comment 2 Fedora Update System 2013-02-08 19:28:47 UTC
policycoreutils-2.1.13-27.3.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/policycoreutils-2.1.13-27.3.fc17

Comment 3 Fedora Update System 2013-02-09 11:22:12 UTC
Package policycoreutils-2.1.13-27.3.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing policycoreutils-2.1.13-27.3.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-2163/policycoreutils-2.1.13-27.3.fc17
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2013-06-01 02:26:58 UTC
policycoreutils-2.1.13-27.3.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.