Ich möchte Firefox mit dem Apparmor-Profil aa-enforce(d) ausführen. Das funktioniert gut, außer dass ich ein Plugin habe, das über dbus auf den Schlüsselbund zugreifen muss. Wenn das Plugin (https://github.com/swick/moz-gnome-keyring-integration) versucht, auf den Schlüsselbund zuzugreifen, erhalte ich diese Meldung in den Protokollen:
[ apparmor="DENIED" operation="dbus_method_call" bus="session" path="/org/freedesktop/secrets" interface="org.freedesktop.DBus.Properties" member="Get" mask="send" name="org.freedesktop.secrets" pid=20004 profile="/usr/lib/firefox/firefox{,*[^s][^h]}" peer_pid=2810 peer_profile="unconfined"]
Ich versuche alsoDbus-Zugriff gewährenzu meinem Firefox-Profil, ohne das Basisprofil zu ändern, das vom Apparmor-Profiles-Paket bereitgestellt wird. Daher habe ich die Datei in geändert /etc/apparamor.d/local/usr.bin.firefox
.
Folgendes habe ich versucht:
# Site-specific additions and overrides for usr.bin.firefox.
# For more details, please see /etc/apparmor.d/local/README.
# Allow gnome keyring integration to work
/usr/lib/firefox/firefox{,*[^s][^h]} {
dbus (send,receive)
bus=session
interface=org.freedesktop.DBus.Properties
path=/org/freedesktop/secrets,
}
aber dann erhalte ich bei aa-enforce usr.bin.firefox diesen Fehler:
apparmor.common.AppArmorException: 'local/usr.bin.firefox profile in local/usr.bin.firefox contains syntax errors in line: 4.'
Dies ist das erste Mal, dass ich versuche, ein Apparmor-Profil zu erstellen oder zu ändern, und ich stecke hier fest ... Wie muss die Syntax aussehen?
BEARBEITEN: Mithilfe von apparmor_parser habe ich noch weitere Informationen erhalten:
AppArmor parser error for /etc/apparmor.d/usr.bin.firefox in /etc/apparmor.d/local/usr.bin.firefox at line 4: syntax error, unexpected TOK_OPEN, expecting TOK_MODE
Also, unerwartetes TOK_OPEN, erwartetes TOK_MODE … noch keine Ahnung, was das bedeutet.
EDIT2: Ich habe die gleiche Strophe direkt im Profil /etc/apparmor.d/usr.bin.firefox ausprobiert und es funktioniert. Das Problem hat also mit der Verwendung der lokalen Anpassung zu tun ...
Antwort1
Das Problem entsteht durch die öffnenden Klammern ( {
und }
). Die #include
Anweisung befindet sich bereits in der Deklaration des Hauptprofils, daher sind die Klammern nicht erforderlich.
# Site-specific additions and overrides for usr.bin.firefox.
# For more details, please see /etc/apparmor.d/local/README.
# Allow gnome keyring integration to work
dbus (send,receive)
bus=session
interface=org.freedesktop.DBus.Properties
path=/org/freedesktop/secrets,