Commit graph

18 commits

Author SHA1 Message Date
John Johansen
cc869c901e aa-notify: don't load policy includes
aa-notify does not need to load the policy includes for its current
features, so drop the unneeded overhead.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-05-19 02:47:21 -07:00
Christian Boltz
e246568819
fix whitespace and indentation in several files 2019-08-12 23:58:04 +02:00
Otto Kekäläinen
81d514d89a aa-notify: Always use aa.CONFDIR, don't assume "/etc/apparmor"
Also fix cosmetic comment.
2019-05-03 17:53:24 +03:00
Otto Kekäläinen
d4cab56ac7 aa-notify: Use fixed output width in tests so results always look same 2019-04-21 18:37:10 +03:00
Otto Kekäläinen
a74d7cf51c Re-implement aa-notify in Python (Closes: #16)
- Code layout based on aa-genprof example
- Extend Python dependencies to cover new need by aa-notify
- Update documentation after aa-notify is no longer in Perl
2019-04-21 18:37:10 +03:00
nl6720
1fb9acc59e aa-notify: Read user's configuration file from XDG_CONFIG_HOME
Legacy path ~/.apparmor/notify.conf is preferred if it exists, otherwise
$XDG_CONFIG_HOME/apparmor/notify.conf, with fallback to
~/.config/apparmor/notify.conf, is used.

Signed-off-by: nl6720 <nl6720@gmail.com>
2018-10-03 12:38:28 +03:00
Christian Boltz
44ee1d5090
make message about notify-send package cross-distro compatible
References: https://bugzilla.opensuse.org/show_bug.cgi?id=1100779
2018-07-12 22:00:41 +02:00
Nicolas Videla
86db2263b8 Adding custom notification on AppArmor. 2018-02-26 14:34:58 +11:00
Christian Boltz
cb5cdf2656
set DBUS_SESSION_BUS_ADDRESS, needed by notify-send
This is needed by new versions of notify-send, as found on openSUSE
Tumbleweed. Without this, desktop notifications don't work anymore, and
notify-send starts to eat up CPU.

If DBUS_SESSION_BUS_ADDRESS is already set, it won't be changed.
2018-01-18 10:57:50 +01:00
Jamie Strandboge
766f5e160e aa-notify currently calls notify-send with urgency of 'critical'. In gnome-shell
critical urgency notifications result in a notification that must be explictly
clicked to dismiss (ie, they don't time out) and gnome-shell does not honor --
expire-time with (at least) critical urgency. In other popular DEs critical
urgency notifications time out. This patch updates the urgency to 'normal' to
obtain intended behavior across DEs.

Signed-off-by: Jamie Strandboge <jamie@canonical.com>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2017-04-12 15:57:31 -05:00
Christian Boltz
606c753501 aa-notify: also display notifications for complain mode events
Change aa-notify parse_message() to also honor complain mode log events.
This affects both modes - desktop notifications and the summary report.


Acked-by: Steve Beattie <steve@nxnw.org>
2015-04-29 01:03:17 +02:00
Christian Boltz
986093cf8d More helpful error message for "aa-notify -p" if a user is not member of
the group configured in notify.conf / use_group=...

Acked-by: John Johansen <john.johansen@canonical.com>
2011-10-20 00:20:02 +02:00
Christian Boltz
8b671f013a add the option --display to set the $DISPLAY environment variable in aa-notify.
If $DISPLAY is not set and --display is not used, aa-notify prints a 
warning that notifications won't be shown (exact warning text depends if 
using sudo or not).

Acked-by: John Johansen <john.johansen@canonical.com>
2011-10-12 13:08:25 +02:00
Jamie Strandboge
a30dfb6b19 utils/aa-notify:
- set HOME (and DISPLAY) only once on startup to avoid NSS lookups

Acked-by: Jamie Strandboge <jamie@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <opensuse@cboltz.de>
2011-09-30 18:00:52 -05:00
Christian Boltz
b393893c7a sudo resets the environment variable $HOME and removes $DISPLAY on
openSUSE, which results in non-working desktop notifications in aa-notify
because $notify_exe is unable to connect to DBUS to display the message.

This patch sets the correct value for $HOME.

The code for setting $DISPLAY is still under discussion, therefore only
a TODO note is included in this commit for $DISPLAY.

Acked-By: John Johansen <john.johansen@canonical.com>
2011-09-24 13:19:10 +02:00
Jamie Strandboge
94e665b3fa utils/aa-notify:
aa-notify would abort if it could not stat the logfile, as can happen
when using auditd and the directory perms for the logfile do not allow access
(x). Add raise_privileges() and drop_privileges() helper functions and adjust
get_logfile_size() and get_logfile_inode() to raise then drop privileges if the
logfile parent directory is not executable. Also adjust reopen_logfile() to use
these helpers.

When error checking, use '$> == ...' instead of '$> = ... or die...' since perl
always dies when raising privs in this manner even though the euid did change
(and $!, $@, $^E, and $? are all the same). Not sure why this is happening but
the '==' check should be sufficient.
2011-08-17 09:48:12 -05:00
Jamie Strandboge
0a5c4fa159 utils/aa-notify:
- drop supplemental group privileges too. While POSIX::setgid() works nice in
  that it will set both the real uid and euid, it doesn't do anything with the
  supplemental groups (sigh). Instead, assign to $( and $) in a manner that
  clears the supplemental groups.
2011-08-17 08:35:52 -05:00
Kees Cook
6717e29909 Here is a patch to standardize on all utils using the "aa-" prefix instead
of a mix of symlinks to non-prefixed comands, and "apparmor_" prefixed
commands.

This also refactors the manpage generation slightly since we no longer
need special cases for the manpages, and drops aa-eventd from the default
list of tools to install (it also lacks a manpage).
2010-11-03 17:03:52 -07:00
Renamed from utils/apparmor_notify (Browse further)