SlideShare a Scribd company logo
777
Customizing SELinux Policy
46.1. Introduction
In earlier releases of Red Hat Enterprise Linux it was necessary to install the selinux-policy-
targeted-sources packages and then to create a local.te file in the /etc/selinux/
targeted/src/policy/domains/misc directory. You could use the audit2allow utility to
translate the AVC messages into allow rules, and then rebuild and reload the policy.
The problem with this was that every time a new policy package was released it would have to
execute the Makefile in order to try to keep the local policy.
In Red Hat Enterprise Linux 5, this process has been completely revised. The "sources" rpm packages
have been completely removed, and policy packages are treated more like the kernel. To look
at the sources used to build the policy, you need to install the source rpm, selinux-policy-
XYZ.src.rpm. A further package, selinux-policy-devel, has also been added, which provides
further customization functionality.
46.1.1. Modular Policy
Red Hat Enterprise Linux introduces the concept of modular policy. This allows vendors to ship
SELinux policy separately from the operating system policy. It also allows administrators to make local
changes to policy without worrying about the next policy install. The most important command that was
added was semodule.
semodule is the tool used to manage SELinux policy modules, including installing, upgrading, listing
and removing modules. You can also use semodule to force a rebuild of policy from the module
store and/or to force a reload of policy without performing any other transaction. semodule acts
on module packages created by semodule_package. Conventionally, these files have a .pp suffix
(policy package), although this is not mandated in any way.
46.1.1.1. Listing Policy Modules
To list the policy modules on a system, use the semodule -l command:
[root@host2a ~]# semodule -l
amavis 1.1.0
ccs 1.0.0
clamav 1.1.0
dcc 1.1.0
evolution 1.1.0
iscsid 1.0.0
mozilla 1.1.0
mplayer 1.1.0
nagios 1.1.0
oddjob 1.0.1
pcscd 1.0.0
pyzor 1.1.0
razor 1.1.0
ricci 1.0.0
smart mon 1.1.0
778
Capítulo 46. Customizing SELinux Policy
Note
This command does not list the base policy module, which is also installed.
The /usr/share/selinux/targeted/ directory contains a number of policy
package (*.pp) files. These files are included in the selinux-policy rpm and are
used to build the policy file.
46.2. Building a Local Policy Module
The following section uses an actual example to demonstrate building a local policy module to address
an issue with the current policy. This issue involves the ypbind init script, which executes the
setsebool command, which in turn tries to use the terminal. This is generating the following denial:
type=AVC msg=audit(1164222416.269:22): avc: denied { use } for pid=1940 comm="setsebool"
name="0" dev=devpts ino=2 
scontext=system_u:system_r:semanage_t:s0 tc onte xt=syste m_u:syste m_r:init_t:s0 tc lass=fd
Even though everything still works correctly (that is, it is not preventing any applications form running
as intended), it does interrupt the normal work flow of the user. Creating a local policy module
addresses this issue.
46.2.1. Using audit2allow to Build a Local Policy Module
The audit2allow utility now has the ability to build policy modules. Use the following command to
build a policy module based on specific contents of the audit.log file:
ausearch -m AVC --comm setsebool | audit2allow -M mysemanage
The audit2allow utility has built a type enforcement file (mysemanage.te). It then executed
the check module command to compile a module file (mysemanage.mod). Lastly, it uses
the semodule_package command to create a policy package (mysemanage.pp). The
semodule_package command combines different policy files (usually just the module and potentially
a file context file) into a policy package.
46.2.2. Analyzing the Type Enforcement (TE) File
Use the cat command to inspect the contents of the TE file:
[root@host2a ~]# cat mysemanag.te
module mysemanage 1.0;
require {
cla ss fd use ;
type init_t;
type semanage_t;
role syste m_r;
};
allow semanage_t init_t:fd use;
779
Loading the Policy Package
The TE file is comprised of three sections. The first section is the module command, which identifies
the module name and version. The module name must be unique. If you create an semanage module
using the name of a pre-existing module, the system would try to replace the existing module package
with the newly-created version. The last part of the module line is the version. semodule can update
module packages and checks the update version against the currently installed version.
The next block of the TE file is the require block. This informs the policy loader which types, classes
and roles are required in the system policy before this module can be installed. If any of these fields
are undefined, the semodule command will fail.
Lastly are the allow rules. In this example, you could modify this line to dontaudit, because
semodule does not need to access the file descriptor.
46.2.3. Loading the Policy Package
The last step in the process of creating a local policy module is to load the policy package into the
kernel.
Use the semodule command to load the policy package:
[root@host2a ~]# semodule -i mysemana ge.pp
This command recompiles the policy file and regenerates the file context file. The changes are
permanent and will survive a reboot. You can also copy the policy package file (mysemanage.pp) to
other machines and install it using semodule.
The audit2allow command outputs the commands it executed to create the policy package so that
you can edit the TE file. This means you can add new rules as required or change the allow rule to
dontaudit. You could then recompile and repackage the policy package to be installed again.
There is no limit to the number of policy packages, so you could create one for each local modification
you want to make. Alternatively, you could continue to edit a single package, but you need to ensure
that the "require" statements match all of the allow rules.
780
781
Referencias
Las siguientes referencias apuntan a información adicional que es relevante a SELinux y Red Hat
Enterprise Linux pero que va más allá del propósito de este manual. Tenga en cuenta que debido
al rápido desarrollo de SELinux, este material podría ser aplicable únicamente a un lanzamiento
específico de Red Hat Enterprise Linux.
Libros
SELinux by Example
Mayer, MacMillan, and Caplan
Prentice Hall, 2007
Tutoriales y ayuda
Understanding and Customizing the Apache HTTP SELinux Policy
http://docs.fedoraproject.org/selinux-apache-fc3/
Tutorials and talks from Russell Coker
http://www.coker.com.au/selinux/talks/ibmtu-2004/
Generic Writing SELinux policy HOWTO
https://sourceforge.net/docman/display_doc.php?docid=21959[amp ]group_id=21266
1
Red Hat Knowledgebase
http://kbase.redhat.com/
Información general
Sitio web principal de NSA SELinux
http://www.nsa.gov/research/selinux/index.shtml
NSA SELinux, Preguntas frecuentes
http://www.nsa.gov/research/selinux/faqs.shtml
Fedora SELinux, Preguntas frecuentes
http://docs.fedoraproject.org/selinux-faq/
SELinux NSA's Open Source Security Enhanced Linux
http://www.oreilly.com/catalog/selinux/
Tecnologías
An Overview of Object Classes and Permissions
http://www.tresys.com/selinux/obj_perms_help.html
Integrating Flexible Support for Security Policies into the Linux Operating System (una historia de la
implementación de Flask en Linux, artículo en inglés)
http://www.nsa.gov/research/_files/selinux/papers/freenix01/freenix01.shtml
1
https://sourceforge.net/docman/display_doc.php?docid=21959[amp ]group_id=21266
Capítulo 47. Referencias
782
Implementing SELinux as a Linux Security Module
http://www.nsa.gov/research/selinux/index.shtmlpapers/module-abs.cfm
A Security Policy Configuration for the Security-Enhanced Linux
http://www.nsa.gov/research/_files/selinux/papers/policy/policy.shtml
Comunidad
Página de la comunidad SELinux
http://selinux.sourceforge.net
IRC
irc.freenode.net, #rhel-selinux
Capítulo 47. Referencias
783
Historia
Quick history of Flask
http://www.cs.utah.edu/flux/fluke/html/flask.html
Full background on Fluke
http://www.cs.utah.edu/flux/fluke/html/index.html

More Related Content

Similar to 46 customizing se linux policy

Deploy Application Files with Git
Deploy Application Files with GitDeploy Application Files with Git
Deploy Application Files with Git
Alec Clews
 
Readme
ReadmeReadme
Readme
rec2006
 
Managing Perl Installations: A SysAdmin's View
Managing Perl Installations: A SysAdmin's ViewManaging Perl Installations: A SysAdmin's View
Managing Perl Installations: A SysAdmin's View
Baden Hughes
 
SELinux Basic Usage
SELinux Basic UsageSELinux Basic Usage
SELinux Basic Usage
Dmytro Minochkin
 
The Domino 10 RHEL 7 Primer
The Domino 10 RHEL 7 PrimerThe Domino 10 RHEL 7 Primer
The Domino 10 RHEL 7 Primer
Bill Malchisky Jr.
 
Unix Automation using centralized configuration management tool
Unix Automation using centralized configuration management toolUnix Automation using centralized configuration management tool
Unix Automation using centralized configuration management tool
Torrid Networks Private Limited
 
Unix Automation using centralized configuration management tool
Unix Automation using centralized configuration management toolUnix Automation using centralized configuration management tool
Unix Automation using centralized configuration management tool
Torrid Networks Private Limited
 
Drupal Modules
Drupal ModulesDrupal Modules
Drupal Modules
Amit Kumar Singh
 
Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Upgrading to MySQL 8.0 webinar slides November 27th, 2019Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Dave Stokes
 
CMSIS_RTOS_Tutorial.pdf
CMSIS_RTOS_Tutorial.pdfCMSIS_RTOS_Tutorial.pdf
CMSIS_RTOS_Tutorial.pdf
chau44
 
2008-07-30 IBM Teach the Teacher (IBM T3), Red Hat Update for System z
2008-07-30 IBM Teach the Teacher (IBM T3), Red Hat Update for System z2008-07-30 IBM Teach the Teacher (IBM T3), Red Hat Update for System z
2008-07-30 IBM Teach the Teacher (IBM T3), Red Hat Update for System z
Shawn Wells
 
First steps on CentOs7
First steps on CentOs7First steps on CentOs7
First steps on CentOs7
Marc Cortinas Val
 
Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)
sroo galal
 
Puppet quick start guide
Puppet quick start guidePuppet quick start guide
Puppet quick start guide
Suhan Dharmasuriya
 
AtoZ about TYPO3 v8 CMS
AtoZ about TYPO3 v8 CMSAtoZ about TYPO3 v8 CMS
AtoZ about TYPO3 v8 CMS
NITSAN Technologies Pvt Ltd
 
Cgroup resource mgmt_v1
Cgroup resource mgmt_v1Cgroup resource mgmt_v1
Cgroup resource mgmt_v1
sprdd
 
Cgroup resource mgmt_v1
Cgroup resource mgmt_v1Cgroup resource mgmt_v1
Cgroup resource mgmt_v1
sprdd
 
Exploit Frameworks
Exploit FrameworksExploit Frameworks
Exploit Frameworks
phanleson
 
SELinux concept in rhel_Linux_today.pptx
SELinux concept in rhel_Linux_today.pptxSELinux concept in rhel_Linux_today.pptx
SELinux concept in rhel_Linux_today.pptx
AbhradipChatterjee2
 
MKT 100Week 6 Assignment{Enter Student Name Here}{Enter Bu.docx
MKT 100Week 6 Assignment{Enter Student Name Here}{Enter Bu.docxMKT 100Week 6 Assignment{Enter Student Name Here}{Enter Bu.docx
MKT 100Week 6 Assignment{Enter Student Name Here}{Enter Bu.docx
kendalfarrier
 

Similar to 46 customizing se linux policy (20)

Deploy Application Files with Git
Deploy Application Files with GitDeploy Application Files with Git
Deploy Application Files with Git
 
Readme
ReadmeReadme
Readme
 
Managing Perl Installations: A SysAdmin's View
Managing Perl Installations: A SysAdmin's ViewManaging Perl Installations: A SysAdmin's View
Managing Perl Installations: A SysAdmin's View
 
SELinux Basic Usage
SELinux Basic UsageSELinux Basic Usage
SELinux Basic Usage
 
The Domino 10 RHEL 7 Primer
The Domino 10 RHEL 7 PrimerThe Domino 10 RHEL 7 Primer
The Domino 10 RHEL 7 Primer
 
Unix Automation using centralized configuration management tool
Unix Automation using centralized configuration management toolUnix Automation using centralized configuration management tool
Unix Automation using centralized configuration management tool
 
Unix Automation using centralized configuration management tool
Unix Automation using centralized configuration management toolUnix Automation using centralized configuration management tool
Unix Automation using centralized configuration management tool
 
Drupal Modules
Drupal ModulesDrupal Modules
Drupal Modules
 
Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Upgrading to MySQL 8.0 webinar slides November 27th, 2019Upgrading to MySQL 8.0 webinar slides November 27th, 2019
Upgrading to MySQL 8.0 webinar slides November 27th, 2019
 
CMSIS_RTOS_Tutorial.pdf
CMSIS_RTOS_Tutorial.pdfCMSIS_RTOS_Tutorial.pdf
CMSIS_RTOS_Tutorial.pdf
 
2008-07-30 IBM Teach the Teacher (IBM T3), Red Hat Update for System z
2008-07-30 IBM Teach the Teacher (IBM T3), Red Hat Update for System z2008-07-30 IBM Teach the Teacher (IBM T3), Red Hat Update for System z
2008-07-30 IBM Teach the Teacher (IBM T3), Red Hat Update for System z
 
First steps on CentOs7
First steps on CentOs7First steps on CentOs7
First steps on CentOs7
 
Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)
 
Puppet quick start guide
Puppet quick start guidePuppet quick start guide
Puppet quick start guide
 
AtoZ about TYPO3 v8 CMS
AtoZ about TYPO3 v8 CMSAtoZ about TYPO3 v8 CMS
AtoZ about TYPO3 v8 CMS
 
Cgroup resource mgmt_v1
Cgroup resource mgmt_v1Cgroup resource mgmt_v1
Cgroup resource mgmt_v1
 
Cgroup resource mgmt_v1
Cgroup resource mgmt_v1Cgroup resource mgmt_v1
Cgroup resource mgmt_v1
 
Exploit Frameworks
Exploit FrameworksExploit Frameworks
Exploit Frameworks
 
SELinux concept in rhel_Linux_today.pptx
SELinux concept in rhel_Linux_today.pptxSELinux concept in rhel_Linux_today.pptx
SELinux concept in rhel_Linux_today.pptx
 
MKT 100Week 6 Assignment{Enter Student Name Here}{Enter Bu.docx
MKT 100Week 6 Assignment{Enter Student Name Here}{Enter Bu.docxMKT 100Week 6 Assignment{Enter Student Name Here}{Enter Bu.docx
MKT 100Week 6 Assignment{Enter Student Name Here}{Enter Bu.docx
 

More from Aprende Viendo

44 seguridad y se linux
44  seguridad y se linux44  seguridad y se linux
44 seguridad y se linux
Aprende Viendo
 
43 aseguramiento de su red
43  aseguramiento de su red43  aseguramiento de su red
43 aseguramiento de su red
Aprende Viendo
 
42 seguridad y autenticación
42  seguridad y autenticación42  seguridad y autenticación
42 seguridad y autenticación
Aprende Viendo
 
41 parámetros y módulos generales
41  parámetros y módulos generales41  parámetros y módulos generales
41 parámetros y módulos generales
Aprende Viendo
 
40 configuración del kernel y dispositivos
40  configuración del kernel y dispositivos40  configuración del kernel y dispositivos
40 configuración del kernel y dispositivos
Aprende Viendo
 
39 o profile
39  o profile39  o profile
39 o profile
Aprende Viendo
 
38 reunir información del sistema
38  reunir información del sistema38  reunir información del sistema
38 reunir información del sistema
Aprende Viendo
 
37 supervisión del sistema
37  supervisión del sistema37  supervisión del sistema
37 supervisión del sistema
Aprende Viendo
 
36 archivos de registro
36  archivos de registro36  archivos de registro
36 archivos de registro
Aprende Viendo
 
35 automated tasks
35  automated tasks35  automated tasks
35 automated tasks
Aprende Viendo
 
34 configuración de la impresora
34  configuración de la impresora34  configuración de la impresora
34 configuración de la impresora
Aprende Viendo
 
33 usuarios y grupos
33  usuarios y grupos33  usuarios y grupos
33 usuarios y grupos
Aprende Viendo
 
32 configuración del sistema x window
32  configuración del sistema x window32  configuración del sistema x window
32 configuración del sistema x window
Aprende Viendo
 
31 el sistema x window
31  el sistema x window31  el sistema x window
31 el sistema x window
Aprende Viendo
 
29 configuración de la fecha y hora
29  configuración de la fecha y hora29  configuración de la fecha y hora
29 configuración de la fecha y hora
Aprende Viendo
 
27 configuración del sistema
27  configuración del sistema27  configuración del sistema
27 configuración del sistema
Aprende Viendo
 
28 el directorio sysconfig
28  el directorio sysconfig28  el directorio sysconfig
28 el directorio sysconfig
Aprende Viendo
 
25 protocolo ligero de acceso a directorios ldap
25  protocolo ligero de acceso a directorios ldap25  protocolo ligero de acceso a directorios ldap
25 protocolo ligero de acceso a directorios ldap
Aprende Viendo
 
24 correo electrónico
24  correo electrónico24  correo electrónico
24 correo electrónico
Aprende Viendo
 
22 apache http server
22  apache http server22  apache http server
22 apache http server
Aprende Viendo
 

More from Aprende Viendo (20)

44 seguridad y se linux
44  seguridad y se linux44  seguridad y se linux
44 seguridad y se linux
 
43 aseguramiento de su red
43  aseguramiento de su red43  aseguramiento de su red
43 aseguramiento de su red
 
42 seguridad y autenticación
42  seguridad y autenticación42  seguridad y autenticación
42 seguridad y autenticación
 
41 parámetros y módulos generales
41  parámetros y módulos generales41  parámetros y módulos generales
41 parámetros y módulos generales
 
40 configuración del kernel y dispositivos
40  configuración del kernel y dispositivos40  configuración del kernel y dispositivos
40 configuración del kernel y dispositivos
 
39 o profile
39  o profile39  o profile
39 o profile
 
38 reunir información del sistema
38  reunir información del sistema38  reunir información del sistema
38 reunir información del sistema
 
37 supervisión del sistema
37  supervisión del sistema37  supervisión del sistema
37 supervisión del sistema
 
36 archivos de registro
36  archivos de registro36  archivos de registro
36 archivos de registro
 
35 automated tasks
35  automated tasks35  automated tasks
35 automated tasks
 
34 configuración de la impresora
34  configuración de la impresora34  configuración de la impresora
34 configuración de la impresora
 
33 usuarios y grupos
33  usuarios y grupos33  usuarios y grupos
33 usuarios y grupos
 
32 configuración del sistema x window
32  configuración del sistema x window32  configuración del sistema x window
32 configuración del sistema x window
 
31 el sistema x window
31  el sistema x window31  el sistema x window
31 el sistema x window
 
29 configuración de la fecha y hora
29  configuración de la fecha y hora29  configuración de la fecha y hora
29 configuración de la fecha y hora
 
27 configuración del sistema
27  configuración del sistema27  configuración del sistema
27 configuración del sistema
 
28 el directorio sysconfig
28  el directorio sysconfig28  el directorio sysconfig
28 el directorio sysconfig
 
25 protocolo ligero de acceso a directorios ldap
25  protocolo ligero de acceso a directorios ldap25  protocolo ligero de acceso a directorios ldap
25 protocolo ligero de acceso a directorios ldap
 
24 correo electrónico
24  correo electrónico24  correo electrónico
24 correo electrónico
 
22 apache http server
22  apache http server22  apache http server
22 apache http server
 

Recently uploaded

Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 

Recently uploaded (20)

Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 

46 customizing se linux policy

  • 1. 777 Customizing SELinux Policy 46.1. Introduction In earlier releases of Red Hat Enterprise Linux it was necessary to install the selinux-policy- targeted-sources packages and then to create a local.te file in the /etc/selinux/ targeted/src/policy/domains/misc directory. You could use the audit2allow utility to translate the AVC messages into allow rules, and then rebuild and reload the policy. The problem with this was that every time a new policy package was released it would have to execute the Makefile in order to try to keep the local policy. In Red Hat Enterprise Linux 5, this process has been completely revised. The "sources" rpm packages have been completely removed, and policy packages are treated more like the kernel. To look at the sources used to build the policy, you need to install the source rpm, selinux-policy- XYZ.src.rpm. A further package, selinux-policy-devel, has also been added, which provides further customization functionality. 46.1.1. Modular Policy Red Hat Enterprise Linux introduces the concept of modular policy. This allows vendors to ship SELinux policy separately from the operating system policy. It also allows administrators to make local changes to policy without worrying about the next policy install. The most important command that was added was semodule. semodule is the tool used to manage SELinux policy modules, including installing, upgrading, listing and removing modules. You can also use semodule to force a rebuild of policy from the module store and/or to force a reload of policy without performing any other transaction. semodule acts on module packages created by semodule_package. Conventionally, these files have a .pp suffix (policy package), although this is not mandated in any way. 46.1.1.1. Listing Policy Modules To list the policy modules on a system, use the semodule -l command: [root@host2a ~]# semodule -l amavis 1.1.0 ccs 1.0.0 clamav 1.1.0 dcc 1.1.0 evolution 1.1.0 iscsid 1.0.0 mozilla 1.1.0 mplayer 1.1.0 nagios 1.1.0 oddjob 1.0.1 pcscd 1.0.0 pyzor 1.1.0 razor 1.1.0 ricci 1.0.0 smart mon 1.1.0
  • 2. 778 Capítulo 46. Customizing SELinux Policy Note This command does not list the base policy module, which is also installed. The /usr/share/selinux/targeted/ directory contains a number of policy package (*.pp) files. These files are included in the selinux-policy rpm and are used to build the policy file. 46.2. Building a Local Policy Module The following section uses an actual example to demonstrate building a local policy module to address an issue with the current policy. This issue involves the ypbind init script, which executes the setsebool command, which in turn tries to use the terminal. This is generating the following denial: type=AVC msg=audit(1164222416.269:22): avc: denied { use } for pid=1940 comm="setsebool" name="0" dev=devpts ino=2 scontext=system_u:system_r:semanage_t:s0 tc onte xt=syste m_u:syste m_r:init_t:s0 tc lass=fd Even though everything still works correctly (that is, it is not preventing any applications form running as intended), it does interrupt the normal work flow of the user. Creating a local policy module addresses this issue. 46.2.1. Using audit2allow to Build a Local Policy Module The audit2allow utility now has the ability to build policy modules. Use the following command to build a policy module based on specific contents of the audit.log file: ausearch -m AVC --comm setsebool | audit2allow -M mysemanage The audit2allow utility has built a type enforcement file (mysemanage.te). It then executed the check module command to compile a module file (mysemanage.mod). Lastly, it uses the semodule_package command to create a policy package (mysemanage.pp). The semodule_package command combines different policy files (usually just the module and potentially a file context file) into a policy package. 46.2.2. Analyzing the Type Enforcement (TE) File Use the cat command to inspect the contents of the TE file: [root@host2a ~]# cat mysemanag.te module mysemanage 1.0; require { cla ss fd use ; type init_t; type semanage_t; role syste m_r; }; allow semanage_t init_t:fd use;
  • 3. 779 Loading the Policy Package The TE file is comprised of three sections. The first section is the module command, which identifies the module name and version. The module name must be unique. If you create an semanage module using the name of a pre-existing module, the system would try to replace the existing module package with the newly-created version. The last part of the module line is the version. semodule can update module packages and checks the update version against the currently installed version. The next block of the TE file is the require block. This informs the policy loader which types, classes and roles are required in the system policy before this module can be installed. If any of these fields are undefined, the semodule command will fail. Lastly are the allow rules. In this example, you could modify this line to dontaudit, because semodule does not need to access the file descriptor. 46.2.3. Loading the Policy Package The last step in the process of creating a local policy module is to load the policy package into the kernel. Use the semodule command to load the policy package: [root@host2a ~]# semodule -i mysemana ge.pp This command recompiles the policy file and regenerates the file context file. The changes are permanent and will survive a reboot. You can also copy the policy package file (mysemanage.pp) to other machines and install it using semodule. The audit2allow command outputs the commands it executed to create the policy package so that you can edit the TE file. This means you can add new rules as required or change the allow rule to dontaudit. You could then recompile and repackage the policy package to be installed again. There is no limit to the number of policy packages, so you could create one for each local modification you want to make. Alternatively, you could continue to edit a single package, but you need to ensure that the "require" statements match all of the allow rules.
  • 4. 780
  • 5. 781 Referencias Las siguientes referencias apuntan a información adicional que es relevante a SELinux y Red Hat Enterprise Linux pero que va más allá del propósito de este manual. Tenga en cuenta que debido al rápido desarrollo de SELinux, este material podría ser aplicable únicamente a un lanzamiento específico de Red Hat Enterprise Linux. Libros SELinux by Example Mayer, MacMillan, and Caplan Prentice Hall, 2007 Tutoriales y ayuda Understanding and Customizing the Apache HTTP SELinux Policy http://docs.fedoraproject.org/selinux-apache-fc3/ Tutorials and talks from Russell Coker http://www.coker.com.au/selinux/talks/ibmtu-2004/ Generic Writing SELinux policy HOWTO https://sourceforge.net/docman/display_doc.php?docid=21959[amp ]group_id=21266 1 Red Hat Knowledgebase http://kbase.redhat.com/ Información general Sitio web principal de NSA SELinux http://www.nsa.gov/research/selinux/index.shtml NSA SELinux, Preguntas frecuentes http://www.nsa.gov/research/selinux/faqs.shtml Fedora SELinux, Preguntas frecuentes http://docs.fedoraproject.org/selinux-faq/ SELinux NSA's Open Source Security Enhanced Linux http://www.oreilly.com/catalog/selinux/ Tecnologías An Overview of Object Classes and Permissions http://www.tresys.com/selinux/obj_perms_help.html Integrating Flexible Support for Security Policies into the Linux Operating System (una historia de la implementación de Flask en Linux, artículo en inglés) http://www.nsa.gov/research/_files/selinux/papers/freenix01/freenix01.shtml 1 https://sourceforge.net/docman/display_doc.php?docid=21959[amp ]group_id=21266
  • 6. Capítulo 47. Referencias 782 Implementing SELinux as a Linux Security Module http://www.nsa.gov/research/selinux/index.shtmlpapers/module-abs.cfm A Security Policy Configuration for the Security-Enhanced Linux http://www.nsa.gov/research/_files/selinux/papers/policy/policy.shtml Comunidad Página de la comunidad SELinux http://selinux.sourceforge.net IRC irc.freenode.net, #rhel-selinux
  • 7. Capítulo 47. Referencias 783 Historia Quick history of Flask http://www.cs.utah.edu/flux/fluke/html/flask.html Full background on Fluke http://www.cs.utah.edu/flux/fluke/html/index.html