Zum Inhalt springen

Seminar/Linux/SELinux: Unterschied zwischen den Versionen

Aus Foxwiki
K Dirkwagner verschob die Seite Seminar/Linux/Linux/SELinux nach Seminar/Linux/SELinux, ohne dabei eine Weiterleitung anzulegen: Textersetzung - „Linux/Linux/“ durch „Linux/“
Keine Bearbeitungszusammenfassung
Zeile 3: Zeile 3:
! Kapitel !! Thema !! Gewichtung
! Kapitel !! Thema !! Gewichtung
|-
|-
| 01 || [[SELinux/Grundlagen|Einführung]] || 1  
| 01 || [[Linux/SELinux/Grundlagen|Einführung]] || 1  
|-
|-
| 02 || [[SELinux/Dateien|Security Context auf Dateien und Verzeichnissen]] || 1
| 02 || [[Linux/SELinux/Dateien|Security Context auf Dateien und Verzeichnissen]] || 1
|-
|-
| 03 || [[SELinux/Extended File Attributes|Extended File Attributes]] || 1
| 03 || [[Linux/SELinux/Extended File Attributes|Extended File Attributes]] || 1
|-
|-
| 04 || [[SELinux/Security Context|Security Context]] || 1
| 04 || [[Linux/SELinux/Security Context|Security Context]] || 1
|-
|-
| 05 || [[SELinux/File Context|File Context]] || 1
| 05 || [[Linux/SELinux/File Context|File Context]] || 1
|-
|-
| 06 || [[SELinux/Context Expressions|Context Expressions]] || 1
| 06 || [[Linux/SELinux/Context Expressions|Context Expressions]] || 1
|-
|-
| 07 || [[SELinux/Security Context von Datei|Security Context von Datei]] || 1
| 07 || [[Linux/SELinux/Security Context von Datei|Security Context von Datei]] || 1
|-
|-
| 08 || [[SELinux/Named File Transitions Rules|Named File Transitions Rules]] || 1
| 08 || [[Linux/SELinux/Named File Transitions Rules|Named File Transitions Rules]] || 1
|-
|-
| 09 || [[SELinux/Systemd und Temporäre Verzeichnisse|Systemd und Temporäre Verzeichnisse]] || 1
| 09 || [[Linux/SELinux/Systemd und Temporäre Verzeichnisse|Systemd und Temporäre Verzeichnisse]] || 1
|-
|-
| 10 || [[SELinux/strace context printing|strace context printing]] || 1
| 10 || [[Linux/SELinux/strace context printing|strace context printing]] || 1
|-
|-
| 11 || [[SELinux/Benutzer Login|Benutzer Login]] || 1
| 11 || [[Linux/SELinux/Benutzer Login|Benutzer Login]] || 1
|-
|-
| 12 || [[SELinux/Kategorien|Kategorien]] || 1
| 12 || [[Linux/SELinux/Kategorien|Kategorien]] || 1
|-
|-
| 13 || [[SELinux/Rollen|Rollen]] || 1
| 13 || [[Linux/SELinux/Rollen|Rollen]] || 1
|-
|-
| 14 || [[SELinux/Pluggable Authentication Modules|PAM]] || 1
| 14 || [[Linux/SELinux/Pluggable Authentication Modules|PAM]] || 1
|-
|-
| 15 || [[SELinux/Prozess Context|Prozess Context]] || 1
| 15 || [[Linux/SELinux/Prozess Context|Prozess Context]] || 1
|-
|-
| 16 || [[SELinux/Ansible|SELinux und Ansible]] || 1
| 16 || [[Linux/SELinux/Ansible|SELinux und Ansible]] || 1
|-
|-
| 17 || [[SELinux/Salt|SELinux und Salt]] || 1
| 17 || [[Linux/SELinux/Salt|SELinux und Salt]] || 1
|-
|-
| 18 || [[SELinux/Container|SELinux und Container]] || 1
| 18 || [[Linux/SELinux/Container|SELinux und Container]] || 1
|}
|}


Zeile 116: Zeile 116:
; Block 1. Grundlagen und Kontextmodell
; Block 1. Grundlagen und Kontextmodell


* 01 - [[SELinux/Grundlagen|Einführung]]
* 01 - [[Linux/SELinux/Grundlagen|Einführung]]
:* Nutzen und typische Einsatzszenarien
:* Nutzen und typische Einsatzszenarien
:* Grundprinzipien von SELinux
:* Grundprinzipien von SELinux


* 02 - [[SELinux/Security Context|Security Context]]
* 02 - [[Linux/SELinux/Security Context|Security Context]]
:* Aufbau des Security Context
:* Aufbau des Security Context
:* SELinux User, Role, Type und Level
:* SELinux User, Role, Type und Level
Zeile 126: Zeile 126:


; Block 2. Dateien, Verzeichnisse und Kontextspeicherung
; Block 2. Dateien, Verzeichnisse und Kontextspeicherung
* 03 - [[SELinux/Dateien|Security Context auf Dateien und Verzeichnissen]]
* 03 - [[Linux/SELinux/Dateien|Security Context auf Dateien und Verzeichnissen]]
:* Context auf Dateien, Verzeichnissen und Symlinks
:* Context auf Dateien, Verzeichnissen und Symlinks
:* Unterschiede bei Objektklassen
:* Unterschiede bei Objektklassen


* 04 - [[SELinux/Extended File Attributes|Extended File Attributes]]
* 04 - [[Linux/SELinux/Extended File Attributes|Extended File Attributes]]
:* Speicherung von Labels in xattr
:* Speicherung von Labels in xattr
:* Namespaces und Werkzeuge
:* Namespaces und Werkzeuge


* 05 - [[SELinux/Security Context von Datei|Security Context von Datei]]
* 05 - [[Linux/SELinux/Security Context von Datei|Security Context von Datei]]
:* Kontext eines konkreten Objekts prüfen
:* Kontext eines konkreten Objekts prüfen
:* Zusammenhang zwischen Objekt und Label
:* Zusammenhang zwischen Objekt und Label


* 06 - [[SELinux/strace context printing|strace context printing]]
* 06 - [[Linux/SELinux/strace context printing|strace context printing]]
:* Relevante Syscalls
:* Relevante Syscalls
:* Sicht auf Context-Zugriffe im Laufzeitverhalten
:* Sicht auf Context-Zugriffe im Laufzeitverhalten
Zeile 147: Zeile 147:
;
;
; Block 1. File Context Regeln und Ausdrücke
; Block 1. File Context Regeln und Ausdrücke
* 07 - [[SELinux/File Context|File Context]]
* 07 - [[Linux/SELinux/File Context|File Context]]
:* Unterschied zwischen Label und File-Context-Regel
:* Unterschied zwischen Label und File-Context-Regel
:* Standardzuweisung und persistente Regeln
:* Standardzuweisung und persistente Regeln
* 08 - [[SELinux/Context Expressions|Context Expressions]]
* 08 - [[Linux/SELinux/Context Expressions|Context Expressions]]
:* Regex-basierte Regeln
:* Regex-basierte Regeln
:* Auswertung und Priorität
:* Auswertung und Priorität
* 09 - [[SELinux/Named File Transitions Rules|Named File Transitions Rules]]
* 09 - [[Linux/SELinux/Named File Transitions Rules|Named File Transitions Rules]]
:* Benannte Übergangsregeln
:* Benannte Übergangsregeln
:* Context-Vergabe bei der Objekterzeugung
:* Context-Vergabe bei der Objekterzeugung


; Block 2. Verwaltung, Reparatur und temporäre Verzeichnisse
; Block 2. Verwaltung, Reparatur und temporäre Verzeichnisse
* 10 - [[SELinux/Systemd und Temporäre Verzeichnisse|Systemd und Temporäre Verzeichnisse]]
* 10 - [[Linux/SELinux/Systemd und Temporäre Verzeichnisse|Systemd und Temporäre Verzeichnisse]]
:* Context-Vorgaben mit ''systemd-tmpfiles''
:* Context-Vorgaben mit ''systemd-tmpfiles''
:* Temporäre Verzeichnisse und Laufzeitobjekte
:* Temporäre Verzeichnisse und Laufzeitobjekte
Zeile 168: Zeile 168:
;
;
; Block 1: Benutzer, Rollen und Anmeldung
; Block 1: Benutzer, Rollen und Anmeldung
* 11 - [[SELinux/Benutzer Login|Benutzer Login]]
* 11 - [[Linux/SELinux/Benutzer Login|Benutzer Login]]
:* Login-Kontext
:* Login-Kontext
:* Zuordnung Linux User zu SELinux User
:* Zuordnung Linux User zu SELinux User
* 12 - [[SELinux/Kategorien|Kategorien]]
* 12 - [[Linux/SELinux/Kategorien|Kategorien]]
:* MCS-Kategorien
:* MCS-Kategorien
:* Bereichs- und Kategoriezuordnung
:* Bereichs- und Kategoriezuordnung
* 13 - [[SELinux/Rollen|Rollen]]
* 13 - [[Linux/SELinux/Rollen|Rollen]]
:* Rollenmodell
:* Rollenmodell
:* Rollenwechsel und Rechteabgrenzung
:* Rollenwechsel und Rechteabgrenzung
* 14 - [[SELinux/Pluggable Authentication Modules|PAM]]
* 14 - [[Linux/SELinux/Pluggable Authentication Modules|PAM]]
:* ''pam_selinux''
:* ''pam_selinux''
:* ''pam_sepermit''
:* ''pam_sepermit''
Zeile 183: Zeile 183:


; Block 2. Prozesse, Automatisierung und Container
; Block 2. Prozesse, Automatisierung und Container
* 15 - [[SELinux/Prozess Context|Prozess Context]]
* 15 - [[Linux/SELinux/Prozess Context|Prozess Context]]
:* Prozess-Context und Domains
:* Prozess-Context und Domains
:* Domain Transitions
:* Domain Transitions
:* Laufzeitverhalten und Schutzmechanismen
:* Laufzeitverhalten und Schutzmechanismen


* 16 - [[SELinux/Ansible|SELinux und Ansible]]
* 16 - [[Linux/SELinux/Ansible|SELinux und Ansible]]
:* Native Module
:* Native Module
:* Verteilen von SELinux-Konfiguration
:* Verteilen von SELinux-Konfiguration


* 17 - [[SELinux/Salt|SELinux und Salt]]
* 17 - [[Linux/SELinux/Salt|SELinux und Salt]]
:* Native Module
:* Native Module
:* Verteilen von SELinux-Konfiguration
:* Verteilen von SELinux-Konfiguration


* 18 - [[SELinux/Container|SELinux und Container]]
* 18 - [[Linux/SELinux/Container|SELinux und Container]]
:* Podman, MCS und Volumes
:* Podman, MCS und Volumes
:* Eigene Container-Policy mit ''udica''
:* Eigene Container-Policy mit ''udica''

Version vom 27. März 2026, 10:22 Uhr

Inhalte

Kapitel Thema Gewichtung
01 Einführung 1
02 Security Context auf Dateien und Verzeichnissen 1
03 Extended File Attributes 1
04 Security Context 1
05 File Context 1
06 Context Expressions 1
07 Security Context von Datei 1
08 Named File Transitions Rules 1
09 Systemd und Temporäre Verzeichnisse 1
10 strace context printing 1
11 Benutzer Login 1
12 Kategorien 1
13 Rollen 1
14 PAM 1
15 Prozess Context 1
16 SELinux und Ansible 1
17 SELinux und Salt 1
18 SELinux und Container 1

Seminartage

Tag 1

Grundlagen

Grundlagen & Security Context

Ziel

Verstehen, wie SELinux funktioniert und wie Kontexte aufgebaut sind

Ergebnis

Aufbau von SELinux-Kontexten verstehen , lesen und interpretieren

Inhalte

  • Einführung in SELinux – Nutzen und typische Einsatzszenarien
  • Security Context auf Dateien und Verzeichnissen
  • Interpretation des SELinux Context Types
  • Extended (File) Attributes (xattr) – Namespaces, Verwaltung mit getfattr/setfattr
  • Syscall-Analyse mit strace (stat, fstat, getxattr, …)
  • Standardverhalten bei mv und cp
  • Einfluss von restorecond auf Labels
  • SELinux Optionen bei mv, cp, mkdir, tar, rsync

Tag 2

Context und Policies

File Context Verwaltung & Security Context Policies

Ziel

Kontexte gezielt setzen, verwalten und reparieren

Ergebnis

File Contexts korrekt setzen, Policies anpassen und fehlerhafte Labels systematisch reparieren.

Inhalte

  • Context setzen mit chcon, semanage, setfiles, fixfiles
  • File Context Regeln – Aufbau, Regex, Prioritätsregeln
  • Context Expressions und matchpathcon
  • Reparieren von falsch gesetzten Labels mit restorecon (inkl. SHA256 digests)
  • Äquivalenzregeln definieren
  • Named File Transition Rules
  • Mount-Optionen für SELinux (context=, defcontext=, fscontext=, rootcontext=)
  • Systemd und temporäre Verzeichnisse – Context via systemd-tmpfiles
  • Lokale Änderungen exportieren/importieren mit semanage

Tag 3

Benutzer, Rollen, Container und Automatisierung

Ziel

SELinux in realen Betriebsumgebungen professionell einsetzen

Ergebnis

Inhalte

  • SELinux User & Role Mapping im Detail
  • Linux User - SELinux User Zuordnung
  • Erstellen eigener SELinux User
  • Arbeiten mit SELinux Roles (newrole, sudo, runcon)
  • Verwalten von MCS Categories (chcat, setrans, mcstransd)
  • Pluggable Authentication Modules (PAM): pam_selinux, pam_sepermit, pam_namespace
  • Prozess Context, Domain Transitions, Memory Protection, NNP
  • SELinux & Ansible – native Module, Custom Policy verteilen
  • SELinux & Salt – native Module, Custom Policy verteilen
  • SELinux & Container – Podman, MCS, Volumes, udica
  • Eigene Container Policy mit udica erstellen

Blocks

Tag 1

Grundlagen, Security Context und Dateikontexte

Block 1. Grundlagen und Kontextmodell
  • Nutzen und typische Einsatzszenarien
  • Grundprinzipien von SELinux
  • Aufbau des Security Context
  • SELinux User, Role, Type und Level
  • Lesen und Interpretieren von Context-Komponenten
Block 2. Dateien, Verzeichnisse und Kontextspeicherung
  • Context auf Dateien, Verzeichnissen und Symlinks
  • Unterschiede bei Objektklassen
  • Speicherung von Labels in xattr
  • Namespaces und Werkzeuge
  • Kontext eines konkreten Objekts prüfen
  • Zusammenhang zwischen Objekt und Label
  • Relevante Syscalls
  • Sicht auf Context-Zugriffe im Laufzeitverhalten

Tag 2

File Contexts, Regeln und Label-Management

Block 1. File Context Regeln und Ausdrücke
  • Unterschied zwischen Label und File-Context-Regel
  • Standardzuweisung und persistente Regeln
  • Regex-basierte Regeln
  • Auswertung und Priorität
  • Benannte Übergangsregeln
  • Context-Vergabe bei der Objekterzeugung
Block 2. Verwaltung, Reparatur und temporäre Verzeichnisse
  • Context-Vorgaben mit systemd-tmpfiles
  • Temporäre Verzeichnisse und Laufzeitobjekte
  • Zusammenhang mit persistenter Label-Verwaltung

Tag 3

Benutzer, Rollen, Laufzeitverhalten und Integration

Block 1
Benutzer, Rollen und Anmeldung
  • Login-Kontext
  • Zuordnung Linux User zu SELinux User
  • MCS-Kategorien
  • Bereichs- und Kategoriezuordnung
  • Rollenmodell
  • Rollenwechsel und Rechteabgrenzung
  • pam_selinux
  • pam_sepermit
  • pam_namespace
Block 2. Prozesse, Automatisierung und Container
  • Prozess-Context und Domains
  • Domain Transitions
  • Laufzeitverhalten und Schutzmechanismen
  • Native Module
  • Verteilen von SELinux-Konfiguration
  • Native Module
  • Verteilen von SELinux-Konfiguration
  • Podman, MCS und Volumes
  • Eigene Container-Policy mit udica