SlideShare a Scribd company logo
1 of 21
Download to read offline
Atmosphere Conference 2018, Warsaw1
Milos Malik
mmalik (at) redhat (dot) com
Senior Quality Engineer
June 2018
SELinux Troubleshooting
Atmosphere Conference 2018, Warsaw2
Agenda
Introduction
Reasons
Basic principles
Troubleshooting workflow
Documentation
SELinux troubleshooting chart
Atmosphere Conference 2018, Warsaw3
Reality check
● Have you heard about SELinux?
● Do you use SELinux?
● Which distribution do you use?
● Do you use SELinux in enforcing mode?
● Have you reported at least 1 selinux-policy bug?
● Have you resolved at least 1 selinux-policy issue?
Atmosphere Conference 2018, Warsaw4
SELinux policy - complex system?
Entities / OS RHEL-7.5 Fedora 28
Types ~4700 ~4800
Process types 816 833
File types ~2900 ~3000
Allow rules ~106000 ~109000
Type transition rules ~66000 ~232000
Dontaudit rules ~10000 ~10000
Policy modules 408 415
Booleans 311 319
Atmosphere Conference 2018, Warsaw5
Bugs resolved
since 2012-01-01 (not counting duplicates)
selinux-policy user-space
Fedora ~3500 ~300
RHELs ~2400 ~370
User-space components: checkpolicy, libsepol, libsemanage,
libselinux, policycoreutils, setools, setroubleshoot,
setroubleshoot-plugins, mcstrans
Atmosphere Conference 2018, Warsaw6
Reasons
● Provide users a guidance
● Reduce the time between finding the bug and resolving it
● Teach users new skills
● Improve collaboration among reporters, developers and QE
● Make the SELinux adoption easier
Atmosphere Conference 2018, Warsaw7
● Everything is denied by default
● Policy defines rules which allow various accesses
● Everything has a label
● Labels are inherited
● Labels can change during creation / execution
Basic SELinux principles
Atmosphere Conference 2018, Warsaw8
Almost all SELinux problems
fall into one of the following categories:
● labeling problem
● confined process behaves in a different way than what default
SELinux configuration expects
● bug in SELinux policy or in the application
● your machine has been compromised
Atmosphere Conference 2018, Warsaw9
Troubleshooting workflow
Problem identification Problem analysis
Atmosphere Conference 2018, Warsaw10
Problem identification
Best friends are:
● auditd
● ausearch
● dmesg
● full path in audit messages
Atmosphere Conference 2018, Warsaw11
SELinux denial
type=PROCTITLE msg=audit(05/29/2018 22:34:31.817:1776) : proctitle=smbcontrol smbd
ping
type=MMAP msg=audit(05/29/2018 22:34:31.817:1776) : fd=7 flags=MAP_SHARED
type=SYSCALL msg=audit(05/29/2018 22:34:31.817:1776) : arch=x86_64 syscall=mmap
success=no exit=EACCES(Permission denied) a0=0x0 a1=0x2b8
a2=PROT_READ|PROT_WRITE a3=MAP_SHARED items=0 ppid=15427 pid=21481
auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root
tty=pts1 ses=10 comm=smbcontrol exe=/usr/bin/smbcontrol
subj=unconfined_u:unconfined_r:smbcontrol_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(05/29/2018 22:34:31.817:1776) : avc: denied { map } for pid=21481
comm=smbcontrol path=/var/lib/samba/lock/names.tdb dev="vda3" ino=9394097
scontext=unconfined_u:unconfined_r:smbcontrol_t:s0-s0:c0.c1023
tcontext=unconfined_u:object_r:samba_var_t:s0 tclass=file permissive=0
Atmosphere Conference 2018, Warsaw12
Problem analysis
Best friends are:
● matchpathcon
● sesearch
● audit2allow
● sealert reports
Atmosphere Conference 2018, Warsaw13
Finding policy rules
SELinux is a labeling system. First thought should be "Is there a label
that would make this work?"
# sesearch -s smbcontrol_t -t samba_var_t -c file -p map --allow
#
Atmosphere Conference 2018, Warsaw14
Troubleshooting workflow
Conservative
solution
Radical
solution
Work
around
Atmosphere Conference 2018, Warsaw15
Conservative solution
Best friends are:
● chcon
● semanage
● restorecon
Atmosphere Conference 2018, Warsaw16
Radical solution
Best friends are:
● audit2allow
● semodule
● sepolicy
Atmosphere Conference 2018, Warsaw17
Please read the documentation
● SELinux User's and Administrator's Guide
● Security Guide
● SELinux project page
● CentOS SELinux wiki
● Fedora SELinux wiki
● Gentoo SELinux wiki
● Debian SELinux wiki
● The SELinux Notebook 4th edition!
● SELinux Troubleshooting Chart on github.com
Atmosphere Conference 2018, Warsaw18
Allow everything? Rather not
Dangerous operations:
● execmod, execstack, execheap, execmem
● sys_ptrace, sys_module, sys_admin
● writing to base SELinux types (e.g. etc_t, usr_t)
● module_request
● writing to admin_home_t
● writing to modules_object_t
● mac_admin
Operations for further inspection:
● accessing unlabeled_t files, dirs, devices etc.
● dac_read_search, dac_override
● net_admin and other capabilities
Atmosphere Conference 2018, Warsaw19
Atmosphere Conference 2018, Warsaw20
Q&A
Atmosphere Conference 2018, Warsaw21
Thank you

More Related Content

Similar to Atmosphere 2018: Milos Malik - SELINUX TROUBLESHOOTING

Pre-Compliance Accreditation Tool for Python
Pre-Compliance Accreditation Tool for PythonPre-Compliance Accreditation Tool for Python
Pre-Compliance Accreditation Tool for PythonJustin Dierking
 
Mesa and Its Debugging, Вадим Шовкопляс
Mesa and Its Debugging, Вадим ШовкоплясMesa and Its Debugging, Вадим Шовкопляс
Mesa and Its Debugging, Вадим ШовкоплясSigma Software
 
Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Valeriy Kravchuk
 
Accelerated Windows Debugging 3 training public slides
Accelerated Windows Debugging 3 training public slidesAccelerated Windows Debugging 3 training public slides
Accelerated Windows Debugging 3 training public slidesDmitry Vostokov
 
Test Metrics
Test MetricsTest Metrics
Test MetricsDevukjs
 
OORPT Dynamic Analysis
OORPT Dynamic AnalysisOORPT Dynamic Analysis
OORPT Dynamic Analysislienhard
 
ThoughtWorks Tech Talks NYC: DevOops, 10 Ops Things You Might Have Forgotten ...
ThoughtWorks Tech Talks NYC: DevOops, 10 Ops Things You Might Have Forgotten ...ThoughtWorks Tech Talks NYC: DevOops, 10 Ops Things You Might Have Forgotten ...
ThoughtWorks Tech Talks NYC: DevOops, 10 Ops Things You Might Have Forgotten ...Rosemary Wang
 
1032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.21032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.2Stanley Ho
 
What is RUDDER and when should I use it?
What is RUDDER and when should I use it?What is RUDDER and when should I use it?
What is RUDDER and when should I use it?RUDDER
 
An introduction to knitr and R Markdown
An introduction to knitr and R MarkdownAn introduction to knitr and R Markdown
An introduction to knitr and R Markdownsahirbhatnagar
 
Docker meetup - PaaS interoperability
Docker meetup - PaaS interoperabilityDocker meetup - PaaS interoperability
Docker meetup - PaaS interoperabilityLudovic Piot
 
Monitoring federation open stack infrastructure
Monitoring federation open stack infrastructureMonitoring federation open stack infrastructure
Monitoring federation open stack infrastructureFernando Lopez Aguilar
 
2009-08-24 The Linux Audit Subsystem Deep Dive
2009-08-24 The Linux Audit Subsystem Deep Dive2009-08-24 The Linux Audit Subsystem Deep Dive
2009-08-24 The Linux Audit Subsystem Deep DiveShawn Wells
 
Apache Flink: API, runtime, and project roadmap
Apache Flink: API, runtime, and project roadmapApache Flink: API, runtime, and project roadmap
Apache Flink: API, runtime, and project roadmapKostas Tzoumas
 
Habits of Effective SAS Programmers
Habits of Effective SAS ProgrammersHabits of Effective SAS Programmers
Habits of Effective SAS ProgrammersSunil Gupta
 
Accelerated .NET Memory Dump Analysis training public slides
Accelerated .NET Memory Dump Analysis training public slidesAccelerated .NET Memory Dump Analysis training public slides
Accelerated .NET Memory Dump Analysis training public slidesDmitry Vostokov
 
Lect05 Prog Model
Lect05 Prog ModelLect05 Prog Model
Lect05 Prog Modelanoosdomain
 
PCD - Process control daemon
PCD - Process control daemonPCD - Process control daemon
PCD - Process control daemonhaish
 

Similar to Atmosphere 2018: Milos Malik - SELINUX TROUBLESHOOTING (20)

Pre-Compliance Accreditation Tool for Python
Pre-Compliance Accreditation Tool for PythonPre-Compliance Accreditation Tool for Python
Pre-Compliance Accreditation Tool for Python
 
Mesa and Its Debugging, Вадим Шовкопляс
Mesa and Its Debugging, Вадим ШовкоплясMesa and Its Debugging, Вадим Шовкопляс
Mesa and Its Debugging, Вадим Шовкопляс
 
Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013
 
Accelerated Windows Debugging 3 training public slides
Accelerated Windows Debugging 3 training public slidesAccelerated Windows Debugging 3 training public slides
Accelerated Windows Debugging 3 training public slides
 
Test Metrics
Test MetricsTest Metrics
Test Metrics
 
SIG-NOC Tools survey results
SIG-NOC Tools survey resultsSIG-NOC Tools survey results
SIG-NOC Tools survey results
 
OORPT Dynamic Analysis
OORPT Dynamic AnalysisOORPT Dynamic Analysis
OORPT Dynamic Analysis
 
ThoughtWorks Tech Talks NYC: DevOops, 10 Ops Things You Might Have Forgotten ...
ThoughtWorks Tech Talks NYC: DevOops, 10 Ops Things You Might Have Forgotten ...ThoughtWorks Tech Talks NYC: DevOops, 10 Ops Things You Might Have Forgotten ...
ThoughtWorks Tech Talks NYC: DevOops, 10 Ops Things You Might Have Forgotten ...
 
1032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.21032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.2
 
What is RUDDER and when should I use it?
What is RUDDER and when should I use it?What is RUDDER and when should I use it?
What is RUDDER and when should I use it?
 
From logs to metrics
From logs to metricsFrom logs to metrics
From logs to metrics
 
An introduction to knitr and R Markdown
An introduction to knitr and R MarkdownAn introduction to knitr and R Markdown
An introduction to knitr and R Markdown
 
Docker meetup - PaaS interoperability
Docker meetup - PaaS interoperabilityDocker meetup - PaaS interoperability
Docker meetup - PaaS interoperability
 
Monitoring federation open stack infrastructure
Monitoring federation open stack infrastructureMonitoring federation open stack infrastructure
Monitoring federation open stack infrastructure
 
2009-08-24 The Linux Audit Subsystem Deep Dive
2009-08-24 The Linux Audit Subsystem Deep Dive2009-08-24 The Linux Audit Subsystem Deep Dive
2009-08-24 The Linux Audit Subsystem Deep Dive
 
Apache Flink: API, runtime, and project roadmap
Apache Flink: API, runtime, and project roadmapApache Flink: API, runtime, and project roadmap
Apache Flink: API, runtime, and project roadmap
 
Habits of Effective SAS Programmers
Habits of Effective SAS ProgrammersHabits of Effective SAS Programmers
Habits of Effective SAS Programmers
 
Accelerated .NET Memory Dump Analysis training public slides
Accelerated .NET Memory Dump Analysis training public slidesAccelerated .NET Memory Dump Analysis training public slides
Accelerated .NET Memory Dump Analysis training public slides
 
Lect05 Prog Model
Lect05 Prog ModelLect05 Prog Model
Lect05 Prog Model
 
PCD - Process control daemon
PCD - Process control daemonPCD - Process control daemon
PCD - Process control daemon
 

Recently uploaded

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 

Recently uploaded (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 

Atmosphere 2018: Milos Malik - SELINUX TROUBLESHOOTING

  • 1. Atmosphere Conference 2018, Warsaw1 Milos Malik mmalik (at) redhat (dot) com Senior Quality Engineer June 2018 SELinux Troubleshooting
  • 2. Atmosphere Conference 2018, Warsaw2 Agenda Introduction Reasons Basic principles Troubleshooting workflow Documentation SELinux troubleshooting chart
  • 3. Atmosphere Conference 2018, Warsaw3 Reality check ● Have you heard about SELinux? ● Do you use SELinux? ● Which distribution do you use? ● Do you use SELinux in enforcing mode? ● Have you reported at least 1 selinux-policy bug? ● Have you resolved at least 1 selinux-policy issue?
  • 4. Atmosphere Conference 2018, Warsaw4 SELinux policy - complex system? Entities / OS RHEL-7.5 Fedora 28 Types ~4700 ~4800 Process types 816 833 File types ~2900 ~3000 Allow rules ~106000 ~109000 Type transition rules ~66000 ~232000 Dontaudit rules ~10000 ~10000 Policy modules 408 415 Booleans 311 319
  • 5. Atmosphere Conference 2018, Warsaw5 Bugs resolved since 2012-01-01 (not counting duplicates) selinux-policy user-space Fedora ~3500 ~300 RHELs ~2400 ~370 User-space components: checkpolicy, libsepol, libsemanage, libselinux, policycoreutils, setools, setroubleshoot, setroubleshoot-plugins, mcstrans
  • 6. Atmosphere Conference 2018, Warsaw6 Reasons ● Provide users a guidance ● Reduce the time between finding the bug and resolving it ● Teach users new skills ● Improve collaboration among reporters, developers and QE ● Make the SELinux adoption easier
  • 7. Atmosphere Conference 2018, Warsaw7 ● Everything is denied by default ● Policy defines rules which allow various accesses ● Everything has a label ● Labels are inherited ● Labels can change during creation / execution Basic SELinux principles
  • 8. Atmosphere Conference 2018, Warsaw8 Almost all SELinux problems fall into one of the following categories: ● labeling problem ● confined process behaves in a different way than what default SELinux configuration expects ● bug in SELinux policy or in the application ● your machine has been compromised
  • 9. Atmosphere Conference 2018, Warsaw9 Troubleshooting workflow Problem identification Problem analysis
  • 10. Atmosphere Conference 2018, Warsaw10 Problem identification Best friends are: ● auditd ● ausearch ● dmesg ● full path in audit messages
  • 11. Atmosphere Conference 2018, Warsaw11 SELinux denial type=PROCTITLE msg=audit(05/29/2018 22:34:31.817:1776) : proctitle=smbcontrol smbd ping type=MMAP msg=audit(05/29/2018 22:34:31.817:1776) : fd=7 flags=MAP_SHARED type=SYSCALL msg=audit(05/29/2018 22:34:31.817:1776) : arch=x86_64 syscall=mmap success=no exit=EACCES(Permission denied) a0=0x0 a1=0x2b8 a2=PROT_READ|PROT_WRITE a3=MAP_SHARED items=0 ppid=15427 pid=21481 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts1 ses=10 comm=smbcontrol exe=/usr/bin/smbcontrol subj=unconfined_u:unconfined_r:smbcontrol_t:s0-s0:c0.c1023 key=(null) type=AVC msg=audit(05/29/2018 22:34:31.817:1776) : avc: denied { map } for pid=21481 comm=smbcontrol path=/var/lib/samba/lock/names.tdb dev="vda3" ino=9394097 scontext=unconfined_u:unconfined_r:smbcontrol_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:samba_var_t:s0 tclass=file permissive=0
  • 12. Atmosphere Conference 2018, Warsaw12 Problem analysis Best friends are: ● matchpathcon ● sesearch ● audit2allow ● sealert reports
  • 13. Atmosphere Conference 2018, Warsaw13 Finding policy rules SELinux is a labeling system. First thought should be "Is there a label that would make this work?" # sesearch -s smbcontrol_t -t samba_var_t -c file -p map --allow #
  • 14. Atmosphere Conference 2018, Warsaw14 Troubleshooting workflow Conservative solution Radical solution Work around
  • 15. Atmosphere Conference 2018, Warsaw15 Conservative solution Best friends are: ● chcon ● semanage ● restorecon
  • 16. Atmosphere Conference 2018, Warsaw16 Radical solution Best friends are: ● audit2allow ● semodule ● sepolicy
  • 17. Atmosphere Conference 2018, Warsaw17 Please read the documentation ● SELinux User's and Administrator's Guide ● Security Guide ● SELinux project page ● CentOS SELinux wiki ● Fedora SELinux wiki ● Gentoo SELinux wiki ● Debian SELinux wiki ● The SELinux Notebook 4th edition! ● SELinux Troubleshooting Chart on github.com
  • 18. Atmosphere Conference 2018, Warsaw18 Allow everything? Rather not Dangerous operations: ● execmod, execstack, execheap, execmem ● sys_ptrace, sys_module, sys_admin ● writing to base SELinux types (e.g. etc_t, usr_t) ● module_request ● writing to admin_home_t ● writing to modules_object_t ● mac_admin Operations for further inspection: ● accessing unlabeled_t files, dirs, devices etc. ● dac_read_search, dac_override ● net_admin and other capabilities
  • 21. Atmosphere Conference 2018, Warsaw21 Thank you