SlideShare uma empresa Scribd logo
1 de 20
Baixar para ler offline
Stop disabling SElinux
By: Mehdi Mehranfarid
LPI Certified Senior Instructor
Email: mehranfarid@anisa.co.ir
1
Selinux, Don’t be afraid!
Kick the “disable” habit!
Instructor: Mehdi Mehranfarid
2
Traditional Unix DAC approach
DAC:
 You decided how you want to protect and share your data.
 Typical Linux distributions use DAC (Discretionary Access Control).
 Process with effective UID/GID.
 chmod, chown, chattr, facl
 When a user or application is compromised, security is compromised.
Instructor: Mehdi Mehranfarid
3
Mac approach
MAC:
 The system decided how the data will be shared.
 Selinux is an implementation of MAC (Mandatory Access Control).
 The linux kernel has full control of security.
 Only system administrator is decide what is allowed on the system.
 A policy enforced by the linux kernel on what processes and are aren’t
allowed to do.
 By default, everything is denied unless specifically enabled.
Instructor: Mehdi Mehranfarid
4
Selinux
 Original authors are NSA and Redhats
 Released the first version to the open source development
community under the GNU GPL on December 22, 2000.
 Merged into the mainline Linux kernel 2.6.0-test3, released on 8
August 2003.
 Infested by jargons:
Policies, contex, lable, role, type, sensisivity level, booleans, oh my
God.
 SELinux is a set of kernel modifications ( LSM Modules ) and user-
space tools that have been added to various Linux distributions.
Instructor: Mehdi Mehranfarid
5
Context
With selinux every thing has a security context.
A process has a context.
A file has a context.
Database of rules:
Rules allow a process in one context to do operations on
an object in another context.
Instructor: Mehdi Mehranfarid
6
SELinux Contexts
Processes and files are labeled with an SELinux context
that contains additional information, such as an SELinux
user, role, type, and, optionally, a level.
Instructor: Mehdi Mehranfarid
7
Context
With selinux every thing has a security context.
A process has a context.
A file has a context.
Database of rules:
Rules allow a process in one context to do operations on
an object in another context.
Instructor: Mehdi Mehranfarid
8
SELinux Decision Process
9
Instructor: Mehdi Mehranfarid
High-level overview of how LSM is integrated in
the Linux kernel
10
Instructor: Mehdi Mehranfarid
SElinux enabled disrtributions
Native support:
RHEL, Centos, Fedora, Oracle Linux
SLES, OpenSuse (almost)
Not native supported, but can be added:
Debian, ubuntu
Gentoo, Arch Linux
…
11
Instructor: Mehdi Mehranfarid
SElinux policy
SElinux requires a policy to start.
Switching policy requires a system reboot and even relabeling.
Use “sestatus” to see the active policy in use.
# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current Mode: enforcing
Mode from config file: enforcing
Policy Version: 24
Policy from config file: targeted
Set the policy to be loaded at boot in /etc/selinux/config
12
Instructor: Mehdi Mehranfarid
SELinux Operating Modes
SELinux has three operation modes: enforcing, permissive
and diasbled.
 In enforcing mode SELinux is fully functional.
 In permissive mode, SELinux does not enforce the
policy. This can be useful for troubleshooting and for
developing or fine-tuning SELinux policy.
 In disable mode, SELinux is completely disabled.
13
Instructor: Mehdi Mehranfarid
Using Security Enhanced Linux
Step 1: Check our system kernel for Selinux support
root@anisa# cd /boot
root@anisa# grep –i selinux config-`uname -r`
Step 2: Check selinux current status
root@anisa# sestatus
Step 3: navigate to selinux main directory
root@anisa# cd /etc/selinux
Step 4: Check the selinux default state config
root@anisa# cat /etc/selinux/config
14
Instructor: Mehdi Mehranfarid
Using Security Enhanced Linux
Step 5: Change the default selinux mode (It needs system restart to
take effect)
root@anisa# system-config-securitylevel
Step 6: Change selinux mode at runtime (Just in some distros)
root@anisa# echo 1 > /selinux/enforce
root@anisa# sestatus
Step 7: change the current selinux mode to permissive
root@anisa# echo 0 > /selinux/enforce
root@anisa# sestatus
15
Instructor: Mehdi Mehranfarid
Allowing Access to a Port
(Apache bind on a non-standard port)
Step 1: Create home directory for one site:
root@anisa# mkdir /var/www/lpir_org
root@anisa# cd /var/www/lpir_org
root@anisa# echo “Test content" > index.html
Step 2: Configure port based virtual hosting:
Edit file /etc/httpd/conf/httpd.conf and add the following:
Listen 8090
<VirtualHost *:8090>
DocumentRoot /var/www/lpir_org
</VirtualHost>
16
Instructor: Mehdi Mehranfarid
Allowing Access to a Port
(Apache bind on a non-standard port)
Step 3: enable selinux and restart server & test:
root@anisa# echo 1 > /selinux/enforce
root@anisa# service httpd restart # watch the error messages
Step 4: Add a rule to allow
root@anisa# semanage port –l | grep http
root@anisa# semanage port -a -t http_port_t -p tcp 8090
root@anisa# semanage port –l | grep http
root@anisa# service httpd restart
root@anisa# firefox http://127.0.0.1:8090
root@anisa# semanage port -d -t http_port_t -p tcp 8090
root@anisa# service httpd restart
17
Instructor: Mehdi Mehranfarid
Disable protection of currently
protected deamon
On system with Enforcing mode:
root@anisa# ps –auxZ | grep httpd
root@anisa# cat /selinux/booleans/httpd_disable_trans
root@anisa# echo “1 1” > /selinux/Booleans/httpd_disable_trans
root@anisa# echo “1” > /selinux/commit_pending_bools
root@anisa# echo $?
root@anisa# service httpd restart
root@anisa# ps –auxZ | grep httpd
18
Instructor: Mehdi Mehranfarid
Disable protection of currently
protected deamon
now test the public home directory when httpd in run in an unconfined
domain (initrc_t).
Go back to previous status:
root@anisa# echo “0 0” > /selinux/Booleans/httpd_disable_trans
root@anisa# echo “1” > /selinux/commit_pending_bools
root@anisa# service httpd restart
root@anisa# ps –auxZ | grep httpd
19
Instructor: Mehdi Mehranfarid
Thanks for your attention
&
Best Regards
20
Instructor: Mehdi Mehranfarid

Mais conteúdo relacionado

Mais procurados

Basic Linux Security
Basic Linux SecurityBasic Linux Security
Basic Linux Security
pankaj009
 
Linux Operating System Vulnerabilities
Linux Operating System VulnerabilitiesLinux Operating System Vulnerabilities
Linux Operating System Vulnerabilities
Information Technology
 

Mais procurados (20)

Basic Linux Security
Basic Linux SecurityBasic Linux Security
Basic Linux Security
 
File System Implementation & Linux Security
File System Implementation & Linux SecurityFile System Implementation & Linux Security
File System Implementation & Linux Security
 
Introduction to SELinux Part-I
Introduction to SELinux Part-IIntroduction to SELinux Part-I
Introduction to SELinux Part-I
 
Nessus Basics
Nessus BasicsNessus Basics
Nessus Basics
 
Threats, Vulnerabilities & Security measures in Linux
Threats, Vulnerabilities & Security measures in LinuxThreats, Vulnerabilities & Security measures in Linux
Threats, Vulnerabilities & Security measures in Linux
 
Inside Out Hacking - Bypassing Firewall
Inside Out Hacking - Bypassing FirewallInside Out Hacking - Bypassing Firewall
Inside Out Hacking - Bypassing Firewall
 
Tutorial 2
Tutorial 2Tutorial 2
Tutorial 2
 
Stop disabling SELinux!
Stop disabling SELinux!Stop disabling SELinux!
Stop disabling SELinux!
 
Linux Operating System Vulnerabilities
Linux Operating System VulnerabilitiesLinux Operating System Vulnerabilities
Linux Operating System Vulnerabilities
 
Essential security for linux servers
Essential security for linux serversEssential security for linux servers
Essential security for linux servers
 
Secure and Simple Sandboxing in SELinux
Secure and Simple Sandboxing in SELinuxSecure and Simple Sandboxing in SELinux
Secure and Simple Sandboxing in SELinux
 
Linux Security Overview
Linux Security OverviewLinux Security Overview
Linux Security Overview
 
Shellshock bug
Shellshock bugShellshock bug
Shellshock bug
 
Linux security-fosster-09
Linux security-fosster-09Linux security-fosster-09
Linux security-fosster-09
 
Shell Shock (Bash Bug)
Shell Shock (Bash Bug)Shell Shock (Bash Bug)
Shell Shock (Bash Bug)
 
nessus
nessusnessus
nessus
 
ShellShock (Software BASH Bug)
ShellShock (Software BASH Bug)ShellShock (Software BASH Bug)
ShellShock (Software BASH Bug)
 
Demo of security tool nessus - Network vulnerablity scanner
Demo of security tool nessus - Network vulnerablity scannerDemo of security tool nessus - Network vulnerablity scanner
Demo of security tool nessus - Network vulnerablity scanner
 
Shellshock - A Software Bug
Shellshock - A Software BugShellshock - A Software Bug
Shellshock - A Software Bug
 
Slides null puliya linux basics
Slides null puliya linux basicsSlides null puliya linux basics
Slides null puliya linux basics
 

Destaque

متن‌بازسازی کلان‌داده
متن‌بازسازی کلان‌دادهمتن‌بازسازی کلان‌داده
متن‌بازسازی کلان‌داده
جشنوارهٔ روز آزادی نرم‌افزار تهران
 
استفاده از الگوهای گرامر موازی در ماشینهای ترجمه/ هشام فیلی
استفاده از الگوهای گرامر موازی در ماشینهای ترجمه/ هشام فیلیاستفاده از الگوهای گرامر موازی در ماشینهای ترجمه/ هشام فیلی
استفاده از الگوهای گرامر موازی در ماشینهای ترجمه/ هشام فیلی
Sara Nasrollahi
 
آموزش کار با GIT
آموزش کار با GITآموزش کار با GIT
چیزهایی در مورد ویکی‌پدیا که نمی‌دانستید
چیزهایی در مورد ویکی‌پدیا که نمی‌دانستیدچیزهایی در مورد ویکی‌پدیا که نمی‌دانستید
چیزهایی در مورد ویکی‌پدیا که نمی‌دانستید
جشنوارهٔ روز آزادی نرم‌افزار تهران
 

Destaque (20)

یادگیری هک کلاه سفید و تست نفوذ به شبکه
یادگیری هک کلاه سفید و تست نفوذ به شبکهیادگیری هک کلاه سفید و تست نفوذ به شبکه
یادگیری هک کلاه سفید و تست نفوذ به شبکه
 
متن‌بازسازی کلان‌داده
متن‌بازسازی کلان‌دادهمتن‌بازسازی کلان‌داده
متن‌بازسازی کلان‌داده
 
استفاده از الگوهای گرامر موازی در ماشینهای ترجمه/ هشام فیلی
استفاده از الگوهای گرامر موازی در ماشینهای ترجمه/ هشام فیلیاستفاده از الگوهای گرامر موازی در ماشینهای ترجمه/ هشام فیلی
استفاده از الگوهای گرامر موازی در ماشینهای ترجمه/ هشام فیلی
 
گذری بر آزادی
گذری بر آزادیگذری بر آزادی
گذری بر آزادی
 
Embedded linux from scratch
Embedded linux from scratchEmbedded linux from scratch
Embedded linux from scratch
 
آموزش کار با GIT
آموزش کار با GITآموزش کار با GIT
آموزش کار با GIT
 
آشنایی با دانش آزاد
آشنایی با دانش آزادآشنایی با دانش آزاد
آشنایی با دانش آزاد
 
چیزهایی در مورد ویکی‌پدیا که نمی‌دانستید
چیزهایی در مورد ویکی‌پدیا که نمی‌دانستیدچیزهایی در مورد ویکی‌پدیا که نمی‌دانستید
چیزهایی در مورد ویکی‌پدیا که نمی‌دانستید
 
Big Data and select suitable tools
Big Data and select suitable toolsBig Data and select suitable tools
Big Data and select suitable tools
 
آشنایی با درس حجیم آزاد آنلاین (ماک)
آشنایی با درس حجیم آزاد آنلاین (ماک)آشنایی با درس حجیم آزاد آنلاین (ماک)
آشنایی با درس حجیم آزاد آنلاین (ماک)
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
Linux Jobs, Training and Certifications
Linux Jobs, Training and CertificationsLinux Jobs, Training and Certifications
Linux Jobs, Training and Certifications
 
4 ويژگي عظيم داده
4 ويژگي عظيم داده 4 ويژگي عظيم داده
4 ويژگي عظيم داده
 
کلان داده کاربردها و چالش های آن
کلان داده کاربردها و چالش های آنکلان داده کاربردها و چالش های آن
کلان داده کاربردها و چالش های آن
 
بیگ دیتا
بیگ دیتابیگ دیتا
بیگ دیتا
 
هادوپ چيست؟
هادوپ چيست؟هادوپ چيست؟
هادوپ چيست؟
 
Big Data Processing in Cloud Computing Environments
Big Data Processing in Cloud Computing EnvironmentsBig Data Processing in Cloud Computing Environments
Big Data Processing in Cloud Computing Environments
 
A Story of Big Data:Introduction
A Story of Big Data:IntroductionA Story of Big Data:Introduction
A Story of Big Data:Introduction
 
Big data بزرگ داده ها
Big data بزرگ داده هاBig data بزرگ داده ها
Big data بزرگ داده ها
 
cryptography
cryptographycryptography
cryptography
 

Semelhante a کارگاه امنیت با عنوان Stop Disabling SElinux

4 effective methods to disable se linux temporarily or permanently
4 effective methods to disable se linux temporarily or permanently4 effective methods to disable se linux temporarily or permanently
4 effective methods to disable se linux temporarily or permanently
chinkshady
 
Essay About ISS 418 Lab 7 And 8
Essay About ISS 418 Lab 7 And 8Essay About ISS 418 Lab 7 And 8
Essay About ISS 418 Lab 7 And 8
Paula Smith
 
SELinux_@gnu_group_meetup
SELinux_@gnu_group_meetupSELinux_@gnu_group_meetup
SELinux_@gnu_group_meetup
Jayant Chutke
 
Advance linux presentation_0702011
Advance linux presentation_0702011Advance linux presentation_0702011
Advance linux presentation_0702011
Aravindan Arun
 

Semelhante a کارگاه امنیت با عنوان Stop Disabling SElinux (20)

SELinux Basic Usage
SELinux Basic UsageSELinux Basic Usage
SELinux Basic Usage
 
selinuxbasicusage.pptx
selinuxbasicusage.pptxselinuxbasicusage.pptx
selinuxbasicusage.pptx
 
Selinux
SelinuxSelinux
Selinux
 
Introduction To SELinux
Introduction To SELinuxIntroduction To SELinux
Introduction To SELinux
 
4 effective methods to disable se linux temporarily or permanently
4 effective methods to disable se linux temporarily or permanently4 effective methods to disable se linux temporarily or permanently
4 effective methods to disable se linux temporarily or permanently
 
Linux
Linux Linux
Linux
 
Essay About ISS 418 Lab 7 And 8
Essay About ISS 418 Lab 7 And 8Essay About ISS 418 Lab 7 And 8
Essay About ISS 418 Lab 7 And 8
 
Linux host review
Linux host reviewLinux host review
Linux host review
 
First steps on CentOs7
First steps on CentOs7First steps on CentOs7
First steps on CentOs7
 
SELinux_@gnu_group_meetup
SELinux_@gnu_group_meetupSELinux_@gnu_group_meetup
SELinux_@gnu_group_meetup
 
SELinux for Everyday Users
SELinux for Everyday UsersSELinux for Everyday Users
SELinux for Everyday Users
 
Understanding SELinux For the Win
Understanding SELinux For the WinUnderstanding SELinux For the Win
Understanding SELinux For the Win
 
Hardening Linux, introducing Securix GNU/Linux
Hardening Linux, introducing Securix GNU/LinuxHardening Linux, introducing Securix GNU/Linux
Hardening Linux, introducing Securix GNU/Linux
 
Advance linux presentation_0702011
Advance linux presentation_0702011Advance linux presentation_0702011
Advance linux presentation_0702011
 
2008 08-12 SELinux: A Key Component in Secure Infrastructures
2008 08-12 SELinux: A Key Component in Secure Infrastructures2008 08-12 SELinux: A Key Component in Secure Infrastructures
2008 08-12 SELinux: A Key Component in Secure Infrastructures
 
2008-10-15 Red Hat Deep Dive Sessions: SELinux
2008-10-15 Red Hat Deep Dive Sessions: SELinux2008-10-15 Red Hat Deep Dive Sessions: SELinux
2008-10-15 Red Hat Deep Dive Sessions: SELinux
 
Linux remote
Linux remoteLinux remote
Linux remote
 
Linux Device Driver’s
Linux Device Driver’sLinux Device Driver’s
Linux Device Driver’s
 
Linux
LinuxLinux
Linux
 
Red Hat Linux 5 Hardening Tips - National Security Agency
Red Hat Linux 5 Hardening Tips - National Security AgencyRed Hat Linux 5 Hardening Tips - National Security Agency
Red Hat Linux 5 Hardening Tips - National Security Agency
 

Mais de جشنوارهٔ روز آزادی نرم‌افزار تهران

چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟
چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟
چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟
جشنوارهٔ روز آزادی نرم‌افزار تهران
 
حرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آن
حرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آنحرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آن
حرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آن
جشنوارهٔ روز آزادی نرم‌افزار تهران
 
خلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعه
خلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعهخلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعه
خلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعه
جشنوارهٔ روز آزادی نرم‌افزار تهران
 
برنامهٔ آموزشی ویکی‌پدیا
برنامهٔ آموزشی ویکی‌پدیابرنامهٔ آموزشی ویکی‌پدیا
برنامهٔ آموزشی ویکی‌پدیا
جشنوارهٔ روز آزادی نرم‌افزار تهران
 
چه هنگام نرم‌افزار آزاد به دام غیرآزاد می‌افتد؟
چه هنگام نرم‌افزار آزاد به دام غیرآزاد می‌افتد؟چه هنگام نرم‌افزار آزاد به دام غیرآزاد می‌افتد؟
چه هنگام نرم‌افزار آزاد به دام غیرآزاد می‌افتد؟
جشنوارهٔ روز آزادی نرم‌افزار تهران
 
با سوزان آشنا شوید! (معرفی نرم افزار بلندر)
با سوزان آشنا شوید! (معرفی نرم افزار بلندر)با سوزان آشنا شوید! (معرفی نرم افزار بلندر)
با سوزان آشنا شوید! (معرفی نرم افزار بلندر)
جشنوارهٔ روز آزادی نرم‌افزار تهران
 
آزادی و محرمانگی در رایانش همراه
آزادی و محرمانگی در رایانش همراهآزادی و محرمانگی در رایانش همراه
آزادی و محرمانگی در رایانش همراه
جشنوارهٔ روز آزادی نرم‌افزار تهران
 
چرایی تغییر دیدگاه شرکت های انحصاری نسبت به نرم افزار آزاد
چرایی تغییر دیدگاه شرکت های انحصاری نسبت به نرم افزار آزادچرایی تغییر دیدگاه شرکت های انحصاری نسبت به نرم افزار آزاد
چرایی تغییر دیدگاه شرکت های انحصاری نسبت به نرم افزار آزاد
جشنوارهٔ روز آزادی نرم‌افزار تهران
 
چگونگی ارسال packet در شبکه و مروری بر Wireshark
چگونگی ارسال packet در شبکه و مروری بر Wiresharkچگونگی ارسال packet در شبکه و مروری بر Wireshark
چگونگی ارسال packet در شبکه و مروری بر Wireshark
جشنوارهٔ روز آزادی نرم‌افزار تهران
 
چگونگی ارسال packet در شبکه و مروری بر Wireshark
چگونگی ارسال packet در شبکه و مروری بر Wiresharkچگونگی ارسال packet در شبکه و مروری بر Wireshark
چگونگی ارسال packet در شبکه و مروری بر Wireshark
جشنوارهٔ روز آزادی نرم‌افزار تهران
 

Mais de جشنوارهٔ روز آزادی نرم‌افزار تهران (20)

Rights in CopyLeft
Rights in CopyLeftRights in CopyLeft
Rights in CopyLeft
 
Jekyll
JekyllJekyll
Jekyll
 
چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟
چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟
چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟
 
StarCalendar
StarCalendarStarCalendar
StarCalendar
 
حرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آن
حرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آنحرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آن
حرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آن
 
خلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعه
خلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعهخلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعه
خلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعه
 
برنامهٔ آموزشی ویکی‌پدیا
برنامهٔ آموزشی ویکی‌پدیابرنامهٔ آموزشی ویکی‌پدیا
برنامهٔ آموزشی ویکی‌پدیا
 
چه هنگام نرم‌افزار آزاد به دام غیرآزاد می‌افتد؟
چه هنگام نرم‌افزار آزاد به دام غیرآزاد می‌افتد؟چه هنگام نرم‌افزار آزاد به دام غیرآزاد می‌افتد؟
چه هنگام نرم‌افزار آزاد به دام غیرآزاد می‌افتد؟
 
با سوزان آشنا شوید! (معرفی نرم افزار بلندر)
با سوزان آشنا شوید! (معرفی نرم افزار بلندر)با سوزان آشنا شوید! (معرفی نرم افزار بلندر)
با سوزان آشنا شوید! (معرفی نرم افزار بلندر)
 
آزادی و محرمانگی در رایانش همراه
آزادی و محرمانگی در رایانش همراهآزادی و محرمانگی در رایانش همراه
آزادی و محرمانگی در رایانش همراه
 
سیاست‌های کمتر شناخته‌شده ویکی‌پدیا
سیاست‌های کمتر شناخته‌شده ویکی‌پدیاسیاست‌های کمتر شناخته‌شده ویکی‌پدیا
سیاست‌های کمتر شناخته‌شده ویکی‌پدیا
 
معرفی بنیاد ویکی‌مدیا و پروژه‌هایش (به جز ویکی‌پدیا)
معرفی بنیاد ویکی‌مدیا و پروژه‌هایش (به جز ویکی‌پدیا)معرفی بنیاد ویکی‌مدیا و پروژه‌هایش (به جز ویکی‌پدیا)
معرفی بنیاد ویکی‌مدیا و پروژه‌هایش (به جز ویکی‌پدیا)
 
چرایی تغییر دیدگاه شرکت های انحصاری نسبت به نرم افزار آزاد
چرایی تغییر دیدگاه شرکت های انحصاری نسبت به نرم افزار آزادچرایی تغییر دیدگاه شرکت های انحصاری نسبت به نرم افزار آزاد
چرایی تغییر دیدگاه شرکت های انحصاری نسبت به نرم افزار آزاد
 
معرفی و ساخت یک فریم‌ورک شخصی به کمک لاراول
معرفی و ساخت یک فریم‌ورک شخصی به کمک لاراولمعرفی و ساخت یک فریم‌ورک شخصی به کمک لاراول
معرفی و ساخت یک فریم‌ورک شخصی به کمک لاراول
 
چگونگی ارسال packet در شبکه و مروری بر Wireshark
چگونگی ارسال packet در شبکه و مروری بر Wiresharkچگونگی ارسال packet در شبکه و مروری بر Wireshark
چگونگی ارسال packet در شبکه و مروری بر Wireshark
 
چگونگی ارسال packet در شبکه و مروری بر Wireshark
چگونگی ارسال packet در شبکه و مروری بر Wiresharkچگونگی ارسال packet در شبکه و مروری بر Wireshark
چگونگی ارسال packet در شبکه و مروری بر Wireshark
 
کار با اوپن‌استریت‌مپ (OSM) از مبتدی تا پیشرفته
کار با اوپن‌استریت‌مپ (OSM) از مبتدی تا پیشرفتهکار با اوپن‌استریت‌مپ (OSM) از مبتدی تا پیشرفته
کار با اوپن‌استریت‌مپ (OSM) از مبتدی تا پیشرفته
 
متاپست (MetaPost)
متاپست (MetaPost)متاپست (MetaPost)
متاپست (MetaPost)
 
داده‌کاوی و زبان برنامه‌نویسی R
داده‌کاوی و زبان برنامه‌نویسی Rداده‌کاوی و زبان برنامه‌نویسی R
داده‌کاوی و زبان برنامه‌نویسی R
 
ارائهٔ DLP
ارائهٔ DLPارائهٔ DLP
ارائهٔ DLP
 

Último

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 

کارگاه امنیت با عنوان Stop Disabling SElinux

  • 1. Stop disabling SElinux By: Mehdi Mehranfarid LPI Certified Senior Instructor Email: mehranfarid@anisa.co.ir 1
  • 2. Selinux, Don’t be afraid! Kick the “disable” habit! Instructor: Mehdi Mehranfarid 2
  • 3. Traditional Unix DAC approach DAC:  You decided how you want to protect and share your data.  Typical Linux distributions use DAC (Discretionary Access Control).  Process with effective UID/GID.  chmod, chown, chattr, facl  When a user or application is compromised, security is compromised. Instructor: Mehdi Mehranfarid 3
  • 4. Mac approach MAC:  The system decided how the data will be shared.  Selinux is an implementation of MAC (Mandatory Access Control).  The linux kernel has full control of security.  Only system administrator is decide what is allowed on the system.  A policy enforced by the linux kernel on what processes and are aren’t allowed to do.  By default, everything is denied unless specifically enabled. Instructor: Mehdi Mehranfarid 4
  • 5. Selinux  Original authors are NSA and Redhats  Released the first version to the open source development community under the GNU GPL on December 22, 2000.  Merged into the mainline Linux kernel 2.6.0-test3, released on 8 August 2003.  Infested by jargons: Policies, contex, lable, role, type, sensisivity level, booleans, oh my God.  SELinux is a set of kernel modifications ( LSM Modules ) and user- space tools that have been added to various Linux distributions. Instructor: Mehdi Mehranfarid 5
  • 6. Context With selinux every thing has a security context. A process has a context. A file has a context. Database of rules: Rules allow a process in one context to do operations on an object in another context. Instructor: Mehdi Mehranfarid 6
  • 7. SELinux Contexts Processes and files are labeled with an SELinux context that contains additional information, such as an SELinux user, role, type, and, optionally, a level. Instructor: Mehdi Mehranfarid 7
  • 8. Context With selinux every thing has a security context. A process has a context. A file has a context. Database of rules: Rules allow a process in one context to do operations on an object in another context. Instructor: Mehdi Mehranfarid 8
  • 10. High-level overview of how LSM is integrated in the Linux kernel 10 Instructor: Mehdi Mehranfarid
  • 11. SElinux enabled disrtributions Native support: RHEL, Centos, Fedora, Oracle Linux SLES, OpenSuse (almost) Not native supported, but can be added: Debian, ubuntu Gentoo, Arch Linux … 11 Instructor: Mehdi Mehranfarid
  • 12. SElinux policy SElinux requires a policy to start. Switching policy requires a system reboot and even relabeling. Use “sestatus” to see the active policy in use. # sestatus SELinux status: enabled SELinuxfs mount: /selinux Current Mode: enforcing Mode from config file: enforcing Policy Version: 24 Policy from config file: targeted Set the policy to be loaded at boot in /etc/selinux/config 12 Instructor: Mehdi Mehranfarid
  • 13. SELinux Operating Modes SELinux has three operation modes: enforcing, permissive and diasbled.  In enforcing mode SELinux is fully functional.  In permissive mode, SELinux does not enforce the policy. This can be useful for troubleshooting and for developing or fine-tuning SELinux policy.  In disable mode, SELinux is completely disabled. 13 Instructor: Mehdi Mehranfarid
  • 14. Using Security Enhanced Linux Step 1: Check our system kernel for Selinux support root@anisa# cd /boot root@anisa# grep –i selinux config-`uname -r` Step 2: Check selinux current status root@anisa# sestatus Step 3: navigate to selinux main directory root@anisa# cd /etc/selinux Step 4: Check the selinux default state config root@anisa# cat /etc/selinux/config 14 Instructor: Mehdi Mehranfarid
  • 15. Using Security Enhanced Linux Step 5: Change the default selinux mode (It needs system restart to take effect) root@anisa# system-config-securitylevel Step 6: Change selinux mode at runtime (Just in some distros) root@anisa# echo 1 > /selinux/enforce root@anisa# sestatus Step 7: change the current selinux mode to permissive root@anisa# echo 0 > /selinux/enforce root@anisa# sestatus 15 Instructor: Mehdi Mehranfarid
  • 16. Allowing Access to a Port (Apache bind on a non-standard port) Step 1: Create home directory for one site: root@anisa# mkdir /var/www/lpir_org root@anisa# cd /var/www/lpir_org root@anisa# echo “Test content" > index.html Step 2: Configure port based virtual hosting: Edit file /etc/httpd/conf/httpd.conf and add the following: Listen 8090 <VirtualHost *:8090> DocumentRoot /var/www/lpir_org </VirtualHost> 16 Instructor: Mehdi Mehranfarid
  • 17. Allowing Access to a Port (Apache bind on a non-standard port) Step 3: enable selinux and restart server & test: root@anisa# echo 1 > /selinux/enforce root@anisa# service httpd restart # watch the error messages Step 4: Add a rule to allow root@anisa# semanage port –l | grep http root@anisa# semanage port -a -t http_port_t -p tcp 8090 root@anisa# semanage port –l | grep http root@anisa# service httpd restart root@anisa# firefox http://127.0.0.1:8090 root@anisa# semanage port -d -t http_port_t -p tcp 8090 root@anisa# service httpd restart 17 Instructor: Mehdi Mehranfarid
  • 18. Disable protection of currently protected deamon On system with Enforcing mode: root@anisa# ps –auxZ | grep httpd root@anisa# cat /selinux/booleans/httpd_disable_trans root@anisa# echo “1 1” > /selinux/Booleans/httpd_disable_trans root@anisa# echo “1” > /selinux/commit_pending_bools root@anisa# echo $? root@anisa# service httpd restart root@anisa# ps –auxZ | grep httpd 18 Instructor: Mehdi Mehranfarid
  • 19. Disable protection of currently protected deamon now test the public home directory when httpd in run in an unconfined domain (initrc_t). Go back to previous status: root@anisa# echo “0 0” > /selinux/Booleans/httpd_disable_trans root@anisa# echo “1” > /selinux/commit_pending_bools root@anisa# service httpd restart root@anisa# ps –auxZ | grep httpd 19 Instructor: Mehdi Mehranfarid
  • 20. Thanks for your attention & Best Regards 20 Instructor: Mehdi Mehranfarid