Prerequisites
There are no specific prerequisites for this feature.
The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
Security-Enhanced Linux (SELinux) is a solution that incorporates a strong, flexible Mandatory Access Control (MAC) architecture into Cisco IOS-XE platforms through a combination of a Linux kernel security module and system utilities.
SELinux provides an enhanced mechanism to enforce the separation of information based on confidentiality and integrity requirements. This approach helps prevent tampering and bypassing of application security mechanisms while limiting damage from malicious or flawed applications.
SELinux can operate either in Permissive mode or Enforcing mode when enabled on a system.
Permissive mode : SELinux does not enforce the policy and only generates system logs for any denials caused by policy violations. Operations are logged for resource access policy violations but not denied.
Enforcing mode: SELinux policy is enabled and enforced. It denies resource access based on the access policy rules, and generates system logs.
SELinux is enabled in Enforcing mode by default on supported Cisco IOS XE platforms. In the Enforcing mode, any system resource access that does not have the necessary allow policy is treated as a violation, and the operation is denied. The violating operation fails when a denial occurs, and system logs are generated. In Enforcing mode, the solution works in access-violation prevention mode.
There are no specific prerequisites for this feature.
There are no specific restrictions for this feature.
Use this example to configure SELinux in EXEC mode:
| Command or Action | Purpose |
|---|---|
|
set platform software selinux {default | enforcing | permissive} |
Device# set platform software selinux ?
default Set SELinux mode to default
enforcing Set SELinux mode to enforcing
permissive Set SELinux mode to permissive
Use this example to configure SELinux in configuration mode:
| Command or Action | Purpose |
|---|---|
|
platform security selinux {enforcing | permissive} |
Device(config)# platform security selinux
enforcing Set SELinux policy to Enforcing mode
permissive Set SELinux policy to Permissive mode
Device(config)# platform security selinux permissive
Device(config)#
*Oct 20 21:52:45.155: %IOSXE-1-PLATFORM: R0/0:
SELINUX_MODE_PROG: Platform Selinux confinement mode downgraded to permissive!
Device(config)#
|
Facility-Severity-Mnemonic |
%SELINUX-1-VIOLATION |
|---|---|
|
Severity-Meaning |
Alert Level Log |
|
Message |
N/A |
|
Message Explanation |
Resource access was made by the process for which a resource access policy does not exist. The operation was flagged, and resource access was denied. A system log was generated with information that process resource access has been denied. |
|
Component |
SELINUX |
|
Recommended Action |
Contact Cisco TAC with the following relevant information as attachments:
|
This example shows sample syslog messages:
Example 1:
*Nov 14 00:09:04.943: %SELINUX-1-VIOLATION: R0/0: audispd: type=AVC
msg=audit(1699927057.934:129): avc: denied { getattr } for pid=5899 comm="ls"
path="/root/test" dev="rootfs" ino=25839
scontext=system_u:system_r:polaris_iosd_t:s0
tcontext=system_u:object_r:admin_home_t:s0 tclass=file permissive=0Example 2:
*Nov 14 00:09:04.947: %SELINUX-1-VIOLATION: R0/0: audispd: t type=AVC
msg=audit(1699927198.486:130): avc: denied { write } for pid=6012 comm="echo"
path="/root/test" dev="rootfs" ino=25839
scontext=system_u:system_r:polaris_iosd_t:s0
tcontext=system_u:object_r:admin_home_t:s0 tclass=file permissive= 0Use the show platform software selinux command to view the SELinux configuration mode:
Device# show platform software selinux
=========================================
IOS-XE SELINUX STATUS
=========================================
SElinux Status : Enabled
Current Mode : Enforcing
Config file Mode : Enforcing
If there is an instance of an SELinux violation on your device or network, please reach out to Cisco TAC with these details:
The message exactly as it appears on the console or in the system log. For example:
device#request platform software trace archive target
flash:selinux_btrace_logs
Output of the show tech-support command (text file)
Archive of Btrace files from the box using this command:
request platform software trace archive target <URL>
Output of the show platform software selinux command