-
Notifications
You must be signed in to change notification settings - Fork 557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Desktop notifications for blacklist violations #433
Comments
I think for distros using systemd it should something like
as there is no syslog. |
I think it generally should be more accessible to the user and not a fixed script that firejail distributes. Should be easy to change the command to run, other than copying the script and making your own version out of it. Not everyone wants to run zenity for notifications. It could be done as some kind of "event-hook". Whenever a blacklist violation (or other events possibly?) happens, run the command specified by the user. |
The messages are sent to syslog, so they already go to systemd. I'll look into some sort of event-hook as suggested by @avoidr |
By the way, do systemd-based distros actually get syslog events from I've migrated to ArchLinux a couple of months ago and I still can't make firejail and syslog work together. I had to stop using custom seccomp rules for this exact reason.:( |
It should work, I send the messages to syslog using the facilities available in glibc. I'll do a short check on Arch. |
If you can, that'd be great, thank you! The attempts that failed for me were installing |
My understanding is systemd should collect by default all the messages that used to go to syslog. I'll have take a look. |
@vn971 Have you enabled ForwardToSyslog in journald? |
@reinerh yes, I have it enabled in /etc/systemd/journald.conf. If you do get notifications on ArchLinux, please mention it, it'd be very interesting to know. |
I'm not using Arch, but I see blacklist violations for example with
|
@reinerh this one I did (pleasantly and successfully) in ubundu/debian, too... Never so after moving to Arch. (I like Arch very much comparing to ubuntu, so switching back is not something I want..) |
#!/usr/bin/env bash
# Copyright © 2019 rusty-snake
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
function usage {
echo "Usage:"
echo " NOTIFY_TOOL=\"<ZENITY|KDIALOG|NOTIFY_SEND>\" $0"
}
if [ "$1" == "--help" ] || [ "$1" == "-h" ] || [ "$1" == "-?" ]; then
usage "$@"
exit 0
fi
if [ ! -v "NOTIFY_TOOL" ]; then
printf "Error: \"NOTIFY_TOOL\" not set.\n"
usage "$@"
exit 1
fi
if [ "$NOTIFY_TOOL" == "ZENITY" ]; then
notify_cmd="zenity"
notify_args=(--title "Blacklist violation" --no-wrap --warning --text)
elif [ "$NOTIFY_TOOL" == "KDIALOG" ]; then
notify_cmd="kdialog"
notify_args=(--title "Blacklist violation" --sorry)
elif [ "$NOTIFY_TOOL" == "NOTIFY-SEND" ]; then
notify_cmd="notify-send"
notify_args=(--icon "dialog-warning" "Blacklist violation")
else
printf "Error: Invalid value for NOTIFY_TOOL.\n"
usage "$@"
exit 1
fi
journalctl --grep="blacklist violation" --output=json --follow | jq --unbuffered ".MESSAGE" | xargs -L1 -P0 "$notify_cmd" "${notify_args[@]}" |
Dependencies:
Features:
|
@rusty-snake : Thanks., I was going to test the script but ran into the error:
See https://github.com/koalaman/shellcheck/wiki/SC1017
I will do further testing. |
But @rusty-snake didn't publish any line breaks, it must be your local editor? Anyway, I moved to using bubblewrap for security isolation, so I'll unsubscribe. |
BUG: |
Oops - yes, you're right. I'm using kate as my editor, and that had not happened before. Now it used the Windows/DOS style line terminator. Perhaps a regression in a recent update ... |
From wordpress:
question about desktop notifications for blacklist violations.
Can this be set up something like that like this up here? I think that would be a good thing.
The text was updated successfully, but these errors were encountered: