SlideShare a Scribd company logo
SELinux for Sysadmins
SELinux for Sysadmins Beyond 'restorecon'
SELinux for Sysadmins Principles for using SELinux
SELinux for Sysadmins Principles for using SELinux
Through real world examples
Real world example 1 Share home directories through NFS
Real world example 1 Share home directories through NFS [server]# cat /etc/exports /home 192.168.0.0/24(rw,soft)
[client]# cat /etc/fstab ... server:/home /home nfs soft 1 2 ...
Real world example 1 Share home directories through NFS [server]# cat /etc/exports /home 192.168.0.0/24(rw,soft)
[client]# cat /etc/fstab ... server:/home /home nfs soft 1 2 ...
[client]# mount /home Permission denied
SELinux for Sysadmins Share home directories through NFS
Is this a SELinux problem?
SELinux for Sysadmins Share home directories through NFS
Is this a SELinux problem? Check /var/log/audit/audit.log
SELinux for Sysadmins Share home directories through NFS
Is this a SELinux problem? Check /var/log/audit/audit.log grep mount /var/log/audit/audit.log
SELinux for Sysadmins Share home directories through NFS
If it is a SELinux problem: getsebool -a | grep home ftp_home_dir --> off httpd_enable_homedirs --> on openvpn_enable_homedirs --> off samba_create_home_dirs --> off samba_enable_home_dirs --> off spamd_enable_home_dirs --> on use_nfs_home_dirs --> off use_samba_home_dirs --> off
SELinux for Sysadmins Share home directories through NFS
If it is a SELinux problem: getsebool -a | grep home ftp_home_dir --> off httpd_enable_homedirs --> on openvpn_enable_homedirs --> off samba_create_home_dirs --> off samba_enable_home_dirs --> off spamd_enable_home_dirs --> on use_nfs_home_dirs --> off use_samba_home_dirs --> off
SELinux for Sysadmins Share home directories through NFS
If it is a SELinux problem: setsebool use_nfs_home_dirs on
SELinux for Sysadmins Share home directories through NFS
If it is a SELinux problem: setsebool  -P  use_nfs_home_dirs on
Real world example 1 Share home directories through NFS setsebool  -P  use_nfs_home_dirs on
Real world example 1 Share home directories through NFS setsebool  -P  use_nfs_home_dirs on Share home directories through SaMBa
Real world example 1 Share home directories through NFS setsebool  -P  use_nfs_home_dirs on Share home directories through SaMBa setsebool  -P  use_samba_home_dirs on
Real world example 1 Share home directories through NFS setsebool  -P  use_nfs_home_dirs on Share home directories through SaMBa setsebool  -P  use_samba_home_dirs on
setsebool  -P  samba_enable_home_dirs on
Real world example 1 Share home directories through NFS setsebool  -P  use_nfs_home_dirs on Share home directories through SaMBa setsebool  -P  use_samba_home_dirs on Mount SaMBa home dirs on client setsebool  -P  samba_enable_home_dirs on Share home dirs on SaMBa server
Real world example 1 Share home directories through NFS setsebool  -P  use_nfs_home_dirs on Share home directories through SaMBa setsebool  -P  use_samba_home_dirs on
setsebool  -P  samba_enable_home_dirs on Share ~/public_html through Apache setsebool -P apache_enable_homedirs on
SELinux for Sysadmins Principles for using SELinux Use booleans where possible
Real world example 2 Sharing /data through SaMBa
Real world example 2 Sharing /data through SaMBa getsebool -a | grep samba samba_create_home_dirs --> off 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
SELinux for Sysadmins File contexts
SELinux for Sysadmins File contexts [root@tachyon ~]# ls -laZ /var drwxr-xr-x  root root system_u:object_r:var_t:s0  . drwxr-xr-x  root root system_u:object_r:root_t:s0  .. drwxr-xr-x  root root system_u:object_r:acct_data_t:s0  account drwxr-xr-x  root root system_u:object_r:var_t:s0  cache drwxr-xr-x  root root system_u:object_r:cvs_data_t:s0  cvs drwxr-xr-x  root root system_u:object_r:var_t:s0  db drwxr-xr-x  root root system_u:object_r:var_t:s0  empty drwxr-xr-x  root root system_u:object_r:games_data_t:s0  games drwxrwx--T  root gdm  system_u:object_r:xserver_log_t:s0 gdm drwxr-xr-x  root root system_u:object_r:var_lib_t:s0  lib drwxr-xr-x  root root system_u:object_r:var_t:s0  local drwxrwxr-x  root lock system_u:object_r:var_lock_t:s0  lock drwxr-xr-x  root root system_u:object_r:var_log_t:s0  log lrwxrwxrwx  root root system_u:object_r:mail_spool_t:s0  mail drwxr-xr-x  root root system_u:object_r:var_t:s0  nis drwxr-xr-x  root root system_u:object_r:var_t:s0  opt drwxr-xr-x  root root system_u:object_r:var_t:s0  preserve ...
SELinux for Sysadmins File contexts Specify the context in which it is to be used
SELinux for Sysadmins File contexts Specify the context in which it is to be used
Inherited like permissions
Real world example 2 Sharing /data through SaMBa [root@tachyon ~]# mkdir /data [root@tachyon ~]# ls -laZ /data drwxr-xr-x  root root unconfined_u:object_r:default_t:s0 . drwxr-xr-x  root root system_u:object_r:root_t:s0  ..
Real world example 2 Sharing /data through SaMBa [root@tachyon ~]# mkdir /data [root@tachyon ~]# ls -laZ /data drwxr-xr-x  root root unconfined_u:object_r:default_t:s0 . drwxr-xr-x  root root system_u:object_r:root_t:s0  .. [root@tachyon ~]# chcon -R -t samba_share_t /data [root@tachyon ~]# ls -laZ /data drwxr-xr-x  root root unconfined_u:object_r: samba_share_t :s0 . drwxr-xr-x  root root system_u:object_r:root_t:s0  ..
SELinux for Sysadmins Principles for using SELinux Use booleans where possible
Use the right file context
man {ftpd,named,rsync,httpd,nfs,samba, kerberos,nis,ypbind}_selinux   is your friend!
Real world example 3 Sharing /data with SaMBa and VSFTPD
Real world example 3 Sharing /data with SaMBa and VSFTPD Gotcha!
Real world example 3 Sharing /data with SaMBa and VSFTPD Files can only have one security context!

More Related Content

ODP
SELinux for Everyday Users
ODP
SELinux Basic Usage
PPT
Introduction To SELinux
PDF
MindMap - Forensics Windows Registry Cheat Sheet
PDF
Selinux
PPT
Linux command ppt
PPTX
そろそろSELinux を有効にしてみませんか?
PDF
Linux Performance Analysis: New Tools and Old Secrets
SELinux for Everyday Users
SELinux Basic Usage
Introduction To SELinux
MindMap - Forensics Windows Registry Cheat Sheet
Selinux
Linux command ppt
そろそろSELinux を有効にしてみませんか?
Linux Performance Analysis: New Tools and Old Secrets

What's hot (20)

PDF
Container Runtime Security with Falco
PDF
New Ways to Find Latency in Linux Using Tracing
ODP
Linux Kernel Crashdump
PPT
PDF
YOW2018 Cloud Performance Root Cause Analysis at Netflix
PDF
Security Enhanced PostgreSQL - System-wide consistency in access control
PDF
Label based Mandatory Access Control on PostgreSQL
PDF
alphorm.com - Formation Linux LPIC-2
PDF
LSFMM 2019 BPF Observability
PDF
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
PDF
Linux Performance Profiling and Monitoring
PPTX
File permission in linux
PDF
MySQL SQL Tutorial
PDF
OSNoise Tracer: Who Is Stealing My CPU Time?
PDF
systemd
PPTX
Introduction to Linux
PDF
Transparent Data Encryption in PostgreSQL and Integration with Key Management...
PDF
Linux Hardening
PPT
Linux presentation
PDF
Linux Network Administration (LPI-1,LPI-2)
Container Runtime Security with Falco
New Ways to Find Latency in Linux Using Tracing
Linux Kernel Crashdump
YOW2018 Cloud Performance Root Cause Analysis at Netflix
Security Enhanced PostgreSQL - System-wide consistency in access control
Label based Mandatory Access Control on PostgreSQL
alphorm.com - Formation Linux LPIC-2
LSFMM 2019 BPF Observability
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
Linux Performance Profiling and Monitoring
File permission in linux
MySQL SQL Tutorial
OSNoise Tracer: Who Is Stealing My CPU Time?
systemd
Introduction to Linux
Transparent Data Encryption in PostgreSQL and Integration with Key Management...
Linux Hardening
Linux presentation
Linux Network Administration (LPI-1,LPI-2)
Ad

Viewers also liked (20)

PDF
Ubuntu 16.04 LTS Security Features
PPT
Configuring Dns
PDF
How to use SELINUX (No I don't mean turn it off)
PDF
Selinux
PDF
Ubuntu an absolute beginners guide
ODP
CLUG 2010 09 - systemd - the new init system
PPTX
Operating system enhancements to prevent misuse of systems
PPTX
Chapter 3 security part i auditing operating systems and networks
ODP
Introduction to Selinux
PPT
OS Security 2009
ODP
OpenShift & SELinux with Dan Walsh @rhatdan
PPT
Operating system security (a brief)
PDF
Kernel Recipes 2015 - Hardened kernels for everyone
PPT
How ubuntu works???
PDF
PDF
SELinux basics
ODP
RHEL/Fedora + Docker (and SELinux)
PDF
Network Architecture Review Checklist
PPT
Chapter 14 - Protection
PPTX
COMPUTER SECURITY AND OPERATING SYSTEM
Ubuntu 16.04 LTS Security Features
Configuring Dns
How to use SELINUX (No I don't mean turn it off)
Selinux
Ubuntu an absolute beginners guide
CLUG 2010 09 - systemd - the new init system
Operating system enhancements to prevent misuse of systems
Chapter 3 security part i auditing operating systems and networks
Introduction to Selinux
OS Security 2009
OpenShift & SELinux with Dan Walsh @rhatdan
Operating system security (a brief)
Kernel Recipes 2015 - Hardened kernels for everyone
How ubuntu works???
SELinux basics
RHEL/Fedora + Docker (and SELinux)
Network Architecture Review Checklist
Chapter 14 - Protection
COMPUTER SECURITY AND OPERATING SYSTEM
Ad

Similar to Slug 2009 06 SELinux For Sysadmins (20)

PDF
Samba
ODP
DNSSEC - WHAT IS IT ? INSTALL AND CONFIGURE IN CHROOT JAIL
PDF
55 best linux tips, tricks and command lines
PDF
Basic linux commands
DOCX
50 Most Frequently Used UNIX Linux Commands -hmftj
PPT
101 3.3 perform basic file management
DOCX
50 most frequently used unix
DOCX
50 most frequently used unix
PPT
Python Deployment with Fabric
PDF
Using filesystem capabilities with rsync
PDF
linux-namespaces.pdf
DOCX
Samba 4 - debian instalacao
PDF
Unix Basics Commands
PDF
Install tomcat 5.5 in debian os and deploy war file
PPT
Champion Fas Deduplication
PPTX
how to generate debian package from scratch
PDF
Devops for beginners
PDF
OpenStack Tokyo Meeup - Gluster Storage Day
PDF
Linux Common Command
Samba
DNSSEC - WHAT IS IT ? INSTALL AND CONFIGURE IN CHROOT JAIL
55 best linux tips, tricks and command lines
Basic linux commands
50 Most Frequently Used UNIX Linux Commands -hmftj
101 3.3 perform basic file management
50 most frequently used unix
50 most frequently used unix
Python Deployment with Fabric
Using filesystem capabilities with rsync
linux-namespaces.pdf
Samba 4 - debian instalacao
Unix Basics Commands
Install tomcat 5.5 in debian os and deploy war file
Champion Fas Deduplication
how to generate debian package from scratch
Devops for beginners
OpenStack Tokyo Meeup - Gluster Storage Day
Linux Common Command

Recently uploaded (20)

PDF
cuic standard and advanced reporting.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Approach and Philosophy of On baking technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Machine learning based COVID-19 study performance prediction
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
cuic standard and advanced reporting.pdf
Big Data Technologies - Introduction.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Review of recent advances in non-invasive hemoglobin estimation
NewMind AI Weekly Chronicles - August'25 Week I
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Encapsulation theory and applications.pdf
Approach and Philosophy of On baking technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Machine learning based COVID-19 study performance prediction
Building Integrated photovoltaic BIPV_UPV.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Dropbox Q2 2025 Financial Results & Investor Presentation
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Spectral efficient network and resource selection model in 5G networks
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Agricultural_Statistics_at_a_Glance_2022_0.pdf

Slug 2009 06 SELinux For Sysadmins