eigenstate-ipa

SELinux Map Capabilities

Related docs:

  SELINUX MAP PLUGIN     SELINUX MAP USE CASES     HBAC RULE PLUGIN     DOCS MAP  

Purpose

Use this guide to choose the right SELinux map query pattern for your automation.

It is the companion to the selinuxmap plugin reference. Use the reference for exact option syntax; use this guide when you are designing a confinement validation workflow and need to know which capability fits your situation.

Contents

Capability Model

flowchart LR
    need["Confinement state question"]
    map["Map exists and enabled?"]
    context["Correct SELinux user context?"]
    scope["Direct membership or HBAC-linked?"]
    gate["Assert or gate"]
    act["Proceed or fail"]

    need --> map
    need --> context
    need --> scope
    map --> gate
    context --> gate
    scope --> gate
    gate --> act

The selinuxmap plugin is a read-only pre-flight primitive. It does not create or modify IdM objects. Use it to answer confinement state questions and to gate automation that should only proceed when the SELinux map model is correct.

1. Pre-flight Before Deploying to a Host

Use eigenstate.ipa.selinuxmap before a play deploys to a host when the deployment depends on the target having correct SELinux confinement configured in IdM.

Typical cases:

flowchart LR
    check["selinuxmap show\nmap name"] --> exists{"exists?"}
    exists -->|no| fail["fail - map not registered in IdM"]
    exists -->|yes| enabled{"enabled?"}
    enabled -->|no| fail2["fail - map is disabled"]
    enabled -->|yes| deploy["proceed to deploy"]

Why this pattern fits:

2. Validate Confinement Context Is Correct

Use eigenstate.ipa.selinuxmap to assert that a specific SELinux user string is assigned, not just that the map exists.

Typical cases:

flowchart LR
    check["selinuxmap show\nmap name"] --> exists{"exists\nand enabled?"}
    exists -->|no| fail["fail - map absent or disabled"]
    exists -->|yes| context{"selinuxuser is\nexpected value?"}
    context -->|no| fail2["fail - wrong context assigned"]
    context -->|yes| pass["confinement context confirmed"]

Why this pattern fits:

3. Validate HBAC-Linked Map and Its Rule Together

Use eigenstate.ipa.selinuxmap and eigenstate.ipa.hbacrule together when the map’s scope comes from an HBAC rule rather than direct membership.

Typical cases:

flowchart LR
    selinux["selinuxmap show\nmap name"] --> hbac_linked{"hbacrule\nnot null?"}
    hbac_linked -->|no| direct["direct membership -\nassert users/hosts directly"]
    hbac_linked -->|yes| hbac["hbacrule show\nlinked rule name"]
    hbac --> both{"map enabled\nand rule enabled?"}
    both -->|no| fail["fail - confinement or\naccess boundary inactive"]
    both -->|yes| pass["full confinement model confirmed"]

Why this pattern fits:

4. Confirm Map Is Disabled During Maintenance Windows

Use eigenstate.ipa.selinuxmap to verify that a confinement map is disabled before performing maintenance that requires elevated access, then re-assert that it is re-enabled afterward.

Typical cases:

flowchart LR
    pre["selinuxmap show\nbefore maintenance"] --> disabled{"enabled=false?"}
    disabled -->|no| fail["fail - map still active,\ndo not proceed"]
    disabled -->|yes| work["perform maintenance tasks"]
    work --> post["selinuxmap show\nafter maintenance"]
    post --> re_enabled{"enabled=true?"}
    re_enabled -->|no| alert["alert - confinement not restored"]
    re_enabled -->|yes| close["close change window"]

Why this pattern fits:

5. Bulk Audit of All SELinux Maps

Use operation=find to enumerate all SELinux user maps and report on their state.

Typical cases:

flowchart LR
    find["selinuxmap find"] --> all["all maps in IdM"]
    all --> filter["filter by selinuxuser,\nenabled, or hbacrule"]
    filter --> report["report or assert"]

Why this pattern fits:

6. Pipeline Gate — Abort When Confinement Is Missing

Use ansible.builtin.assert with the selinuxmap record to abort a pipeline stage when required confinement infrastructure is absent.

Typical cases:

flowchart LR
    check["selinuxmap show\nall required maps"] --> assert{"all exist\nand enabled?"}
    assert -->|yes| deploy["proceed to deploy stage"]
    assert -->|no| abort["fail with diagnostic message"]

Why this pattern fits:

7. Cross-Plugin: Map Lookup Then HBAC Validation

Combine eigenstate.ipa.selinuxmap and eigenstate.ipa.hbacrule in the same play to validate the complete confinement and access model.

flowchart LR
    map["selinuxmap show\nmap name"] --> linked{"has hbacrule?"}
    linked -->|no| direct_assert["assert direct\nusers/hosts present"]
    linked -->|yes| hbac["hbacrule show\nmap.hbacrule"]
    hbac --> hbac_enabled{"rule enabled?"}
    hbac_enabled -->|no| fail["fail - HBAC rule inactive"]
    hbac_enabled -->|yes| test["hbacrule test\nconfirm access granted"]
    test --> pass["full model validated"]

Use this pattern in compliance or pre-deploy roles that need to confirm both that the SELinux confinement boundary is active and that the access boundary it depends on is operational. The hbacrule operation=test step adds a live simulation of whether the identity would be permitted access.

Quick Decision Matrix

Need Best capability
Confirm map exists and is enabled before deploying Pre-flight before deploy (#1)
Assert specific SELinux context is assigned Validate confinement context (#2)
Validate map and its linked HBAC rule together HBAC-linked map validation (#3)
Confirm map is disabled during maintenance window Maintenance window gate (#4)
List all maps and their confinement state Bulk audit (#5)
Abort pipeline if any required map is missing Pipeline gate (#6)
Validate confinement + access boundary in one play Cross-plugin: map + hbacrule (#7)

For option-level behavior, field definitions, and exact lookup syntax, return to SELINUX MAP PLUGIN.