SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
Jozi LUG - SELinux




Introduction to Security Enhanced Linux
            26th March 2012
              Sponsored by
            LPI South Africa
Topics



●   What is SELinux?
●   Computer Security Models
●   Mandatory Access Control & Discretionary
    Access Control
●   SELinux Policy
●   Object Classes and actions/permissions
Topics


●   Security Context
●   File Security Context
●   Troubleshooting & Tools
●   SELinux Booleans
●   SELinux Managing Ports
●   SELinux Writing Policy
What is SELinux


●   A mechanism for supporting mandatory
    access control (mac),role based access
    control (rbac) & multi-level security (msl/mcs)
●   Implemented as a Linux Security Module(LSM)
●   LSM allows kernel to support different security
    models used by:
       ●   AppArmor,Smack,SELinux
Computer Security Models


●   Three security models possible with SELinux
       ●   MLS/MCS – multilevel security, multi category
            security. Mainly about file access. Every
            subject must have clearance level and also
            every file (not covered) Top Secret, Secret,
            Confidential and Unclassified
       ●   RBAC – role base access control, how users
            transition between roles and domains to which
            roles have rights, roles aggregate permissions
Computer Security Models


       ●   Mandatory Access Control via Type
            Enforcement – First step before MLS/MCS.
            Good for daemons, services
●   This presentations focuses on MAC via TE in
    SELinux. Although other security models can
    be used they are too restrictive for most
    situation there limited TE used. MAC mainly
    useful for daemons and processes not users
Mandatory Access Control Definition


●   Mandatory Access Control (MAC) – security
    policy sets access controls and cannot be
    changed by system users or processes,
●   Discretionary Access Control (DAC) –
    underlying unix permissions can be changed at
    the discretion of the file owner
Mandatory/Discretionary Access
               Control

●   DAC makes system vulnerable, users can
    change permissions and no protection from
    broken software, i.e. process has complete
    control over all resources owned by user,
●   MAC - provides control over interactions of
    software by defined policies and does not allow
    users to do anything that breaks these policies.
    Prevents compromised processes from
    affecting other processes and files
Mandatory Access Control


●   Subject performs actions on an object
●   Subject always a process
●   Object can be file, device,users,
    processes,sockets,x_cursor..
●   Action is a system function call, i.e
    permissions
How is MAC Implemented?


●   How is MAC implemented?
       ●   Security context given to objects and
            processes aka labeling for file system
       ●   A Security context just free format strings “label”
       ●   By policy file which contain rules about what
            domains/type enforcements subject and
            object must have to allow requested action.
            I.e provides meaning to security context
            strings. Policies limit what a daemon can
            access and how
SELinux Policy


●   Rules for how source context of subject
    evaluated against target security context of
    object
●   By default if not defined, then deny action.
    Difficult for general purpose computing. To
    improve use less restrictive policy provided,
SELinux Policy


●   Two policies packages –
        ●   Targeted – doesn't use users & roles, only
             restricts certain services, uses type
             enforcement only. Unaffected subjects and
             objects run in unconfined_t domain
        ●   Strict – deny all by default lots of tweaking
●   We will look at a policy file later
Objects Classes


●   Object classes (categories) – more then 70@
●   Object classes have set of permissions
    (actions)
            –   dir,
            –   socket
            –   tcp_socket
            –   filesystem
            –   node
            –   x_cursor
Object Class Permissions (Actions)


●   Each object class has its list of permissions or
    actions e.g. dir: (see slide on seinfo later)
       ●   getattr/setattr,
       ●   unlink
       ●   execute
       ●   read
       ●   search
       ●   rmdir
Security Context


●   Security Context or labels set of security
    attributes associated with a subject or an object
●   <user>:<role>:<type>
●   e.g system_u:object_r:httpd_exec_t
       ●   system_u – standard for system daemon
       ●   object_r standard for system objects such as
            devices and files
       ●   Targets policy – unrestricted_u, unrestricted_r
Security Context


●   User – individual or process, SELinux
    maintains own list of users. For subjects the
    user is the user the process is run as, for
    objects its the owner of the object,
●   Role – similar to group, but user can only have
    1 role at a time, can switch roles if authorised
    to do so
●   Type/Domain -Type used for files, domain
    used for processes. Manages access control
Security Context


●   Standard command come with add -Z option to
    see security context
       ●   ls -Z
       ●   ps -Z
       ●   netstat -Z
File Security Context


●   Most common SELinux problem – file labels
        ●   restorecon – restores defined context for a file
        ●   chcon -t $tye ${file|dir} name – temporary
        ●   semanage fcontext -a -t $type ${file|dir} name
●   /etc/selinux/targeted/contexts/files/files_contexts
Troubleshooting & Tools



●   /var/log/audit/audit.log
●   Create policy files from audit2allow
●   avc = access vector cache
SELinux Tools


●   setroubleshooter – can help with friendlier
    error messages and suggestions of how to fix
    the problem
●   “cat /var/log/audit/audit.log | sedispatch” → will
    send the error messages to setroubleshooter
    for lookup & formatting
SELinux Tools


●   Seinfo
       ●   List all classes “seinfo -c”
       ●   List all permissions for a class “seinfo -cdir -x”
                for dir premissions/actions
       ●   List all types with permissions “seinfo -txx -x”
       ●   List all users/roles with permissions “seinfo -{u|
             r}xx -x”
       ●   List all port context “seinfo --portcon”
SELinux - Booleans


●   Booleans
       ●   getsebool -a
       ●   semanage boolean -l
       ●   setsebool xxx on| off
       ●   setsebool -P xxx on|off
Manage Ports


●   semanage port -l
●   Add a port
       ●   semanage port -at [-p proto] port |port-range
●   Delete a port
       ●   semanage port -dt [-p proto] port|port-range
Writing SELinux Policy


●   The policy is compiled in user space
●   The m4 macro preprocessor is used prior to
    compilation (optional)
●   The initial policy binary is loaded by init at boot
●   Policy modules (binaries) can be loaded and
    unloaded at any time
Writing SELinux Policy


●   “cat /var/log/audit/audit.log | audit2allow -m
    mymod > mymod.te
●   checkmodule -M -m -o mymod.mod mymod.te
●   semodule package -o mymod.pp -m
    mymod.mod
●   semodule -i mymod.p
Questions?


●   Visit us at
              –   www.JumpingBean.co.za
              –   www.LinuxCertification.co.za

Mais conteúdo relacionado

Semelhante a SELinux Johannesburg Linux User Group (JoziJUg)

chroot and SELinux
chroot and SELinuxchroot and SELinux
chroot and SELinuxShay Cohen
 
MR201406 A Re-introduction to SELinux
MR201406 A Re-introduction to SELinuxMR201406 A Re-introduction to SELinux
MR201406 A Re-introduction to SELinuxFFRI, Inc.
 
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 InfrastructuresShawn Wells
 
Security Enhanced Linux Overview
Security Enhanced Linux OverviewSecurity Enhanced Linux Overview
Security Enhanced Linux OverviewEmre Can Kucukoglu
 
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: SELinuxShawn Wells
 
SELinux Kernel Internals and Architecture - FOSS.IN/2005
SELinux Kernel Internals and Architecture - FOSS.IN/2005SELinux Kernel Internals and Architecture - FOSS.IN/2005
SELinux Kernel Internals and Architecture - FOSS.IN/2005James Morris
 
Linux Kernel Security Overview - KCA 2009
Linux Kernel Security Overview - KCA 2009Linux Kernel Security Overview - KCA 2009
Linux Kernel Security Overview - KCA 2009James Morris
 
Protecting confidential files using SE-Linux
Protecting confidential files using SE-LinuxProtecting confidential files using SE-Linux
Protecting confidential files using SE-LinuxGiuseppe Paterno'
 
Understanding SELinux For the Win
Understanding SELinux For the WinUnderstanding SELinux For the Win
Understanding SELinux For the Winbmbouter
 
OperatingSystem.ppt
OperatingSystem.pptOperatingSystem.ppt
OperatingSystem.pptKaivanParikh
 
CISSP Week 22
CISSP Week 22CISSP Week 22
CISSP Week 22jemtallon
 
Securing Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container PlatformSecuring Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container PlatformAll Things Open
 
How to not disable SELinux
How to not disable SELinuxHow to not disable SELinux
How to not disable SELinuxRémy Gottschalk
 
SELinux_@gnu_group_meetup
SELinux_@gnu_group_meetupSELinux_@gnu_group_meetup
SELinux_@gnu_group_meetupJayant Chutke
 
selinuxbasicusage.pptx
selinuxbasicusage.pptxselinuxbasicusage.pptx
selinuxbasicusage.pptxPandiya Rajan
 

Semelhante a SELinux Johannesburg Linux User Group (JoziJUg) (20)

Selinux
SelinuxSelinux
Selinux
 
Se linux course1
Se linux course1Se linux course1
Se linux course1
 
chroot and SELinux
chroot and SELinuxchroot and SELinux
chroot and SELinux
 
MR201406 A Re-introduction to SELinux
MR201406 A Re-introduction to SELinuxMR201406 A Re-introduction to SELinux
MR201406 A Re-introduction to SELinux
 
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
 
Security Enhanced Linux Overview
Security Enhanced Linux OverviewSecurity Enhanced Linux Overview
Security Enhanced Linux Overview
 
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
 
SELinux Kernel Internals and Architecture - FOSS.IN/2005
SELinux Kernel Internals and Architecture - FOSS.IN/2005SELinux Kernel Internals and Architecture - FOSS.IN/2005
SELinux Kernel Internals and Architecture - FOSS.IN/2005
 
Linux Kernel Security Overview - KCA 2009
Linux Kernel Security Overview - KCA 2009Linux Kernel Security Overview - KCA 2009
Linux Kernel Security Overview - KCA 2009
 
Protecting confidential files using SE-Linux
Protecting confidential files using SE-LinuxProtecting confidential files using SE-Linux
Protecting confidential files using SE-Linux
 
Understanding SELinux For the Win
Understanding SELinux For the WinUnderstanding SELinux For the Win
Understanding SELinux For the Win
 
OperatingSystem.ppt
OperatingSystem.pptOperatingSystem.ppt
OperatingSystem.ppt
 
OperatingSystem.ppt
OperatingSystem.pptOperatingSystem.ppt
OperatingSystem.ppt
 
CISSP Week 22
CISSP Week 22CISSP Week 22
CISSP Week 22
 
Securing Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container PlatformSecuring Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container Platform
 
How to not disable SELinux
How to not disable SELinuxHow to not disable SELinux
How to not disable SELinux
 
SELinux_@gnu_group_meetup
SELinux_@gnu_group_meetupSELinux_@gnu_group_meetup
SELinux_@gnu_group_meetup
 
selinuxbasicusage.pptx
selinuxbasicusage.pptxselinuxbasicusage.pptx
selinuxbasicusage.pptx
 
Introduction To SELinux
Introduction To SELinuxIntroduction To SELinux
Introduction To SELinux
 
SE Linux
SE LinuxSE Linux
SE Linux
 

Mais de Jumping Bean

DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017Jumping Bean
 
Postgrtesql as a NoSQL Document Store - The JSON/JSONB data type
Postgrtesql as a NoSQL Document Store - The JSON/JSONB data typePostgrtesql as a NoSQL Document Store - The JSON/JSONB data type
Postgrtesql as a NoSQL Document Store - The JSON/JSONB data typeJumping Bean
 
React - The JavaScript Library for User Interfaces
React - The JavaScript Library for User InterfacesReact - The JavaScript Library for User Interfaces
React - The JavaScript Library for User InterfacesJumping Bean
 
HTML 5 & The Modern Web
HTML 5 & The Modern WebHTML 5 & The Modern Web
HTML 5 & The Modern WebJumping Bean
 
Building games-with-libgdx
Building games-with-libgdxBuilding games-with-libgdx
Building games-with-libgdxJumping Bean
 
Linux Containers & Docker
Linux Containers & DockerLinux Containers & Docker
Linux Containers & DockerJumping Bean
 
Introduction to Web Sockets
Introduction to Web SocketsIntroduction to Web Sockets
Introduction to Web SocketsJumping Bean
 
M-Learning application development with open source
M-Learning application development with open sourceM-Learning application development with open source
M-Learning application development with open sourceJumping Bean
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJSJumping Bean
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android DevelopmentJumping Bean
 
Glassfish An Introduction
Glassfish An IntroductionGlassfish An Introduction
Glassfish An IntroductionJumping Bean
 
IPv6 - Jozi Linux User Group Presentation
IPv6  - Jozi Linux User Group PresentationIPv6  - Jozi Linux User Group Presentation
IPv6 - Jozi Linux User Group PresentationJumping Bean
 

Mais de Jumping Bean (13)

DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
 
Postgrtesql as a NoSQL Document Store - The JSON/JSONB data type
Postgrtesql as a NoSQL Document Store - The JSON/JSONB data typePostgrtesql as a NoSQL Document Store - The JSON/JSONB data type
Postgrtesql as a NoSQL Document Store - The JSON/JSONB data type
 
React - The JavaScript Library for User Interfaces
React - The JavaScript Library for User InterfacesReact - The JavaScript Library for User Interfaces
React - The JavaScript Library for User Interfaces
 
HTML 5 & The Modern Web
HTML 5 & The Modern WebHTML 5 & The Modern Web
HTML 5 & The Modern Web
 
Building games-with-libgdx
Building games-with-libgdxBuilding games-with-libgdx
Building games-with-libgdx
 
Linux Containers & Docker
Linux Containers & DockerLinux Containers & Docker
Linux Containers & Docker
 
Introduction to Web Sockets
Introduction to Web SocketsIntroduction to Web Sockets
Introduction to Web Sockets
 
M-Learning application development with open source
M-Learning application development with open sourceM-Learning application development with open source
M-Learning application development with open source
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Glassfish An Introduction
Glassfish An IntroductionGlassfish An Introduction
Glassfish An Introduction
 
Java logging
Java loggingJava logging
Java logging
 
IPv6 - Jozi Linux User Group Presentation
IPv6  - Jozi Linux User Group PresentationIPv6  - Jozi Linux User Group Presentation
IPv6 - Jozi Linux User Group Presentation
 

Último

Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 

SELinux Johannesburg Linux User Group (JoziJUg)

  • 1. Jozi LUG - SELinux Introduction to Security Enhanced Linux 26th March 2012 Sponsored by LPI South Africa
  • 2. Topics ● What is SELinux? ● Computer Security Models ● Mandatory Access Control & Discretionary Access Control ● SELinux Policy ● Object Classes and actions/permissions
  • 3. Topics ● Security Context ● File Security Context ● Troubleshooting & Tools ● SELinux Booleans ● SELinux Managing Ports ● SELinux Writing Policy
  • 4. What is SELinux ● A mechanism for supporting mandatory access control (mac),role based access control (rbac) & multi-level security (msl/mcs) ● Implemented as a Linux Security Module(LSM) ● LSM allows kernel to support different security models used by: ● AppArmor,Smack,SELinux
  • 5. Computer Security Models ● Three security models possible with SELinux ● MLS/MCS – multilevel security, multi category security. Mainly about file access. Every subject must have clearance level and also every file (not covered) Top Secret, Secret, Confidential and Unclassified ● RBAC – role base access control, how users transition between roles and domains to which roles have rights, roles aggregate permissions
  • 6. Computer Security Models ● Mandatory Access Control via Type Enforcement – First step before MLS/MCS. Good for daemons, services ● This presentations focuses on MAC via TE in SELinux. Although other security models can be used they are too restrictive for most situation there limited TE used. MAC mainly useful for daemons and processes not users
  • 7. Mandatory Access Control Definition ● Mandatory Access Control (MAC) – security policy sets access controls and cannot be changed by system users or processes, ● Discretionary Access Control (DAC) – underlying unix permissions can be changed at the discretion of the file owner
  • 8. Mandatory/Discretionary Access Control ● DAC makes system vulnerable, users can change permissions and no protection from broken software, i.e. process has complete control over all resources owned by user, ● MAC - provides control over interactions of software by defined policies and does not allow users to do anything that breaks these policies. Prevents compromised processes from affecting other processes and files
  • 9. Mandatory Access Control ● Subject performs actions on an object ● Subject always a process ● Object can be file, device,users, processes,sockets,x_cursor.. ● Action is a system function call, i.e permissions
  • 10. How is MAC Implemented? ● How is MAC implemented? ● Security context given to objects and processes aka labeling for file system ● A Security context just free format strings “label” ● By policy file which contain rules about what domains/type enforcements subject and object must have to allow requested action. I.e provides meaning to security context strings. Policies limit what a daemon can access and how
  • 11. SELinux Policy ● Rules for how source context of subject evaluated against target security context of object ● By default if not defined, then deny action. Difficult for general purpose computing. To improve use less restrictive policy provided,
  • 12. SELinux Policy ● Two policies packages – ● Targeted – doesn't use users & roles, only restricts certain services, uses type enforcement only. Unaffected subjects and objects run in unconfined_t domain ● Strict – deny all by default lots of tweaking ● We will look at a policy file later
  • 13. Objects Classes ● Object classes (categories) – more then 70@ ● Object classes have set of permissions (actions) – dir, – socket – tcp_socket – filesystem – node – x_cursor
  • 14. Object Class Permissions (Actions) ● Each object class has its list of permissions or actions e.g. dir: (see slide on seinfo later) ● getattr/setattr, ● unlink ● execute ● read ● search ● rmdir
  • 15. Security Context ● Security Context or labels set of security attributes associated with a subject or an object ● <user>:<role>:<type> ● e.g system_u:object_r:httpd_exec_t ● system_u – standard for system daemon ● object_r standard for system objects such as devices and files ● Targets policy – unrestricted_u, unrestricted_r
  • 16. Security Context ● User – individual or process, SELinux maintains own list of users. For subjects the user is the user the process is run as, for objects its the owner of the object, ● Role – similar to group, but user can only have 1 role at a time, can switch roles if authorised to do so ● Type/Domain -Type used for files, domain used for processes. Manages access control
  • 17. Security Context ● Standard command come with add -Z option to see security context ● ls -Z ● ps -Z ● netstat -Z
  • 18. File Security Context ● Most common SELinux problem – file labels ● restorecon – restores defined context for a file ● chcon -t $tye ${file|dir} name – temporary ● semanage fcontext -a -t $type ${file|dir} name ● /etc/selinux/targeted/contexts/files/files_contexts
  • 19. Troubleshooting & Tools ● /var/log/audit/audit.log ● Create policy files from audit2allow ● avc = access vector cache
  • 20. SELinux Tools ● setroubleshooter – can help with friendlier error messages and suggestions of how to fix the problem ● “cat /var/log/audit/audit.log | sedispatch” → will send the error messages to setroubleshooter for lookup & formatting
  • 21. SELinux Tools ● Seinfo ● List all classes “seinfo -c” ● List all permissions for a class “seinfo -cdir -x” for dir premissions/actions ● List all types with permissions “seinfo -txx -x” ● List all users/roles with permissions “seinfo -{u| r}xx -x” ● List all port context “seinfo --portcon”
  • 22. SELinux - Booleans ● Booleans ● getsebool -a ● semanage boolean -l ● setsebool xxx on| off ● setsebool -P xxx on|off
  • 23. Manage Ports ● semanage port -l ● Add a port ● semanage port -at [-p proto] port |port-range ● Delete a port ● semanage port -dt [-p proto] port|port-range
  • 24. Writing SELinux Policy ● The policy is compiled in user space ● The m4 macro preprocessor is used prior to compilation (optional) ● The initial policy binary is loaded by init at boot ● Policy modules (binaries) can be loaded and unloaded at any time
  • 25. Writing SELinux Policy ● “cat /var/log/audit/audit.log | audit2allow -m mymod > mymod.te ● checkmodule -M -m -o mymod.mod mymod.te ● semodule package -o mymod.pp -m mymod.mod ● semodule -i mymod.p
  • 26. Questions? ● Visit us at – www.JumpingBean.co.za – www.LinuxCertification.co.za