Snap for Usbguard

name: usbguard
version: '0.7.7'
base: core20
summary: USBGuard is a software framework for implementing USB
description: |
  USBGuard is a software framework for implementing USB device authorization policies. Its rules
  language is fully programmable and easy to understand, and its architecture is based on services
  that can run on different host systems, including desktops, servers, tablets, and smartphones.
grade: stable
confinement: strict

parts:
  usbguard:
    plugin: autotools
    source: https://github.com/USBGuard/usbguard.git
    source-type: git
    build-packages:
      - asciidoc
      - autoconf
      - automake
      - bash-completion
      - build-essential
      - catch
      - docbook-xml
      - docbook-xsl
      - git
      - ldap-utils
      - libaudit-dev
      - libcap-ng-dev
      - libdbus-glib-1-dev
      - libldap-dev
      - libpolkit-gobject-1-dev
      - libprotobuf-dev
      - libqb-dev
      - libseccomp-dev
      - libsodium-dev
      - libtool
      - libxml2-utils
      - libumockdev-dev
      - pkg-config
      - protobuf-compiler
      - sudo
      - tao-pegtl-dev
      - xsltproc
    stage-packages:
      - libdbus-1-3
      - libsodium23
      - libsystemd0
      - libpcre3
      - libssl1.1
      - libpolkit-gobject-1-0
      - libprotobuf17
      - libqb0
      - libumockdev0
    override-build: |
      snapcraftctl build
      ./configure --with-bundled-catch --with-bundled-pegtl
      make
      make check
      make install DESTDIR=$SNAPCRAFT_PART_INSTALL
    autotools-configure-parameters:
      - --with-bundled-catch
      - --with-bundled-pegtl
apps:
  usbguard:
    command: usr/local/bin/usbguard
    plugs:
      - raw-usb
      - ipc
      - dbus
      - network
      - network-bind
      - netlink-connector
    environment:
      LD_LIBRARY_PATH: $SNAP/usr/local/lib:$LD_LIBRARY_PATH
   
layout:
  /usr/local/lib:
    bind: $SNAP_DATA/lib
  /usr/local/etc/usbguard:
    bind: $SNAP_DATA/etc
  /usr/local/var/log/usbguard:
    bind: $SNAP_DATA/log

like this i have created yaml for usbguard its creating snap package but after installation the usbguard not working properly how it will work in ubuntu ERROR: IPC connect: service=usbguard: Connection refused

the service error i thought i created a service for it

Description=USBGuard service
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
ExecStart=/snap/bin/usbguard
Restart=on-failure
RestartSec=5
EnvironmentFile=-/etc/environment
EnvironmentFile=-/snap/usbguard/current/env
WorkingDirectory=/snap/usbguard/current

[Install]
WantedBy=multi-user.target


can any one suggest the necessary modifications …

https://snapcraft.io/docs/services-and-daemons

You should consider define a snap daemon.

1 Like