NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.16k stars 14.18k forks source link

services.networking.gns3-server -> ubridge problems #322415

Open TafkaMax opened 4 months ago

TafkaMax commented 4 months ago

Describe the bug

uBridge requires root access or the capability to interact with Ethernet and TAP adapters

Steps To Reproduce

Steps to reproduce the behavior:

  1. I have setup gns3-server via the services module and gns3-gui via home-manager.
    nixos-snowfall.home.extraOptions = {
      home.packages = with pkgs; [
        gns3-gui
      ];
    };
    # Add gns3-server as service.
    services.gns3-server = {
      enable = true;
      ubridge = {
        enable = true;
      };
      auth = {
        enable = true;
        user = "gns3";
        passwordFile = "/path/to/password";
      };
    };    
    # Add current user to ubridge group.
    users.users.${user.name}.extraGroups = [ "ubridge" ];
  2. Setup a virtual device and 'Cloud' end device.
  3. Try to add a link between the cloud device and the virtual device.

Expected behavior

I expect the link to be made, e.g. my user has access to ubridge.

Screenshots

If applicable, add screenshots to help explain your problem.

  1. Server prefs in gns3-gui image
  2. Topology image

Additional context

I am running the gns3-server and using the gns3-gui on the same machine. One is running via the nixos module and the other is via installing gns3-gui using home-manager.

# running via cli as normal user
ubridge       
uBridge version 0.9.18 running with libpcap version 1.10.4 (with TPACKET_V3)
iniparser: cannot open ubridge.ini

EDIT: Previously I was using this config and it worked.

    environment.systemPackages = with pkgs; [ gns3-server ubridge ];
    users.groups.ubridge = { };
    users.users.${user.name}.extraGroups = [ "ubridge" ];
    security.wrappers.ubridge = {
      source = "${pkgs.ubridge}/bin/ubridge";
      capabilities = "cap_net_admin,cap_net_raw=ep";
      owner = "root";
      group = "ubridge";
      permissions = "u+rx,g+rx,o+rx";
    };

Notify maintainers

@anthonyroussel

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.35, NixOS, 24.05 (Uakari), 24.05.20240623.e4509b3`
 - multi-user?: `yes`
 - sandbox: `relaxed`
 - version: `nix-env (Nix) 2.22.1`
 - nixpkgs: `/etc/nix/inputs/nixpkgs`

Add a :+1: reaction to issues you find important.

anthonyroussel commented 4 months ago

Hello ! Thanks for reporting this issue. I believe this is a duplicate of #292258. This PR #303442 should fix your issue with the broken gns3 / ubridge integration. The PR is waiting for a final review, and a sponsor with merge rights.