HeadlinesBriefing favicon HeadlinesBriefing.com

Zig GTK4 SSH-askpass Tool

Hacker News •
×

The author developed a GTK4-based SSH-askpass utility using Zig 0.16, aiming to avoid X11 or full KDE dependencies often found in Gentoo's available packages. This need arose because certain build processes, like `go get` for private modules, require an SSH passphrase but lack a TTY for input. OpenSSH redirects this to an `SSH_ASKPASS` program, displaying the prompt in a graphical window.

Gentoo's default options for `ssh-askpass` were problematic. `kde-plasma/ksshaskpass`, while not requiring X11 directly, pulls in a substantial KDE stack, undesirable for a Sway user. `lxqt-base/lxqt-openssh-askpass` explicitly requires X11 and leads to Qt slot conflicts with the system's existing Qt build. Other options like `net-misc/gnome-ssh-askpass` and `net-misc/x11-ssh-askpass` are GTK-based but still rely on X11. The custom Zig tool bypasses these issues by using GTK4 with hand-written bindings, keeping X11 dependencies out of the build process.

The author's experience highlights the challenge of finding lightweight, dependency-minimal tools for specific tasks on systems like hardened Gentoo. The custom `ssh-askpass` provides a solution for situations where graphical passphrase entry is needed without bloating the system with unnecessary desktop environment components. The project aims to offer a lean alternative, demonstrating the flexibility of Zig for system-level utilities.