Classic confinement request for fnmap

Hello Reviewers team,

I am requesting classic confinement for the fnmap snap (com.krioltech.fnmap).

fnmap is an open-source graphical frontend for the Nmap network scanner, built with Flutter. It was previously published in the Snap Store under strict confinement (version 1.3.4.1), but transitioning to classic confinement is required to support privileged scanning capabilities (SYN stealth scans, OS detection, UDP scans, ICMP sweeps, and traceroute).


Metadata

  • Snap name: fnmap
  • Upstream: https://github.com/gmckesey/fnmap
  • Snapcraft.yaml: snapcraft.yaml located in the root of the upstream repo (github.com/gmckesey/fnmap/blob/master/snapcraft.yaml)
  • Upstream relation: Author and maintainer
  • Category: Debug / diagnostic & network administration tools

Technical Justification & Why Strict Confinement is Insufficient

Nmap provides unprivileged scans (e.g., standard TCP connect scans via -sT), but its diagnostic capabilities require elevated privileges:

  • Raw network sockets (CAP_NET_RAW / CAP_NET_ADMIN)
  • Root access (geteuid() == 0) for raw packet crafting, SYN stealth scanning (-sS), OS fingerprinting (-O), and UDP scanning (-sU).

We previously attempted to make this work under strict confinement, but encountered fundamental architectural blockers inherent to strictly confined desktop GUI applications:

  1. network-control & Ambient Capabilities Limitation: Even when plugging network-control and network-observe, the interface only broadens the AppArmor profile. Because the GUI application executes as an unprivileged desktop user (UID 1000) and snapd processes do not inherit ambient capabilities, nmap detects geteuid() != 0 and immediately halts with: "You requested a scan type which requires root privileges. QUITTING!"

  2. PR_SET_NO_NEW_PRIVS Blocks In-App Elevation: In standard native Linux desktop apps, a GUI prompts the user for privilege escalation using pkexec or sudo to spawn the privileged helper process. Under strict snap confinement, snap-confine enforces PR_SET_NO_NEW_PRIVS and mounts filesystems with nosuid. As a result, the application cannot invoke pkexec or sudo from within the sandbox to run privileged scans.

  3. Running the Full GUI as Root is Impractical and Unsafe: While CLI snaps can be executed via sudo <snap-name>, running a Flutter/GTK desktop application with sudo is strongly discouraged and fails on modern Wayland display sessions (No protocol specified / display connection refused), in addition to risking user configuration permissions under X11.

  4. Lack of Polkit Desktop Portal in Snapd: Unlike Flatpak (which offers a host execution portal via flatpak-spawn --host pkexec ...), Snapd does not currently provide a Polkit portal allowing strictly confined GUI snaps to request host privilege elevation for spawned helper commands.


Why Classic Confinement Resolves the Issue

With classic confinement, fnmap runs in the global mount namespace. When the user requests a privileged scan in the GUI, the application can cleanly invoke pkexec nmap (or fallback to user-authenticated sudo), triggering the desktop environment’s native PolicyKit authentication modal to perform privileged network diagnostics safely.

Thank you for your time and consideration!

This request has been added to the queue for review by the @reviewers team.

Hello @krioltech,

My sincere apologies for the delay in this request.

I am not sure that this falls cleanly under a supported category for classic, additionally I believe there might be a strict-confinement path here. Are you using a bundled nmap, or relying on the host nmap? Have you attempted bundling nmap with the snap (alongside network-control)? This would be preferred under strict over pursuing classic. If you have tried this approach and run into issues, please describe them here. Thank you!