SlideShare a Scribd company logo
SELinux
1
SELinux
Security Enhanced Linux (SELinux) is another layer of security for
the Linux operating system.
Developed by the National Security Agency (NSA), it adds
protection for different files, applications, processes, and so on.
How to work with SELinux enabled and enforcing.
2
Understanding SELinux Modes 3
disabled SELinux is turned and doesn’t restrict anything.
permissive
SELinux is turned on, but it logs warnings only
when an action normally would have been
blocked.
enforcing SELinux is turned on and blocks actions related
to services.
Management of SELinux 4
• Shows the current status of SELinux
sestatus • Shows the enforcing status of SELinux
getenforce
• Changes the enforcing status of SELinux
setenforce
• Returns the Boolean value of a service option
getsebool
• Sets the Boolean value of a service option
setsebool
• Changes the context of a file, directory, or service
chcon
• Resets the context of an object
restorecon
sestatus command.
• Syntax: sestatus [options]
• Options:
• -b Displays all Booleans and their statuses
• -v Provides verbose output
5
Configuring SELinux
• You can change the mode in which SELinux operates by
changing the config file.
• The main config file is /etc/selinux/config.
• View the current details of the /etc/selinux/config file:
• # cat /etc/selinux/config
• # This file controls the state
6
config file
• Aside from editing the config file, you can also use the setenforce
command to change the status.
• Syntax: setenforce [ Enforcing | Permissive | 1 | 0 ]
• If the current mode is permissive, you can change it to enforcing with
the following:
• # setenforce enforcing
• Regardless of which method you use when changing the mode in
which SELinux runs, you are still required to reboot the system.
7
Service and Boolean Options
• To view the Boolean options, you can use the getsebool command
combined with grep to look for specific options.
• Syntax: getsebool [-a | boolean]
• Although you have not installed a web server yet, let’s look at the
Boolean options from it anyway.
8
Service and Boolean Options
• The reason behind this is that it has many options, making for
a good example.
• Query the Boolean options available for the httpd service
(Apache):
• # getsebool -a | grep http
• View the descriptions for the httpd service (Apache):
• # semanage boolean -l | grep http
9
Service and Boolean Options
• After deciding which Boolean you’d like to change, you need to
enable or disable the value appropriately.
• To enable or disable a Boolean option, you can use the
setsebool command.
• When using the command, you also need to use the -P option
for the change to be persistent.
• Syntax: setsebool [options] [boolean = <on (1) | (0)>]
• options
• -P Makes the changes persistent
10
Service and Boolean Options
• From the option listed here, suppose you want to be able to access your home
directory through the web server.
• In that case, you need to adjust the httpd_enable_homedirs Boolean for
this to happen.
• Change the value to disable protection of this particular option:
• # setsebool -P httpd_enable_homedirs=1
• Notice that this command uses the -P option to make sure that the changes are
persistent upon reboot.
• Now verify that it has been enabled:
• # getsebool httpd_enable_homedirs
• httpd_enable_homedirs - on
11
SELinux Troubleshooting
• When you’re troubleshooting SELinux issues, there are a few
packages that you should install first:
• # yum install –y policycoreutils-python policycoreutils selinux-policy
setroubleshoot-server
• You will also find the following two log files handy:
• /var/log/audit/audit.log Logs SELinux denials
• /var/log/messages Logs SELinux denials
12
SELinux Troubleshooting
• Each log file provides specific error messages when
denials occur, making them easier to search using grep.
• Two common commands you can use to hunt for error
messages include
• # grep “SELinux is preventing” /var/log/messages
• # grep “denied” /var/log/audit/audit.log
• Problems can arise in SELinux for numerous reasons.
• However, the top three include
13
SELinux Troubleshooting
• However, the top three include
• ■ Labeling problems—Using a nonstandard directory tends to cause
problems if the directory or files aren’t labeled correctly.
• ■ Correct context—When you’re moving files, they can lose or retain
incorrect contexts, causing access errors. Use the matchpathcon command
to verify the correct context.
• ■ Confined service—If certain Booleans are not enabled, a service may
have trouble operating or communicating with other services.
14
Policy Violations
• If you are having trouble with Booleans and need to
determine what a specific Boolean does, you can use the
semanage command as you saw earlier.
• To list all the Booleans with their current values and a
brief description, use the following:
• # semanage boolean –l
15
SELinux boolean Description
ftp_home_dir -> off Allow ftp to read and write files in
smartmon_3ware -> off Enable additional permissions
needed
xdm_sysadm_login -> off Allow xdm logins as sysadm
xen_use_nfs -> off Allow xen to manage nfs files
mozilla_read_content -> off Control mozilla content access
16
Policy Violations
• When a denial occurs on the system, you see an ID associated with it in
your log files.
• This ID can be used to determine a more detailed understanding of
what could be causing problems with your files or service.
• Use the sealert command to obtain more information from an ID:
• # sealert –l 0621a8c3-b182-49cf-9116-c78a9dd52199
• You can see that this command should give you enough information to
understand what is going on.
• Aside from Booleans, most of the SELinux issues should be minor.
17

More Related Content

Similar to 11 - SELinux in Red Hat

Migrating to Connections 6.0 – Been there, done that!
Migrating to Connections 6.0 – Been there, done that!Migrating to Connections 6.0 – Been there, done that!
Migrating to Connections 6.0 – Been there, done that!
LetsConnect
 
Connections Migration soccnx12
Connections Migration soccnx12Connections Migration soccnx12
Connections Migration soccnx12
Sharon James
 
IBM Connect 2016 - 60+ in 60 - Admin Tips Power Hour
IBM Connect 2016 - 60+ in 60 - Admin Tips Power HourIBM Connect 2016 - 60+ in 60 - Admin Tips Power Hour
IBM Connect 2016 - 60+ in 60 - Admin Tips Power Hour
Chris Miller
 
Nagios Conference 2014 - Sam Lansing - Advanced Features of Nagios XI
Nagios Conference 2014 - Sam Lansing - Advanced Features of Nagios XINagios Conference 2014 - Sam Lansing - Advanced Features of Nagios XI
Nagios Conference 2014 - Sam Lansing - Advanced Features of Nagios XI
Nagios
 
Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...
Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...
Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...
ManageEngine, Zoho Corporation
 
Network Configuration Manager Training - [Season 7] Part 1 - Configuration ba...
Network Configuration Manager Training - [Season 7] Part 1 - Configuration ba...Network Configuration Manager Training - [Season 7] Part 1 - Configuration ba...
Network Configuration Manager Training - [Season 7] Part 1 - Configuration ba...
ManageEngine, Zoho Corporation
 
Free training on NCM - Discovery & Disaster recovery
Free training on NCM - Discovery & Disaster recovery Free training on NCM - Discovery & Disaster recovery
Free training on NCM - Discovery & Disaster recovery
ManageEngine, Zoho Corporation
 
6 Tips to MySQL Performance Tuning
6 Tips to MySQL Performance Tuning6 Tips to MySQL Performance Tuning
6 Tips to MySQL Performance Tuning
OracleMySQL
 
Overview and features of NCM
Overview and features of NCMOverview and features of NCM
Overview and features of NCM
ManageEngine, Zoho Corporation
 
SVN
SVNSVN
Linux host review
Linux host reviewLinux host review
Linux host review
rglaal
 
Protecting confidential files using SE-Linux
Protecting confidential files using SE-LinuxProtecting confidential files using SE-Linux
Protecting confidential files using SE-Linux
Giuseppe Paterno'
 
Geek Sync | Handling HIPAA Compliance with Your Data Access
Geek Sync | Handling HIPAA Compliance with Your Data AccessGeek Sync | Handling HIPAA Compliance with Your Data Access
Geek Sync | Handling HIPAA Compliance with Your Data Access
IDERA Software
 
Liberty management
Liberty managementLiberty management
Liberty management
WASdev Community
 
Alfresco tuning part1
Alfresco tuning part1Alfresco tuning part1
Alfresco tuning part1
Luis Cabaceira
 
Alfresco tuning part1
Alfresco tuning part1Alfresco tuning part1
Alfresco tuning part1
Luis Cabaceira
 
Mysql 57-upcoming-changes
Mysql 57-upcoming-changesMysql 57-upcoming-changes
Mysql 57-upcoming-changes
Morgan Tocker
 
Less10 security mb3
Less10 security mb3Less10 security mb3
Less10 security mb3
Imran Ali
 
Test
TestTest
NCM Training - Part 1- Season 2 - Configuration backup & disaster recovery.
NCM Training - Part 1- Season 2 - Configuration backup & disaster recovery. NCM Training - Part 1- Season 2 - Configuration backup & disaster recovery.
NCM Training - Part 1- Season 2 - Configuration backup & disaster recovery.
ManageEngine, Zoho Corporation
 

Similar to 11 - SELinux in Red Hat (20)

Migrating to Connections 6.0 – Been there, done that!
Migrating to Connections 6.0 – Been there, done that!Migrating to Connections 6.0 – Been there, done that!
Migrating to Connections 6.0 – Been there, done that!
 
Connections Migration soccnx12
Connections Migration soccnx12Connections Migration soccnx12
Connections Migration soccnx12
 
IBM Connect 2016 - 60+ in 60 - Admin Tips Power Hour
IBM Connect 2016 - 60+ in 60 - Admin Tips Power HourIBM Connect 2016 - 60+ in 60 - Admin Tips Power Hour
IBM Connect 2016 - 60+ in 60 - Admin Tips Power Hour
 
Nagios Conference 2014 - Sam Lansing - Advanced Features of Nagios XI
Nagios Conference 2014 - Sam Lansing - Advanced Features of Nagios XINagios Conference 2014 - Sam Lansing - Advanced Features of Nagios XI
Nagios Conference 2014 - Sam Lansing - Advanced Features of Nagios XI
 
Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...
Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...
Network Configuration Manager Training - [Season 4] Part 1 - Configuration ba...
 
Network Configuration Manager Training - [Season 7] Part 1 - Configuration ba...
Network Configuration Manager Training - [Season 7] Part 1 - Configuration ba...Network Configuration Manager Training - [Season 7] Part 1 - Configuration ba...
Network Configuration Manager Training - [Season 7] Part 1 - Configuration ba...
 
Free training on NCM - Discovery & Disaster recovery
Free training on NCM - Discovery & Disaster recovery Free training on NCM - Discovery & Disaster recovery
Free training on NCM - Discovery & Disaster recovery
 
6 Tips to MySQL Performance Tuning
6 Tips to MySQL Performance Tuning6 Tips to MySQL Performance Tuning
6 Tips to MySQL Performance Tuning
 
Overview and features of NCM
Overview and features of NCMOverview and features of NCM
Overview and features of NCM
 
SVN
SVNSVN
SVN
 
Linux host review
Linux host reviewLinux host review
Linux host review
 
Protecting confidential files using SE-Linux
Protecting confidential files using SE-LinuxProtecting confidential files using SE-Linux
Protecting confidential files using SE-Linux
 
Geek Sync | Handling HIPAA Compliance with Your Data Access
Geek Sync | Handling HIPAA Compliance with Your Data AccessGeek Sync | Handling HIPAA Compliance with Your Data Access
Geek Sync | Handling HIPAA Compliance with Your Data Access
 
Liberty management
Liberty managementLiberty management
Liberty management
 
Alfresco tuning part1
Alfresco tuning part1Alfresco tuning part1
Alfresco tuning part1
 
Alfresco tuning part1
Alfresco tuning part1Alfresco tuning part1
Alfresco tuning part1
 
Mysql 57-upcoming-changes
Mysql 57-upcoming-changesMysql 57-upcoming-changes
Mysql 57-upcoming-changes
 
Less10 security mb3
Less10 security mb3Less10 security mb3
Less10 security mb3
 
Test
TestTest
Test
 
NCM Training - Part 1- Season 2 - Configuration backup & disaster recovery.
NCM Training - Part 1- Season 2 - Configuration backup & disaster recovery. NCM Training - Part 1- Season 2 - Configuration backup & disaster recovery.
NCM Training - Part 1- Season 2 - Configuration backup & disaster recovery.
 

More from Shafaan Khaliq Bhatti

1- Introduction to Red Hat
1- Introduction to Red Hat1- Introduction to Red Hat
1- Introduction to Red Hat
Shafaan Khaliq Bhatti
 
Linux Servers
Linux ServersLinux Servers
Linux Servers
Shafaan Khaliq Bhatti
 
5 - Networking in Red Hat
5 - Networking in Red Hat5 - Networking in Red Hat
5 - Networking in Red Hat
Shafaan Khaliq Bhatti
 
2- System Initialization in Red Hat
2- System Initialization in Red Hat2- System Initialization in Red Hat
2- System Initialization in Red Hat
Shafaan Khaliq Bhatti
 
3 - Disk Partitioning in Red Hat
3 - Disk Partitioning in Red Hat3 - Disk Partitioning in Red Hat
3 - Disk Partitioning in Red Hat
Shafaan Khaliq Bhatti
 
6 - Package Management in Red Hat
6 - Package Management in Red Hat6 - Package Management in Red Hat
6 - Package Management in Red Hat
Shafaan Khaliq Bhatti
 
7 - User Administration in Red Hat
7 - User Administration in Red Hat7 - User Administration in Red Hat
7 - User Administration in Red Hat
Shafaan Khaliq Bhatti
 
12 - System Security in Red Hat
12 - System Security in Red Hat12 - System Security in Red Hat
12 - System Security in Red Hat
Shafaan Khaliq Bhatti
 
15 lecture - acl part1, introduction to access control list
15   lecture  - acl part1, introduction to access control list15   lecture  - acl part1, introduction to access control list
15 lecture - acl part1, introduction to access control list
Shafaan Khaliq Bhatti
 
13 lecture - introduction and configuration of eigrp
13   lecture  - introduction and configuration of eigrp13   lecture  - introduction and configuration of eigrp
13 lecture - introduction and configuration of eigrp
Shafaan Khaliq Bhatti
 
10 lecture - ospf part1 , introduction to ospf , areas and abr
10   lecture  - ospf part1 , introduction to ospf , areas and abr10   lecture  - ospf part1 , introduction to ospf , areas and abr
10 lecture - ospf part1 , introduction to ospf , areas and abr
Shafaan Khaliq Bhatti
 
Message Authentication: MAC, Hashes
Message Authentication: MAC, HashesMessage Authentication: MAC, Hashes
Message Authentication: MAC, Hashes
Shafaan Khaliq Bhatti
 
Protocols for Public Key Management
Protocols for Public Key ManagementProtocols for Public Key Management
Protocols for Public Key Management
Shafaan Khaliq Bhatti
 
Authentication: keys, MAC
Authentication: keys, MACAuthentication: keys, MAC
Authentication: keys, MAC
Shafaan Khaliq Bhatti
 
Public key cryptography and RSA
Public key cryptography and RSAPublic key cryptography and RSA
Public key cryptography and RSA
Shafaan Khaliq Bhatti
 
Block Ciphers Modes of Operation
Block Ciphers Modes of OperationBlock Ciphers Modes of Operation
Block Ciphers Modes of Operation
Shafaan Khaliq Bhatti
 
Chapter 3: Block Ciphers and the Data Encryption Standard
Chapter 3: Block Ciphers and the Data Encryption StandardChapter 3: Block Ciphers and the Data Encryption Standard
Chapter 3: Block Ciphers and the Data Encryption Standard
Shafaan Khaliq Bhatti
 
Chapter 1: Overview of Network Security
Chapter 1: Overview of Network SecurityChapter 1: Overview of Network Security
Chapter 1: Overview of Network Security
Shafaan Khaliq Bhatti
 
Chapter 3: Processes
Chapter 3: ProcessesChapter 3: Processes
Chapter 3: Processes
Shafaan Khaliq Bhatti
 
Chapter 2: Operating System Structures
Chapter 2: Operating System StructuresChapter 2: Operating System Structures
Chapter 2: Operating System Structures
Shafaan Khaliq Bhatti
 

More from Shafaan Khaliq Bhatti (20)

1- Introduction to Red Hat
1- Introduction to Red Hat1- Introduction to Red Hat
1- Introduction to Red Hat
 
Linux Servers
Linux ServersLinux Servers
Linux Servers
 
5 - Networking in Red Hat
5 - Networking in Red Hat5 - Networking in Red Hat
5 - Networking in Red Hat
 
2- System Initialization in Red Hat
2- System Initialization in Red Hat2- System Initialization in Red Hat
2- System Initialization in Red Hat
 
3 - Disk Partitioning in Red Hat
3 - Disk Partitioning in Red Hat3 - Disk Partitioning in Red Hat
3 - Disk Partitioning in Red Hat
 
6 - Package Management in Red Hat
6 - Package Management in Red Hat6 - Package Management in Red Hat
6 - Package Management in Red Hat
 
7 - User Administration in Red Hat
7 - User Administration in Red Hat7 - User Administration in Red Hat
7 - User Administration in Red Hat
 
12 - System Security in Red Hat
12 - System Security in Red Hat12 - System Security in Red Hat
12 - System Security in Red Hat
 
15 lecture - acl part1, introduction to access control list
15   lecture  - acl part1, introduction to access control list15   lecture  - acl part1, introduction to access control list
15 lecture - acl part1, introduction to access control list
 
13 lecture - introduction and configuration of eigrp
13   lecture  - introduction and configuration of eigrp13   lecture  - introduction and configuration of eigrp
13 lecture - introduction and configuration of eigrp
 
10 lecture - ospf part1 , introduction to ospf , areas and abr
10   lecture  - ospf part1 , introduction to ospf , areas and abr10   lecture  - ospf part1 , introduction to ospf , areas and abr
10 lecture - ospf part1 , introduction to ospf , areas and abr
 
Message Authentication: MAC, Hashes
Message Authentication: MAC, HashesMessage Authentication: MAC, Hashes
Message Authentication: MAC, Hashes
 
Protocols for Public Key Management
Protocols for Public Key ManagementProtocols for Public Key Management
Protocols for Public Key Management
 
Authentication: keys, MAC
Authentication: keys, MACAuthentication: keys, MAC
Authentication: keys, MAC
 
Public key cryptography and RSA
Public key cryptography and RSAPublic key cryptography and RSA
Public key cryptography and RSA
 
Block Ciphers Modes of Operation
Block Ciphers Modes of OperationBlock Ciphers Modes of Operation
Block Ciphers Modes of Operation
 
Chapter 3: Block Ciphers and the Data Encryption Standard
Chapter 3: Block Ciphers and the Data Encryption StandardChapter 3: Block Ciphers and the Data Encryption Standard
Chapter 3: Block Ciphers and the Data Encryption Standard
 
Chapter 1: Overview of Network Security
Chapter 1: Overview of Network SecurityChapter 1: Overview of Network Security
Chapter 1: Overview of Network Security
 
Chapter 3: Processes
Chapter 3: ProcessesChapter 3: Processes
Chapter 3: Processes
 
Chapter 2: Operating System Structures
Chapter 2: Operating System StructuresChapter 2: Operating System Structures
Chapter 2: Operating System Structures
 

Recently uploaded

Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
Iris Thiele Isip-Tan
 
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptxA Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
OH TEIK BIN
 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
National Information Standards Organization (NISO)
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
Accounting for Restricted Grants When and How To Record Properly
Accounting for Restricted Grants  When and How To Record ProperlyAccounting for Restricted Grants  When and How To Record Properly
Accounting for Restricted Grants When and How To Record Properly
TechSoup
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
khuleseema60
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
 
How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17
Celine George
 
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
ImMuslim
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
nitinpv4ai
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
nitinpv4ai
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
nitinpv4ai
 
Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
David Douglas School District
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
 

Recently uploaded (20)

Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
 
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptxA Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
Accounting for Restricted Grants When and How To Record Properly
Accounting for Restricted Grants  When and How To Record ProperlyAccounting for Restricted Grants  When and How To Record Properly
Accounting for Restricted Grants When and How To Record Properly
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
 
How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17
 
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
 
Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
 

11 - SELinux in Red Hat

  • 2. SELinux Security Enhanced Linux (SELinux) is another layer of security for the Linux operating system. Developed by the National Security Agency (NSA), it adds protection for different files, applications, processes, and so on. How to work with SELinux enabled and enforcing. 2
  • 3. Understanding SELinux Modes 3 disabled SELinux is turned and doesn’t restrict anything. permissive SELinux is turned on, but it logs warnings only when an action normally would have been blocked. enforcing SELinux is turned on and blocks actions related to services.
  • 4. Management of SELinux 4 • Shows the current status of SELinux sestatus • Shows the enforcing status of SELinux getenforce • Changes the enforcing status of SELinux setenforce • Returns the Boolean value of a service option getsebool • Sets the Boolean value of a service option setsebool • Changes the context of a file, directory, or service chcon • Resets the context of an object restorecon
  • 5. sestatus command. • Syntax: sestatus [options] • Options: • -b Displays all Booleans and their statuses • -v Provides verbose output 5
  • 6. Configuring SELinux • You can change the mode in which SELinux operates by changing the config file. • The main config file is /etc/selinux/config. • View the current details of the /etc/selinux/config file: • # cat /etc/selinux/config • # This file controls the state 6
  • 7. config file • Aside from editing the config file, you can also use the setenforce command to change the status. • Syntax: setenforce [ Enforcing | Permissive | 1 | 0 ] • If the current mode is permissive, you can change it to enforcing with the following: • # setenforce enforcing • Regardless of which method you use when changing the mode in which SELinux runs, you are still required to reboot the system. 7
  • 8. Service and Boolean Options • To view the Boolean options, you can use the getsebool command combined with grep to look for specific options. • Syntax: getsebool [-a | boolean] • Although you have not installed a web server yet, let’s look at the Boolean options from it anyway. 8
  • 9. Service and Boolean Options • The reason behind this is that it has many options, making for a good example. • Query the Boolean options available for the httpd service (Apache): • # getsebool -a | grep http • View the descriptions for the httpd service (Apache): • # semanage boolean -l | grep http 9
  • 10. Service and Boolean Options • After deciding which Boolean you’d like to change, you need to enable or disable the value appropriately. • To enable or disable a Boolean option, you can use the setsebool command. • When using the command, you also need to use the -P option for the change to be persistent. • Syntax: setsebool [options] [boolean = <on (1) | (0)>] • options • -P Makes the changes persistent 10
  • 11. Service and Boolean Options • From the option listed here, suppose you want to be able to access your home directory through the web server. • In that case, you need to adjust the httpd_enable_homedirs Boolean for this to happen. • Change the value to disable protection of this particular option: • # setsebool -P httpd_enable_homedirs=1 • Notice that this command uses the -P option to make sure that the changes are persistent upon reboot. • Now verify that it has been enabled: • # getsebool httpd_enable_homedirs • httpd_enable_homedirs - on 11
  • 12. SELinux Troubleshooting • When you’re troubleshooting SELinux issues, there are a few packages that you should install first: • # yum install –y policycoreutils-python policycoreutils selinux-policy setroubleshoot-server • You will also find the following two log files handy: • /var/log/audit/audit.log Logs SELinux denials • /var/log/messages Logs SELinux denials 12
  • 13. SELinux Troubleshooting • Each log file provides specific error messages when denials occur, making them easier to search using grep. • Two common commands you can use to hunt for error messages include • # grep “SELinux is preventing” /var/log/messages • # grep “denied” /var/log/audit/audit.log • Problems can arise in SELinux for numerous reasons. • However, the top three include 13
  • 14. SELinux Troubleshooting • However, the top three include • ■ Labeling problems—Using a nonstandard directory tends to cause problems if the directory or files aren’t labeled correctly. • ■ Correct context—When you’re moving files, they can lose or retain incorrect contexts, causing access errors. Use the matchpathcon command to verify the correct context. • ■ Confined service—If certain Booleans are not enabled, a service may have trouble operating or communicating with other services. 14
  • 15. Policy Violations • If you are having trouble with Booleans and need to determine what a specific Boolean does, you can use the semanage command as you saw earlier. • To list all the Booleans with their current values and a brief description, use the following: • # semanage boolean –l 15
  • 16. SELinux boolean Description ftp_home_dir -> off Allow ftp to read and write files in smartmon_3ware -> off Enable additional permissions needed xdm_sysadm_login -> off Allow xdm logins as sysadm xen_use_nfs -> off Allow xen to manage nfs files mozilla_read_content -> off Control mozilla content access 16
  • 17. Policy Violations • When a denial occurs on the system, you see an ID associated with it in your log files. • This ID can be used to determine a more detailed understanding of what could be causing problems with your files or service. • Use the sealert command to obtain more information from an ID: • # sealert –l 0621a8c3-b182-49cf-9116-c78a9dd52199 • You can see that this command should give you enough information to understand what is going on. • Aside from Booleans, most of the SELinux issues should be minor. 17