Skip to content
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

Fine-grained DBus sandboxing #3265

Merged
merged 9 commits into from
Apr 7, 2020
Merged

Fine-grained DBus sandboxing #3265

merged 9 commits into from
Apr 7, 2020

Commits on Apr 6, 2020

  1. Add --dbus-user and --dbus-system options

    Allow setting a separate policy for the user and system buses.
    For now, the filter policy is equivalent to the none (block) policy.
    Future commits will add more configuration options and filters.
    kris7t committed Apr 6, 2020
    Configuration menu
    Copy the full SHA
    6fc8a55 View commit details
    Browse the repository at this point in the history
  2. Add sbox_exec_v and SBOX_KEEP_FDS

    To contain processes forked for long time, such as the xdg-dbus-proxy,
    sbox_exec_v can be used, which is the non-forking version of sbox_run_v.
    Additionally, the SBOX_KEEPS_FDS flag avoid closing any open fds,
    so fds needed by the subordinate process can be left open before calling
    sbox_exec_v.
    This flag does not makes sense for sbox_run_v, and causes an assertion failure.
    kris7t committed Apr 6, 2020
    Configuration menu
    Copy the full SHA
    2345cc4 View commit details
    Browse the repository at this point in the history
  3. Add xdg-dbus-proxy support

    * The proxy is forked off outside the sandbox namespace to protect the
      fds of the original buses from the sandboxed process.
    * The /run/firejail/dbus directory (with the sticky bit set) holds the proxy
      sockets. The sockets are <parent pid>-user and <parent pid>-system for the
      user and system buses, respectively. Each socket is owned by the sandbox user.
    * The sockets are bind-mounted over their expected locations and the
      /run/firejail/dbus directory is subsequently hidden from the sandbox.
    * Upon sandbox exit, the xdg-dbus-proxy instance is terminated and the sockets
      are cleaned up.
    * Filter rules will be added in a future commit.
    kris7t committed Apr 6, 2020
    Configuration menu
    Copy the full SHA
    0afb43a View commit details
    Browse the repository at this point in the history
  4. Add dbus filter options

    The options --dbus-user.talk, --dbus-user.own, --dbus-system.talk, and
    --dbus-system.own control which names can be accessed and owned on the user and
    system buses.
    kris7t committed Apr 6, 2020
    Configuration menu
    Copy the full SHA
    31df60f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    5fa90d0 View commit details
    Browse the repository at this point in the history
  6. xdg-dbus-proxy hardening

    kris7t committed Apr 6, 2020
    Configuration menu
    Copy the full SHA
    db4c5b0 View commit details
    Browse the repository at this point in the history
  7. xdg-dbus-proxy socket finding and mount hardening

    To avoid race conditions, the proxy sockets from /run/firejail/dbus/ are
    bind-mounted to /run/firejail/mnt/dbus/, which is controlled by root.
    
    Instead of relying on the default locations of the DBus sockets, the environment
    variables DBUS_SESSION_BUS_ADDRESS and DBUS_SYSTEM_BUS_ADDRESS are set
    accordingly.
    
    User sockets are tried in the following order when starting the proxy:
    * DBUS_SESSION_BUS_ADDRES
    * /run/user/<pid>/bus
    * /run/user/<pid>/dbus/user_bus_socket
    These are all blocked (including DBUS_SESSION_BUS_ADDRESS if it points at a
    socket in the filesystem) when the filtering or blocking policy is active.
    
    System sockets are tried in the following order:
    * DBUS_SYSTEM_BUS_ADDRESS
    * /run/dbus/system_bus_socket
    These are all blocked (including DBUS_SYSTEM_BUS_ADDRESS if it points at a
    socket in the filesystem) when the filtering or blocking policy is active.
    kris7t committed Apr 6, 2020
    Configuration menu
    Copy the full SHA
    90facc1 View commit details
    Browse the repository at this point in the history
  8. Turn DBus profile errors into warnings

    This patch also allows setting the DBus policies to filter even if
    xdg-dbus-proxy is not installed. In that case, unrestricted access to the bus is
    allowed, but a warning is emitted.
    kris7t committed Apr 6, 2020
    Configuration menu
    Copy the full SHA
    870c8c8 View commit details
    Browse the repository at this point in the history

Commits on Apr 7, 2020

  1. Deprecate --nodbus option

    kris7t committed Apr 7, 2020
    Configuration menu
    Copy the full SHA
    e91b9ff View commit details
    Browse the repository at this point in the history