Giter Site home page Giter Site logo

cropi / usbguard-notifier Goto Github PK

View Code? Open in Web Editor NEW
42.0 5.0 9.0 158 KB

A tool for detecting usbguard policy and device presence changes

License: GNU General Public License v2.0

Makefile 7.87% Shell 0.91% M4 10.28% C++ 80.95%
usb usb-devices c-plus-plus linux usbguard

usbguard-notifier's People

Contributors

b1rger avatar cropi avatar drgrove avatar europ avatar lucasparsy avatar marektamaskovic avatar mzahnd avatar radosroka avatar yselkowitz avatar zoltanfridrich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

usbguard-notifier's Issues

initial release

Hi,
I wanted to ask if/when there will be an initial release. I package usbguard for openSUSE and would like to package a replacement for the usbguard-applet-qt. An official release would make packaging easier for me, as well as reporting bugs.

Thanks!

Crash after usb disconnect

Hey Cropi,

I'm using the latest usbguard and usbguard-notifier version. I installed all required packages mentioned in the README.md.

I did following steps:

  • ./autogen.sh
  • ./configure --prefix /home/$(id -un)
  • make
  • make install SYSTEMD_UNIT_DIR=/home/$(id -un)/.config/systemd/user/
  • systemctl enable --now --user usbguard-notifier.service

Trace

Connection has been established
terminate called after throwing an instance of 'std::runtime_error'
  what():  Failed to show notification
[2]    40050 abort      sudo ./usbguard-notifier

If I run this using the debug flag. I receive this message

LOG: src/Notifier.cpp::102 [DevicePresenceChanged] Device presence changed signal
Connection has been established

I hope I could resolve this issue. Thanks for your help.

Regards,
William

How do I allow the device?

Hello,

I just installed this software on ArchLinux. I used to use the old QT program.
I have installed the program so far that I get a message when I connect a device via USB.
grafik
But unfortunately I can't find a way to create rules via GUI.

OS: Arch Linux x86_64
Kernel: 5.4.2-arch1-1
Shell: /bin/zsh 5.7.1
Resolution: 3840x1080 @ 59.97Hz
DE: Cinnamon 4.4.3
WM: Mutter (Muffin)
Terminal: terminology
CPU: Intel i7-8550U (8) @ 4.000GHz [50.0°on]
GPU: Intel UHD Graphics 620
Memory: 2960MiB / 31997MiB (9%)
GPU Driver: i915

How to install it on Ubuntu 20.04?

I am trying to install usbguard-notifier on Ubuntu 20.04 and I did the following:

git clone https://github.com/Cropi/usbguard-notifier
cd usbguard-notifier/
./autogen.sh

Then I run:
./configure --prefix /home/$(id -un)

...and get the error:

checking for unistd.h... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for usbguard... no
configure: error: in `/home/matej/usbguard-notifier':
configure: error: libusbguard development files not found
See `config.log' for more details

usbguard is running (I can see it is active by running sudo service usbguard status, any other idea what could be wrong?

In config.log file I can see things like this (but I do not know if that is relevant):

...
configure:3544: g++ -V >&5
g++: error: unrecognized command line option '-V'
g++: fatal error: no input files
compilation terminated.
configure:3555: $? = 1
configure:3544: g++ -qversion >&5
g++: error: unrecognized command line option '-qversion'; did you mean '--version'?
g++: fatal error: no input files
compilation terminated.
...
configure:8548: gcc -E  conftest.c
conftest.c:11:10: fatal error: ac_nonexistent.h: No such file or directory
   11 | #include <ac_nonexistent.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
...
conftest.c:62:53: warning: integer overflow in expression of type 'int' results in '-2147483648' [-Woverflow]
   62 |    < (int32_t) (((((int32_t) 1 << N) << N) - 1) * 2 + 2))];
      |                                                     ^
conftest.c:61:12: error: storage size of 'test_array' isn't constant
   61 | static int test_array [1 - 2 * !((int32_t) (((((int32_t) 1 << N) << N) - 1) * 2 + 1)
      |            ^~~~~~~~~~
configure:12179: $? = 1

needs way to allow/blow devices interactively

Hello.

usbguard recommends usbguard-notifier as a replacement for their retired QT applet. Unfortunately however, there seems to be no way to actually allow/block/reject added devices.

Would it be possible, to include some functionality in the GUI, that for any new devices a notification stays open for some configurable amount of time (just as the previous QT applet did) allowing to accept/block/reject the device via some buttons, and if no action is taken in the configured time, it should just leave it as is (e.g. whatever usbguard decided, typically blocked)?

Also, it should show these for possibly multiple devices attached at the same time, and waiting for a choice. Just consider e.g. when one plugs a laptop to a docking stations and a handful of new USB devices shows up.

That would tremendously increase the usefulness of the tool.

Regards,
Philippe

Feature request: Supress messages for existing devices

It would be great to a have a config option that allows to suppress messages about known devices. Right now when connecting the laptop to the dock I get usbguard messages for all the usb devices that get connected. They are all mine and are all allowed. So it would be nice to have an option to reduce the noise a bit.

Arch Linux: Expired signature & build error

Hello,

A few days ago I have noticed that I can't manage to install this package with makepkg (Arch Linux install helper).
It seems like the signature for the newest release is expired and I am also getting some cxx build errors.

It doesn't seem like the main branch is getting the same build errors. But 0.1.0 definetly does when using the above mentioned install method.

If you can't reproduce or think that this is invalid because I am not using the recommended install method, you are welcome to close this issue.

Add usbguard icon

Add and install usbguard icon somewhere into /usr/share directory.

CLI: no such file /tmp/usbguard-notifier/$USER

I have compiled the tool with the following commands (and installed it on my system):

bash autogen.sh
./configure --with-bundled-catch --prefix=/opt/usbguard-notifier --with-usbguard-devel=/opt/usbguard-dev --with-permanent-notifications=/tmp/usbguard-notifier
make

The notifications work just fine, however, when I run usbguard-notifier-cli it mentions the following error:

Error: file /tmp/usbguard-notifier/jeff doesnt exist.

What's up with that? :)

[RFE] Reduce amount of notifications, make notifications go away

Steps to reproduce:

  1. have usbguard-notifier running
  2. have usbguard configured in a "default deny" policy
  3. attach an USB device
  4. allow USB device (usbguard allow-device [number])

What happens:

After 3., I have 2 notifications:
Bildschirmfoto von 2021-06-04 14-04-54

After 4., I have 3 notifications:
Bildschirmfoto von 2021-06-04 14-05-20

What should happen:

Less notifications, max 1 notification per device. As the previous state is not valid any more, it is not of interest.
Possible ideas include:

  • Only show one notification per USB device by keeping a reference to the notification of the device until it is dismissed. Every time the device changes its state, update the notification (using Notify.Notification.update()) instead of creating a new notification.
  • Dismiss notifications after some time.

Installed software versions:

usbguard-1.0.0-4.fc34.x86_64
usbguard-notifier-0.0.6-4.fc34.x86_64
glib2-2.68.2-1.fc34.x86_64
libnotify-0.7.9-4.fc34.x86_64

EDIT:
Note: My USB device seems to have an empty name, which is also being reported as empty by usbguard list-devices in the name field.

Add usbguard-notifier-cli

Create usbguard-notifier-cli:

  • user should be able to view list of recieved notifications
  • user should be able to perform some operations with those notifications (block, allow or remove devices, etc.)
  • usbguard-notifier-cli should be somewhat interactive

Merge release

The 0.1.1 release tag points to 0938f4a and there is an official release on github, but the commit is not part of any branch. Would you mind merging that into main?
(Otherwise git fetch does not fetch the tag...)

notifier crash

I'm running usbguard-daemon -d -k -c /etc/usbguard/usbguard-daemon.conf with notifier in the background and when I send a sigterm to usbguard-daemon, notifier crashes.

Nov 12 09:40:37 Axis systemd[1384]: usbguard_notifier.service: Main process exited, code=killed, status=11/SEGV
Nov 12 09:40:37 Axis systemd[1384]: usbguard_notifier.service: Failed with result 'signal'.
Nov 12 09:40:37 Axis systemd-coredump[28466]: Process 28433 (usbguard_notifi) of user 1000 dumped core.
                                              
                                              Stack trace of thread 28435:
                                              #0  0x0000000000406c88 n/a (/home/rsroka/sbin/usbguard_notifier)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.