main/postmarketos-base: switch from doas to sudo-rs

The version of OpenBSD's doas packaged by Alpine had its last commit 21-02-2022. This in itself is not bad, but the issue is that in that time, there have been many MRs and issues filed to the repo that see no action. One major MR, that being a hardening patch against rowhammer attacks, has layed stale since 03-03-2024. After Natanael Copa asked if the repo was still maintained, the response was that it is low-priority.

As such switching to sudo-rs, despite its larger size and attack surface, makes sense due to more users and thus more eyes on it performing analysis and fixing security issues quicker. OpenBSD doas does not have this itself, and a low-usage fork of it definitely does not. While there are snazzier, more modern alternatives like run0, capsudo, or s6-sudo, none of these are in a state where they can fully replace all the features that sudo provides.

sudo-rs was chosen over the original sudo due to a few factors. The first is memory safety, as Rust generally solves that issue in the codebase, so a whole class of possible vulns are eliminated. Second is that sudo-rs is already in use by larger distributions like Canonical's Ubuntu, meaning that the user base is already quite large, leading to similar amounts of eyes on the source code. Third, sudo-rs has had support from the original authors of sudo, allowing the project to avoid the pitfalls of the legacy C codebase. Finally, sudo-rs has already had two fairly recent independent security audits, meaning that their security posture is diligent enough to be trusted.

See https://github.com/trifectatechfoundation/sudo-rs/tree/main/docs/audit

In the future, any further switch in the privilege-escalation tool should keep the sudo command, be it through a symlink, shim, or a binary itself. This is maintained currently due to having installed doas-sudo-shim by default, but more care should be taken in the future to not break user workflows.

Partially reverts 0f327af8

See #4144 (closed)

Edited by Aster Boese

Merge request reports

Loading
Loading