SlideShare a Scribd company logo
SELinux for everyday users
SELinux Don't be afraid!
SELinux – the bad Developed by the NSA
SELinux – the bad Developed by the NSA
Mandatory Access Control
SELinux – the bad Developed by the NSA
Mandatory Access Control
Infested with jargon Policies, contexts, labels, roles, objects, translation, types, ranges, booleans, oh my!
SELinux – the bad Developed by the NSA
Mandatory Access Control
Infested with jargon
Breaks systems Root can't just do anything anymore
Applications stop working
Can't make it stop
SELinux – the bad “ SELinux is so horrible to use that, after wasting a large amount of time enabling it and then watching all of my applications die a horrible death since they didn't have the appropriate hand-crafted security policy, caused me to swear off of it. For me, given my threat model and how much my time is worth, life is too short for SELinux.” Theodore Ts’o (ext2/3/4 maintainer)
SELinux – the bad “ SELinux is so horrible to use that,  after wasting a large amount of time enabling it and then watching all of my applications die a horrible death since they didn't have the appropriate hand-crafted security policy, caused me to swear off of it. For me, given my threat model and how much my time is worth, life is too short for SELinux.” Theodore Ts’o (ext2/3/4 maintainer)
Uses Debian
SELinux – the bad “ SELinux is so horrible to use that, after wasting a large amount of time enabling it and then watching all of my applications die a horrible death since they didn't have the appropriate hand-crafted security policy, caused me to swear off of it. For me, given my threat model and how much my time is worth, life is too short for SELinux.” Theodore Ts’o  (1 Oct 2007)
Uses Debian
Not an everyday user!
SELinux Don't be afraid!
SELinux – the good “ Let me assure you that this action by the NSA was the crypto-equivalent of the Pope coming down off the balcony in Rome, working the crowd with a few loaves of bread and some fish, and then inviting everyone to come over to his place to watch the soccer game and have a few beers. There are some things that one just never expects to see, and the NSA handing out source code along with details of the security mechanism behind it was right up there on that list.” Larry Loeb
SELinux – the good “ Let me assure you that this action by the NSA was the crypto-equivalent of the Pope coming down off the balcony in Rome, working the crowd with a few loaves of bread and some fish, and then inviting everyone to come over to his place to watch the soccer game and have a few beers. There are some things that one just never expects to see, and the NSA handing out source code along with details of the security mechanism behind it was right up there on that list.” Larry Loeb  (Security author and researcher)
SELinux – the good Used in many major distributions
SELinux – the good Used in many major distributions In kernel since 2002
SELinux – the good Used in many major distributions In kernel since 2002
Fedora since Core 2 (2004)
RHEL since version 4 (2005)
SELinux – the good Used in many major distributions In kernel since 2002
Fedora since Core 2 (2004)
RHEL since version 4 (2005)
Debian since Etch (2007)
Ubuntu since Hardy Heron 8.04 (2008)
SELinux How does it work?
SELinux – the basics Compiled into the kernel
SELinux – the basics Compiled into the kernel
Packaged security policy
SELinux – the basics Compiled into the kernel
Packaged security policy
Checks database of rules on syscalls
SELinux – the basics Compiled into the kernel
Packaged security policy
Checks database of rules on syscalls
Allows or denies based on policy
SELinux What does it  really  do?
SELinux – what does it do? Stops daemons going bad tchmilfan : didi! - http://www.flickr.com/photos/tchmilfan/1033216436/
SELinux – what does it do? Stops daemons going bad Policies in most distributions are applied only to system processes, not user processes.
SELinux – what does it do? Stops daemons going bad Policies in most distributions are applied only to system processes, not user processes.
Policies limit what a daemon can access and how.
SELinux – what does it do? Stops daemons going bad Policies in most distributions are applied only to system processes, not user processes.
Policies limit what a daemon can access and how.
Prevents daemon compromise affecting other files.
SELinux – what does it do? Stops daemons going bad Policies in most distributions are applied only to system processes, not user processes.
Policies limit what a daemon can access and how.
Prevents daemon compromise affecting other files / users / ports / etc.
SELinux – what does it do? Stops daemons going bad
User processes are unaffected
SELinux – what does it do? Stops daemons going bad
User processes are unaffected root still gets to be root
SELinux – what does it do? Stops daemons going bad
User processes are unaffected root still gets to be root
Firefox still gets to crash your system
SELinux – what does it do? Stops daemons going bad
User processes are unaffected root still gets to be root
Firefox still gets to crash your system
New policy being written to help that

More Related Content

What's hot (20)

PPT
Introduction To SELinux
Rene Cunningham
 
PDF
Linux commands
debashis rout
 
PPT
Linux command ppt
kalyanineve
 
PDF
Linux basic commands with examples
abclearnn
 
PDF
Users and groups in Linux
Knoldus Inc.
 
PDF
Dockerイメージの理解とコンテナのライフサイクル
Masahito Zembutsu
 
PDF
aclpwn - Active Directory ACL exploitation with BloodHound
DirkjanMollema
 
PPTX
Introduction 2 linux
Papu Kumar
 
PPTX
Introduction to Linux
Harish R
 
PPTX
Linux fundamentals
Raghu nath
 
PDF
Cloud Native Bern 05.2023 — Zero Trust Visibility
Raphaël PINSON
 
PPTX
Linux file system
Md. Tanvir Hossain
 
PDF
Linux kernel tracing
Viller Hsiao
 
PPTX
Security Enhanced Linux Overview
Emre Can Kucukoglu
 
PDF
Unix - An Introduction
Deepanshu Gahlaut
 
PPTX
Users and groups
Varnnit Jain
 
PDF
Kubernetes Networking with Cilium - Deep Dive
Michal Rostecki
 
PPT
Linux commands and file structure
Sreenatha Reddy K R
 
PDF
Basic linux commands for bioinformatics
Bonnie Ng
 
Introduction To SELinux
Rene Cunningham
 
Linux commands
debashis rout
 
Linux command ppt
kalyanineve
 
Linux basic commands with examples
abclearnn
 
Users and groups in Linux
Knoldus Inc.
 
Dockerイメージの理解とコンテナのライフサイクル
Masahito Zembutsu
 
aclpwn - Active Directory ACL exploitation with BloodHound
DirkjanMollema
 
Introduction 2 linux
Papu Kumar
 
Introduction to Linux
Harish R
 
Linux fundamentals
Raghu nath
 
Cloud Native Bern 05.2023 — Zero Trust Visibility
Raphaël PINSON
 
Linux file system
Md. Tanvir Hossain
 
Linux kernel tracing
Viller Hsiao
 
Security Enhanced Linux Overview
Emre Can Kucukoglu
 
Unix - An Introduction
Deepanshu Gahlaut
 
Users and groups
Varnnit Jain
 
Kubernetes Networking with Cilium - Deep Dive
Michal Rostecki
 
Linux commands and file structure
Sreenatha Reddy K R
 
Basic linux commands for bioinformatics
Bonnie Ng
 

Viewers also liked (20)

PDF
Ubuntu 16.04 LTS Security Features
Dustin Kirkland
 
PDF
SELinux basics
Lubomir Rintel
 
PDF
Supply Chain som Værdiskaber - Associate Professor Kim Sundtoft Hald
CBS Competitiveness Platform
 
PDF
46 customizing se linux policy
Aprende Viendo
 
PDF
Ubuntu an absolute beginners guide
COMSATS
 
PPTX
Linux training
artisriva
 
PPTX
Linux Based Network Proposal
Chris Riccio
 
PDF
Introduction to SELinux Part-I
n|u - The Open Security Community
 
PPT
Linux conf-admin
badamisri
 
ODP
CLUG 2010 09 - systemd - the new init system
PaulWay
 
PPTX
Operating system enhancements to prevent misuse of systems
Dayal Dilli
 
PPTX
Chapter 3 security part i auditing operating systems and networks
jayussuryawan
 
PPT
Linux apache installation
Dima Gomaa
 
PDF
ISCSI server configuration
Thamizharasan P
 
PPT
Nagios Conference 2013 - David Stern - The Nagios Light Bar
Nagios
 
PPT
OS Security 2009
Deborah Obasogie
 
PDF
Apache server configuration
Thamizharasan P
 
PDF
DNS server configurationDns server configuration
Thamizharasan P
 
PDF
Network configuration in Linux
Mohammed Yazdani
 
PDF
Webmin configuration in Linux
Thamizharasan P
 
Ubuntu 16.04 LTS Security Features
Dustin Kirkland
 
SELinux basics
Lubomir Rintel
 
Supply Chain som Værdiskaber - Associate Professor Kim Sundtoft Hald
CBS Competitiveness Platform
 
46 customizing se linux policy
Aprende Viendo
 
Ubuntu an absolute beginners guide
COMSATS
 
Linux training
artisriva
 
Linux Based Network Proposal
Chris Riccio
 
Introduction to SELinux Part-I
n|u - The Open Security Community
 
Linux conf-admin
badamisri
 
CLUG 2010 09 - systemd - the new init system
PaulWay
 
Operating system enhancements to prevent misuse of systems
Dayal Dilli
 
Chapter 3 security part i auditing operating systems and networks
jayussuryawan
 
Linux apache installation
Dima Gomaa
 
ISCSI server configuration
Thamizharasan P
 
Nagios Conference 2013 - David Stern - The Nagios Light Bar
Nagios
 
OS Security 2009
Deborah Obasogie
 
Apache server configuration
Thamizharasan P
 
DNS server configurationDns server configuration
Thamizharasan P
 
Network configuration in Linux
Mohammed Yazdani
 
Webmin configuration in Linux
Thamizharasan P
 
Ad

Similar to SELinux for Everyday Users (20)

ODP
chroot and SELinux
Shay Cohen
 
PDF
2009-08-11 IBM Teach the Teachers (IBM T3), Linux Security Overview
Shawn Wells
 
PPTX
SELinux_@gnu_group_meetup
Jayant Chutke
 
PPTX
selinuxbasicusage.pptx
Pandiya Rajan
 
PDF
4 effective methods to disable se linux temporarily or permanently
chinkshady
 
PDF
SELinux Johannesburg Linux User Group (JoziJUg)
Jumping Bean
 
PPTX
11 - SELinux in Red Hat
Shafaan Khaliq Bhatti
 
ODP
How to live with SELinux
Bert Desmet
 
PDF
SELinux Kernel Internals and Architecture - FOSS.IN/2005
James Morris
 
PDF
2008-10-15 Red Hat Deep Dive Sessions: SELinux
Shawn Wells
 
PDF
Understanding SELinux For the Win
bmbouter
 
PPTX
Selinux
Mohitgupta8560
 
PDF
کارگاه امنیت با عنوان Stop Disabling SElinux
جشنوارهٔ روز آزادی نرم‌افزار تهران
 
PDF
MR201406 A Re-introduction to SELinux
FFRI, Inc.
 
PDF
2008 08-12 SELinux: A Key Component in Secure Infrastructures
Shawn Wells
 
PDF
Linux Tutorial with commands to use while learning
ArunVastrad4
 
PPTX
SE Linux
primeteacher32
 
PDF
SELinux workshop
johseg
 
PDF
Managing SELinux Security - RHCSA (RH134).pdf
RHCSA Guru
 
PDF
linux.pdf
jhon508183
 
chroot and SELinux
Shay Cohen
 
2009-08-11 IBM Teach the Teachers (IBM T3), Linux Security Overview
Shawn Wells
 
SELinux_@gnu_group_meetup
Jayant Chutke
 
selinuxbasicusage.pptx
Pandiya Rajan
 
4 effective methods to disable se linux temporarily or permanently
chinkshady
 
SELinux Johannesburg Linux User Group (JoziJUg)
Jumping Bean
 
11 - SELinux in Red Hat
Shafaan Khaliq Bhatti
 
How to live with SELinux
Bert Desmet
 
SELinux Kernel Internals and Architecture - FOSS.IN/2005
James Morris
 
2008-10-15 Red Hat Deep Dive Sessions: SELinux
Shawn Wells
 
Understanding SELinux For the Win
bmbouter
 
کارگاه امنیت با عنوان Stop Disabling SElinux
جشنوارهٔ روز آزادی نرم‌افزار تهران
 
MR201406 A Re-introduction to SELinux
FFRI, Inc.
 
2008 08-12 SELinux: A Key Component in Secure Infrastructures
Shawn Wells
 
Linux Tutorial with commands to use while learning
ArunVastrad4
 
SE Linux
primeteacher32
 
SELinux workshop
johseg
 
Managing SELinux Security - RHCSA (RH134).pdf
RHCSA Guru
 
linux.pdf
jhon508183
 
Ad

Recently uploaded (20)

PDF
CIFDAQ'S Token Spotlight for 16th July 2025 - ALGORAND
CIFDAQ
 
PPTX
TYPES OF COMMUNICATION Presentation of ICT
JulieBinwag
 
PDF
OpenInfra ID 2025 - Are Containers Dying? Rethinking Isolation with MicroVMs.pdf
Muhammad Yuga Nugraha
 
PDF
Shuen Mei Parth Sharma Boost Productivity, Innovation and Efficiency wit...
AWS Chicago
 
PDF
Novus Safe Lite- What is Novus Safe Lite.pdf
Novus Hi-Tech
 
PPTX
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
PDF
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
PDF
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
PPTX
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 
PDF
How a Code Plagiarism Checker Protects Originality in Programming
Code Quiry
 
PPTX
Simplifying End-to-End Apache CloudStack Deployment with a Web-Based Automati...
ShapeBlue
 
PDF
Market Wrap for 18th July 2025 by CIFDAQ
CIFDAQ
 
PDF
Arcee AI - building and working with small language models (06/25)
Julien SIMON
 
PPTX
The Yotta x CloudStack Advantage: Scalable, India-First Cloud
ShapeBlue
 
PPTX
UI5Con 2025 - Beyond UI5 Controls with the Rise of Web Components
Wouter Lemaire
 
PPTX
UI5Con 2025 - Get to Know Your UI5 Tooling
Wouter Lemaire
 
PDF
CloudStack GPU Integration - Rohit Yadav
ShapeBlue
 
PDF
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
PDF
Productivity Management Software | Workstatus
Lovely Baghel
 
PDF
Empowering Cloud Providers with Apache CloudStack and Stackbill
ShapeBlue
 
CIFDAQ'S Token Spotlight for 16th July 2025 - ALGORAND
CIFDAQ
 
TYPES OF COMMUNICATION Presentation of ICT
JulieBinwag
 
OpenInfra ID 2025 - Are Containers Dying? Rethinking Isolation with MicroVMs.pdf
Muhammad Yuga Nugraha
 
Shuen Mei Parth Sharma Boost Productivity, Innovation and Efficiency wit...
AWS Chicago
 
Novus Safe Lite- What is Novus Safe Lite.pdf
Novus Hi-Tech
 
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 
How a Code Plagiarism Checker Protects Originality in Programming
Code Quiry
 
Simplifying End-to-End Apache CloudStack Deployment with a Web-Based Automati...
ShapeBlue
 
Market Wrap for 18th July 2025 by CIFDAQ
CIFDAQ
 
Arcee AI - building and working with small language models (06/25)
Julien SIMON
 
The Yotta x CloudStack Advantage: Scalable, India-First Cloud
ShapeBlue
 
UI5Con 2025 - Beyond UI5 Controls with the Rise of Web Components
Wouter Lemaire
 
UI5Con 2025 - Get to Know Your UI5 Tooling
Wouter Lemaire
 
CloudStack GPU Integration - Rohit Yadav
ShapeBlue
 
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
Productivity Management Software | Workstatus
Lovely Baghel
 
Empowering Cloud Providers with Apache CloudStack and Stackbill
ShapeBlue
 

SELinux for Everyday Users

  • 3. SELinux – the bad Developed by the NSA
  • 4. SELinux – the bad Developed by the NSA
  • 6. SELinux – the bad Developed by the NSA
  • 8. Infested with jargon Policies, contexts, labels, roles, objects, translation, types, ranges, booleans, oh my!
  • 9. SELinux – the bad Developed by the NSA
  • 12. Breaks systems Root can't just do anything anymore
  • 15. SELinux – the bad “ SELinux is so horrible to use that, after wasting a large amount of time enabling it and then watching all of my applications die a horrible death since they didn't have the appropriate hand-crafted security policy, caused me to swear off of it. For me, given my threat model and how much my time is worth, life is too short for SELinux.” Theodore Ts’o (ext2/3/4 maintainer)
  • 16. SELinux – the bad “ SELinux is so horrible to use that, after wasting a large amount of time enabling it and then watching all of my applications die a horrible death since they didn't have the appropriate hand-crafted security policy, caused me to swear off of it. For me, given my threat model and how much my time is worth, life is too short for SELinux.” Theodore Ts’o (ext2/3/4 maintainer)
  • 18. SELinux – the bad “ SELinux is so horrible to use that, after wasting a large amount of time enabling it and then watching all of my applications die a horrible death since they didn't have the appropriate hand-crafted security policy, caused me to swear off of it. For me, given my threat model and how much my time is worth, life is too short for SELinux.” Theodore Ts’o (1 Oct 2007)
  • 21. SELinux Don't be afraid!
  • 22. SELinux – the good “ Let me assure you that this action by the NSA was the crypto-equivalent of the Pope coming down off the balcony in Rome, working the crowd with a few loaves of bread and some fish, and then inviting everyone to come over to his place to watch the soccer game and have a few beers. There are some things that one just never expects to see, and the NSA handing out source code along with details of the security mechanism behind it was right up there on that list.” Larry Loeb
  • 23. SELinux – the good “ Let me assure you that this action by the NSA was the crypto-equivalent of the Pope coming down off the balcony in Rome, working the crowd with a few loaves of bread and some fish, and then inviting everyone to come over to his place to watch the soccer game and have a few beers. There are some things that one just never expects to see, and the NSA handing out source code along with details of the security mechanism behind it was right up there on that list.” Larry Loeb (Security author and researcher)
  • 24. SELinux – the good Used in many major distributions
  • 25. SELinux – the good Used in many major distributions In kernel since 2002
  • 26. SELinux – the good Used in many major distributions In kernel since 2002
  • 27. Fedora since Core 2 (2004)
  • 28. RHEL since version 4 (2005)
  • 29. SELinux – the good Used in many major distributions In kernel since 2002
  • 30. Fedora since Core 2 (2004)
  • 31. RHEL since version 4 (2005)
  • 33. Ubuntu since Hardy Heron 8.04 (2008)
  • 34. SELinux How does it work?
  • 35. SELinux – the basics Compiled into the kernel
  • 36. SELinux – the basics Compiled into the kernel
  • 38. SELinux – the basics Compiled into the kernel
  • 40. Checks database of rules on syscalls
  • 41. SELinux – the basics Compiled into the kernel
  • 43. Checks database of rules on syscalls
  • 44. Allows or denies based on policy
  • 45. SELinux What does it really do?
  • 46. SELinux – what does it do? Stops daemons going bad tchmilfan : didi! - http://www.flickr.com/photos/tchmilfan/1033216436/
  • 47. SELinux – what does it do? Stops daemons going bad Policies in most distributions are applied only to system processes, not user processes.
  • 48. SELinux – what does it do? Stops daemons going bad Policies in most distributions are applied only to system processes, not user processes.
  • 49. Policies limit what a daemon can access and how.
  • 50. SELinux – what does it do? Stops daemons going bad Policies in most distributions are applied only to system processes, not user processes.
  • 51. Policies limit what a daemon can access and how.
  • 52. Prevents daemon compromise affecting other files.
  • 53. SELinux – what does it do? Stops daemons going bad Policies in most distributions are applied only to system processes, not user processes.
  • 54. Policies limit what a daemon can access and how.
  • 55. Prevents daemon compromise affecting other files / users / ports / etc.
  • 56. SELinux – what does it do? Stops daemons going bad
  • 57. User processes are unaffected
  • 58. SELinux – what does it do? Stops daemons going bad
  • 59. User processes are unaffected root still gets to be root
  • 60. SELinux – what does it do? Stops daemons going bad
  • 61. User processes are unaffected root still gets to be root
  • 62. Firefox still gets to crash your system
  • 63. SELinux – what does it do? Stops daemons going bad
  • 64. User processes are unaffected root still gets to be root
  • 65. Firefox still gets to crash your system
  • 66. New policy being written to help that
  • 67. SELinux – demystifying Everything has a security 'context'
  • 68. SELinux – demystifying Everything has a security 'context' A process has a context
  • 69. SELinux – demystifying Everything has a security 'context' A process has a context
  • 70. A file has a context
  • 71. SELinux – demystifying Everything has a security 'context' A process has a context
  • 72. A file has a context Database of rules
  • 73. SELinux – demystifying Everything has a security 'context' A process has a context
  • 74. A file has a context Database of rules Rules allow a process in one context to do operations on an object in another context
  • 75. SELinux – how do I see it? Some commands have the -Z option ls -Z
  • 77. ps -Z
  • 78. SELinux – how do I see it? Some commands have the -Z option ls -Z drwxr-xr-x paulway paulway user_u:object_r:user_home_t:s0 bin drwxrwxr-x paulway paulway user_u:object_r:user_home_t:s0 coding
  • 79. netstat -Z tcp 0 0 tachyon:54421 upload.pmtpa.wikimedia:http ESTABLISHED 4243/firefox unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcp 1 0 tachyon.tangram.dnsal:46882 media:daap CLOSE_WAIT 1837/rhythmbox unconfined_r:unconfined_execmem_t:s0-s0:c0.c1023
  • 80. ps -Z LABEL PID TTY TIME CMD unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 5950 pts/1 00:00:00 bash unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 6293 pts/1 00:00:00 ps
  • 81. SELinux – how do I see it? Some commands have the -Z option ls -Z drwxr-xr-x paulway paulway user_u:object_r: user_home_t :s0 bin drwxrwxr-x paulway paulway user_u:object_r: user_home_t :s0 coding
  • 82. netstat -Z tcp 0 0 tachyon:54421 upload.pmtpa.wikimedia:http ESTABLISHED 4243/firefox unconfined_u:unconfined_r: unconfined_t :s0-s0:c0.c1023 tcp 1 0 tachyon.tangram.dnsal:46882 media:daap CLOSE_WAIT 1837/rhythmbox unconfined_r: unconfined_execmem_t :s0-s0:c0.c1023
  • 83. ps -Z LABEL PID TTY TIME CMD unconfined_u:unconfined_r: unconfined_t :s0-s0:c0.c1023 5950 pts/1 00:00:00 bash unconfined_u:unconfined_r: unconfined_t :s0-s0:c0.c1023 6293 pts/1 00:00:00 ps
  • 84. The type_t is the only thing you need look at
  • 85. SELinux – how do I use it? restorecon Restores the context of a file
  • 86. Based on the rules for the directory structure chcon
  • 87. SELinux – how do I use it? restorecon
  • 88. SELinux – how do I use it? restorecon Restore s the default SELinux con text of a file
  • 89. SELinux – how do I use it? restorecon Restore s the default SELinux con text of a file
  • 90. Looks up the database of rules and finds the correct context for that file
  • 91. SELinux – how do I use it? [root@tachyon ~]# ls -Z /etc/group -rw-r--r-- root root system_u:object_r:etc_t:s0 /etc/group
  • 92. SELinux – how do I use it? [root@tachyon ~]# ls -Z /etc/group -rw-r--r-- root root system_u:object_r:etc_t:s0 /etc/group [root@tachyon ~]# cp /etc/group /tmp [root@tachyon ~]# mv /tmp/group /etc [root@tachyon ~]# ls -Z /etc/group -rw-r--r-- root root system_u:object_r:user_tmp_t:s0 /etc/group
  • 93. SELinux – how do I use it? [root@tachyon ~]# ls -Z /etc/group -rw-r--r-- root root system_u:object_r:etc_t:s0 /etc/group [root@tachyon ~]# cp /etc/group /tmp [root@tachyon ~]# mv /tmp/group /etc [root@tachyon ~]# ls -Z /etc/group -rw-r--r-- root root system_u:object_r:user_tmp_t:s0 /etc/group [root@tachyon ~]# restorecon -R -v /etc/group restorecon reset /etc/group context system_u:object_r:user_tmp_t:s0->system_u:object_r:etc_t:s0 [root@tachyon ~]# ls -Z /etc/group -rw-r--r-- root root system_u:object_r:etc_t:s0 /etc/group
  • 94. SELinux – Lessons 1: Try restorecon
  • 95. SELinux – demystifying Everything has a context
  • 96. Database of rules Rules allow a process in one context to do operations on an object in another context
  • 97. SELinux – demystifying Everything has a context
  • 98. Database of rules Rules allow a process in one context to do operations on an object in another context Switches turn groups of rules on or off
  • 99. SELinux – demystifying Everything has a context
  • 100. Database of rules Rules allow a process in one context to do operations on an object in another context Switches turn groups of rules on or off Booleans
  • 101. SELinux – how do I see it? getsebool -a
  • 102. SELinux – how do I see it? getsebool -a [root@tachyon ~]# getsebool -a | grep samba samba_domain_controller --> off samba_enable_home_dirs --> off samba_export_all_ro --> off samba_export_all_rw --> off samba_run_unconfined --> on samba_share_fusefs --> off samba_share_nfs --> off use_samba_home_dirs --> off virt_use_samba --> off
  • 103. SELinux – how do I use it? setsebool [root@tachyon ~]# getsebool -a | grep samba samba_domain_controller --> off samba_enable_home_dirs --> off samba_export_all_ro --> off samba_export_all_rw --> off samba_run_unconfined --> on samba_share_fusefs --> off samba_share_nfs --> off use_samba_home_dirs --> off virt_use_samba --> off [root@tachyon ~]# setsebool samba_enable_home_dirs on [root@tachyon ~]# getsebool -a | grep samba_enable_home_dirs samba_enable_home_dirs --> on
  • 104. SELinux – how do I use it? setsebool – ONLY THIS SESSION! [root@tachyon ~]# getsebool -a | grep samba samba_domain_controller --> off samba_enable_home_dirs --> off samba_export_all_ro --> off samba_export_all_rw --> off samba_run_unconfined --> on samba_share_fusefs --> off samba_share_nfs --> off use_samba_home_dirs --> off virt_use_samba --> off [root@tachyon ~]# setsebool samba_enable_home_dirs on [root@tachyon ~]# getsebool -a | grep samba_enable_home_dirs samba_enable_home_dirs --> on
  • 105. SELinux – how do I use it? setsebool -P [root@tachyon ~]# getsebool -a | grep samba samba_domain_controller --> off samba_enable_home_dirs --> off samba_export_all_ro --> off samba_export_all_rw --> off samba_run_unconfined --> on samba_share_fusefs --> off samba_share_nfs --> off use_samba_home_dirs --> off virt_use_samba --> off [root@tachyon ~]# setsebool -P samba_enable_home_dirs on [root@tachyon ~]# getsebool -a | grep samba_enable_home_dirs samba_enable_home_dirs --> on
  • 106. SELinux – Lessons 1: Try restorecon
  • 107. 2: getsebool and setsebool
  • 108. SELinux – how do I see it? Some commands have the -Z option ls -Z
  • 110. ps -Z Audit messages go to /var/log/audit/audit.log
  • 111. SELinux – how do I see it? Some commands have the -Z option ls -Z
  • 113. ps -Z Audit messages go to /var/log/audit/audit.log Some messages may be in /var/log/messages
  • 114. SELinux – how do I see it? [root@tachyon ~]# tail -4 /var/log/audit/audit.log
  • 115. SELinux – how do I see it? [root@tachyon ~]# tail -4 /var/log/audit/audit.log type=AVC msg=audit(1219408121.814:62): avc: denied { read } for pid=2184 comm="hald" name="group" dev=dm-0 ino=460208 scontext=system_u:system_r:hald_t:s0 tcontext=system_u:object_r:user_tmp_t:s0 tclass=file type=SYSCALL msg=audit(1219408121.814:62): arch=40000003 syscall=5 success=no exit=-13 a0=119f2d a1=80000 a2=1b6 a3=80000 items=0 ppid=1 pid=2184 auid=4294967295 uid=68 gid=68 euid=68 suid=68 fsuid=68 egid=68 sgid=68 fsgid=68 tty=(none) ses=4294967295 comm="hald" exe="/usr/sbin/hald" subj=system_u:system_r:hald_t:s0 key=(null) type=AVC msg=audit(1219408127.814:63): avc: denied { read } for pid=2184 comm="hald" name="group" dev=dm-0 ino=460208 scontext=system_u:system_r:hald_t:s0 tcontext=system_u:object_r:user_tmp_t:s0 tclass=file type=SYSCALL msg=audit(1219408127.814:63): arch=40000003 syscall=5 success=no exit=-13 a0=119f2d a1=80000 a2=1b6 a3=80000 items=0 ppid=1 pid=2184 auid=4294967295 uid=68 gid=68 euid=68 suid=68 fsuid=68 egid=68 sgid=68 fsgid=68 tty=(none) ses=4294967295 comm="hald" exe="/usr/sbin/hald" subj=system_u:system_r:hald_t:s0 key=(null)
  • 116. SELinux – how do I use it? [root@tachyon ~]# grep hald /var/log/audit/audit.log | audit2why type=AVC msg=audit(1219408127.814:63): avc: denied { read } for pid=2184 comm="hald" name="group" dev=dm-0 ino=460208 scontext=system_u:system_r:hald_t:s0 tcontext=system_u:object_r:user_tmp_t:s0 tclass=file Was caused by: Missing type enforcement (TE) allow rule. You can use audit2allow to generate a loadable module to allow this access.
  • 117. SELinux – Lessons 1: Try restorecon
  • 118. 2: getsebool and setsebool
  • 119. 3: audit2why or audit2allow
  • 120. SELinux – Lessons 1: Try restorecon
  • 121. 2: getsebool and setsebool
  • 122. 3: audit2why or audit2allow unless you're working on a system daemon problem.
  • 123. SELinux – Lessons 1: Try restorecon
  • 124. 2: getsebool and setsebool
  • 125. 3: audit2why or audit2allow Much more, but it's not for every day.