Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
D6 AppArmor Profile für Daemons
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Deutsche Dokumentation
View previous topic :: View next topic  
Author Message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4148
Location: Bavaria

PostPosted: Sat Nov 28, 2020 9:53 pm    Post subject: D6 AppArmor Profile für Daemons Reply with quote

(Dieser Post ist Teil einer Installation-Anleitung. Falls nicht schon geschehen lies bitte: Installation Guide for Paranoid Dummies Post Nr. 3)



D.6 AppArmor Profile für Daemons


Ich biete Dir hier kein Profil für den "sshd". Ich habe nicht einmal versucht diesen mit einem AA-Profil zu sichern, weil ich der Meinung bin, dass ein laufender SSHD anderweitig gesichert werden muss: Entweder erlaubst Du (mittels Deiner FireWall) nur Zugang von vertrauenswürdigen Admin-Stations von Deinem lokalen Netzwerk und blockst jeglichen Versuch von anderen Netzen, ODER falls Du wirklich aus dem Internet auf den sshd gehen willst, dann mach das NUR über eine VPN-Leitung ! Alles andere ist für mich Harakiri.


  • Profile: /etc/apparmor.d/usr.sbin.privoxy
  • Beschreibung/Bemerkung: Wie Du siehst ist der Privoxy ein ganz ein braver :-) Die Capabilites braucht er damit er den root abgeben kann um dann als User privoxy zu laufen.

Code:
# version 1

abi <kernel>,

profile privoxy /usr/sbin/privoxy
{
include <local/ONLYNETWORK>
capability setgid,
capability setuid,
/run/privoxy.pid  rw,
/var/log/privoxy/privoxy.log  rw,
}


  • Profile: /etc/apparmor.d/sbin.dhcpcd
  • Beschreibung/Bemerkung: Ich bin der Meinung dass dynamische IP-Adresszuweisung nur von Unternehmen mit großen Client-Netzen benötigt wird und für einen privaten Anwender statische IP-Adressen sinnvoller und einfacher zu handeln sind. Ich konnte dieses Profil daher nur rudimentär prüfen. Dabei ist mir aufgefallen, dass der dhcpcd in der Lage ist meine FW zu umgehen ... Ich mag ihn nicht ...

Code:
# version 1

abi <kernel>,

profile dhcpcd /sbin/dhcpcd
{
include <local/ONLYNETWORK>
include <local/USECONSOLE>
/bin/hostname  ix,
/bin/rm  ix,
/bin/sed  ix,
/lib/dhcpcd/**  rix,
/usr/bin/cmp  ix,
capability dac_override,
capability net_admin,
capability net_bind_service,
capability net_raw,
/etc/resolv.conf  rw,
/run/dhcpcd.pid  krw,
/run/dhcpcd.sock  krw,
/run/dhcpcd.unpriv.sock  rw,
/run/dhcpcd/**  rw,
/var/lib/dhcpcd/*  rw,
}


  • Profile: /etc/apparmor.d/usr.sbin.ntpdate
  • Beschreibung/Bemerkung: Ich habe überlegt ob er hier oder eigentlich nach D.7 gehört. Weil er aber von /etc/init.d/ntp-client gestartet wird, habe ich ihn hier rein.

Code:
# version 1

abi <kernel>,

profile ntpdate /usr/sbin/ntpdate
{
include <local/ONLYNETWORK>
capability sys_time,
capability sys_nice,
}


Du bist herzlich eingeladen diesen Thread mit Deinen Profilen zu erweitern.

.


Last edited by pietinger on Mon Nov 30, 2020 9:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4148
Location: Bavaria

PostPosted: Mon Nov 30, 2020 8:51 pm    Post subject: Reply with quote

Dieses Profil ist vermutlich veraltet ! (Da ich kein Update auf die neue Version des ddclient gemacht habe, konnte ich es nicht anpassen.)

  • Profile: /etc/apparmor.d/usr.bin.ddclient
  • Beschreibung/Bemerkung: Jo, mei, der ddclient halt aus /etc/init.d/ddclient.

Code:
# version 1

abi <kernel>,

profile ddclient /usr/bin/ddclient
{
include <local/ONLYNETWORK>
/usr/bin/ddclient  r,
/run/ddclient/ddclient.pid  rwk,
/var/cache/ddclient/**  rw,
}


.


Last edited by pietinger on Tue Apr 18, 2023 11:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4148
Location: Bavaria

PostPosted: Sun Dec 13, 2020 12:36 am    Post subject: Reply with quote

  • Profile: /etc/apparmor.d/usr.sbin.unbound
  • Beschreibung/Bemerkung: Der DNS-Server unbound mit einer Konfiguration wie in B.6 beschrieben.

Code:
# version 1

abi <kernel>,

profile unbound /usr/sbin/unbound
{
include <local/ONLYNETWORK>
capability net_bind_service,
capability setgid,
capability setuid,
capability sys_chroot,
capability sys_resource,
/run/unbound.pid  rw,
}


.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4148
Location: Bavaria

PostPosted: Mon Apr 03, 2023 3:44 pm    Post subject: Reply with quote

  • Profile: /etc/apparmor.d/usr.sbin.chronyd
  • Beschreibung/Bemerkung: Der NTP-Client/-Server chrony mit einer Konfiguration wie im 5. Post von A.3 beschrieben.

Code:
# version 1

abi <kernel>,

profile chronyd /usr/sbin/chronyd
{
include <local/ONLYNETWORK>
capability sys_time,
capability sys_nice,
capability dac_read_search,
capability dac_override,
capability net_bind_service,
capability setgid,
capability setuid,
/run/chrony/*  rwk,
/var/lib/chrony/*  rwk,
}


.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4148
Location: Bavaria

PostPosted: Wed Apr 03, 2024 1:53 pm    Post subject: Achtung Umstellung auf merged-usr Reply with quote

Achtung: Umstellung auf merged-usr

... sorgt für eine böse Überraschung: Einige Profile wurden nicht mehr geladen ... weil ... der Pfad nicht mehr stimmt !

Betroffen sind alle Profile die früher in /usr/sbin/... waren. Leider ist das nach einer Umstellung von split-usr auf merged-usr nicht mehr der Fall, weil /usr/sbin nur noch ein Link auf /usr/bin ist. Wir haben ja in D.4 gelernt dass AppArmor solche Links nicht beachtet ...

Ich musste daher in drei meiner eingesetzten Profilen den Aufruf ändern (das ist die dritte Zeile im jeweiligen Profil):
Code:
profile chronyd /usr/bin/chronyd

profile privoxy /usr/bin/privoxy

profile unbound /usr/bin/unbound

Natürlich habe ich dann den Namen des Profils auch noch geändert obwohl dies nicht zwingend nötig wäre; es soll aber alles seine gute Ordnung haben:
Code:
# lal
...
drwx------  2 root root 4096  7. Mai 2023  local
...
-rw-r--r--  1 root root  299  3. Apr 15:39 usr.bin.chronyd
...
-rw-r--r--  1 root root  187  3. Apr 15:40 usr.bin.privoxy
...
-rw-r--r--  1 root root  230  3. Apr 15:40 usr.bin.unbound

_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Deutsche Dokumentation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum