Top Banner
SELinux 101 Mateusz Stahl [email protected]
16

[Wroclaw #3] SELinux 101

Jan 16, 2017

Download

Technology

OWASP
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: [Wroclaw #3] SELinux 101

SELinux 101

Mateusz Stahl [email protected]

Page 2: [Wroclaw #3] SELinux 101

Some observations about SELinux

•  People talk about SELinux •  People know it’s powerful •  People remember how complicated it was •  People in many cases don’t use it

Page 3: [Wroclaw #3] SELinux 101

What is SELinux

•  Is a Linux kernel security module that provides a mechanism for supporting access control

•  Created by NSA & Red Hat • Developed by Red Hat •  Initial release 01.01.1998 (18 years old) • MAC mechanism

Page 4: [Wroclaw #3] SELinux 101

DAC vs MAC

• Discretionary Access Control

lrwxr-xr-x 1 root wheel 49B Mar 6 2014 User Data

l – stands for link rwx – read/write/execute (user) r-x – read/-/execute (group) r-x – read/-/execute (other)

Page 5: [Wroclaw #3] SELinux 101

DAC vs MAC

• Mandatory Access Control

drwxr-xr-x root root unconfined_u:object_r:httpd_sys_content_t:s0 SETest d – stands for directory rwx – read/write/execute (user) r-x – read/-/execute (group) r-x – read/-/execute (other)

unconfined_u – user label object_r – role label httpd_sys_content_t – type label s0 – level label

Page 6: [Wroclaw #3] SELinux 101

DAC vs MAC

• Mandatory Access Control

Allows to protect access between: –  Users –  Files –  Memory –  Sockets –  tcp/udp Ports –  etc..

Page 7: [Wroclaw #3] SELinux 101

How does SELinux work

Page 8: [Wroclaw #3] SELinux 101

How does SELinux work

Page 9: [Wroclaw #3] SELinux 101

How does SELinux work

Page 10: [Wroclaw #3] SELinux 101

Policy

•  targeted –  Only targeted processes are protected –  Everything else is unconfined

• mls – multi-level/multi-category security –  Out of scope for today –  Very complex

Page 11: [Wroclaw #3] SELinux 101

Command Line Tools

•  You should remember one –Z switch –  ls –  netstat –  ps –  etc..

Page 12: [Wroclaw #3] SELinux 101

SELinux Command Line Tools

•  sestatus •  semanage •  setenforce •  getenforce •  setsebool •  sealert

Page 13: [Wroclaw #3] SELinux 101

SELinux – important files

•  /etc/selinux/config •  /var/log/audit/audit.log •  /var/log/messages •  /var/log/secure

Page 14: [Wroclaw #3] SELinux 101

Targeted policy for web servers

•  Live DEMO

Page 15: [Wroclaw #3] SELinux 101

Typical problems of the SELinux on today’s Linux Distros

Page 16: [Wroclaw #3] SELinux 101

SELinux 101

Mateusz Stahl [email protected]