Files
RedBear-OS/local/recipes/system/redbear-authd
vasilito fd11aa716c
redbear-ci / check (push) Has been cancelled
feat: port the missing KDE Plasma dependency chain and harden the auth stack
Unblocks plasma-workspace/plasma-desktop, which required 14 packages that had
no in-tree recipe. Sources are reproducible from each recipe's tar= + blake3;
the vendored source/ trees are deliberately not committed here (212M).

New recipes:
  KF6 6.28.0   kf6-kholidays, kf6-krunner, kf6-kstatusnotifieritem,
               kf6-kunitconversion
  Plasma 6.7.2 knighttime, layer-shell-qt, libkscreen, libksysguard,
               plasma-activities-stats, plasma5support, kscreenlocker
  Qt 6.11.1    qtpositioning, qtspeech, qttools

libksysguard carries P0-redox-process-backend.patch: processes_local_p.cpp
dispatches on platform macros and had no __redox__ arm, so ProcessesLocal was
entirely undefined. Adds a real backend reading /scheme/proc/ps (pid, ppid,
real+effective ids, thread count, state) and /scheme/sys/mem, with kill() for
signals. Upstream's generic fallback is a pure stub and was not used. Absent
facilities (no setpriority/sched_setscheduler/ioprio on a microkernel) report
NotSupported rather than pretending.

Restored, no longer disabled:
  - night colour: kcms/nighttime + kwin's nightlight plugin, now that
    KNightTime/Qt6Positioning/KF6Holidays exist
  - KIO FileWidgets (file dialog, places model), wrongly swept in with the
    unportable kiod/kssld/kioworkers subdirs
  - kf6-ktexteditor text-to-speech: removes a disguised stub that rewrote
    speechEngine() to return nullptr and mangled call sites into invalid C++
  - kwin KWIN_BUILD_SCREENLOCKER=ON (needs kscreenlocker; see below)

Toolchain and recipe fixes:
  - redox-toolchain.cmake: append -lgcc. __extendhfsf2/__extendbfsf2 are
    global in libgcc.a but hidden in libgcc_s.so (the Redox libgcc version map
    stops at GCC_7.0.0 and never emits the GCC_12/13 nodes upstream exports),
    and GCC omits -lgcc for -shared, so no C++23 shared library using
    std::format<_Float16|bfloat16_t> could link.
  - qtmultimedia: rewrite /usr/src/.../meta_types paths and stage metatypes,
    so consumers using qt_internal_add_qml_module can configure.
  - qtspeech: qtmultimedia is mandatory, not optional -- upstream return()s
    with only a NOTICE without it, yielding a green build over an empty
    package. Asserts its own output so that cannot recur.
  - narrow Linux-only guards with AND NOT REDOX where the toolchain sets
    CMAKE_SYSTEM_NAME=Linux purely to get UNIX=TRUE (kio LibMount,
    libksysguard NL/Sensors, plasma-workspace NetworkManagerQt).
  - drop REQUIRED components that are declared but referenced nowhere
    (Location, QCoro6, Qt6 Test) -- verified by exhaustive grep.
  - DESTDIR installs where KDE emits absolute KDE_INSTALL_FULL_* paths that
    --prefix cannot re-root, which otherwise write into the build host.

Auth stack:
  - pam-redbear: add PAM_MODULE_UNKNOWN (28), missing from both the header and
    lib.rs; realign 30/31 to Linux-PAM's PAM_CONV_AGAIN/PAM_INCOMPLETE, which
    previously held Red Bear-only names on standard values, so anything built
    against stock PAM headers mis-decoded them.
  - redbear-authd: support yescrypt ($y$ -- the default shadow format on
    current Debian/Ubuntu/Fedora, previously an unexplained login failure),
    bcrypt and md5-crypt. Plaintext shadow entries now require the
    /etc/redbear/allow-plaintext-passwords sentinel and warn on every use,
    instead of being compared silently. 19/19 host tests pass.

Build-system hardening:
  - verify-tracked-sources.sh, wired into preflight: fails on deletion of any
    tracked vendored source, and on modifications with no baseline entry.
    local/sources/ had a dirty gate and version checks; local/recipes/*/source/
    had none, which allowed an rm -rf to delete 7958 tracked files and a
    pristine re-extract to silently overwrite committed fixes (kwin's
    std::expected/vulkan-hpp and X11 gating, kio's Q_OS_REDOX resolver guards).
  - validate-source-trees.py: resolve recipe.toml through the overlay symlink;
    it reported false MISSING for symlinked recipes.
  - test-sddm-virgl-qemu.sh: the null-proxy check used report(), which PASSES
    on regex match -- so the known Qt6 Wayland null+8 fault would report PASS
    when present. Added report_absent().

kscreenlocker builds only its cmake-level Wayland-only changes so far; the
C++ X11 removal (61 call sites) is not yet applied, so kwin's screenlocker
flag is blocked on it.
2026-08-04 10:06:39 +03:00
..

redbear-authd

Authentication daemon — PAM-like auth with password verification and session launch

Status: FEATURE-INCOMPLETE Category: system Build: cargo build --release --manifest-path source/Cargo.toml

Purpose

redbear-authd is the Red Bear authentication daemon. It listens on a Unix domain socket at /run/redbear-authd.sock and accepts JSON-format authentication requests from redbear-greeterd. It verifies user credentials against /etc/passwd and /etc/shadow, supports SHA-256/SHA-512 crypt and argon2 password hashes, enforces rate-limiting with lockout, and launches desktop sessions via redbear-session-launch. After successful authentication, it publishes session state to redbear-sessiond via the control socket.

Protocol

  • Transport: JSON over Unix socket at /run/redbear-authd.sock
  • Message types: Defined by redbear-login-protocol crate

AuthRequest Types

Type Fields Description
authenticate request_id, username, password, vt Verify credentials. Rate-limited (5 failures → 30s lockout).
start_session request_id, username, session, vt Launch a desktop session. Requires successful prior authentication within 15s on the same VT.
power_action request_id, action Perform shutdown/reboot.

AuthResponse Types

Type Fields Description
authenticate_result request_id, ok, message Auth success/failure with human-readable message
session_result request_id, ok, exit_code?, message Session launch result with optional exit code
power_result request_id, ok, message Power action result
error message Protocol-level error

Architecture

Single-file Rust binary (src/main.rs, ~722 lines). Synchronous I/O with blocking Unix socket operations.

Key types:

  • Account — username, hashed password (from shadow or passwd), uid, shell
  • Approval — temporary post-auth approval (15s expiry, VT-scoped)
  • FailureState — rate-limiting: tracks attempt timestamps within a 60s window; 5 failures triggers 30s lockout
  • RuntimeStateArc<Mutex<>> wrappers for approvals and failures

Password verification:

  • /etc/shadow entries starting with $6$ or $5$ → SHA-512/SHA-256 crypt via sha-crypt crate (MIT licensed)
  • /etc/shadow entries starting with $argon2 → argon2 verification via rust-argon2 crate
  • Entries starting with ! or * → locked account (always denied)
  • Unhashed passwords (plaintext in /etc/passwd) → direct comparison (legacy compatibility)
  • Accounts with UID != 0 and UID < 1000 are rejected for login

Account format support:

  • Dual-format parsing: Redox (; delimiter) and Unix (: delimiter) passwd/group/shadow formats
  • Auto-detection by checking for ; in the first line

Session launch:

  • Spawns /usr/bin/redbear-session-launch --username <user> --mode session --session kde-wayland --vt <n>
  • Sends set_session control message to redbear-sessiond with username, uid, vt, leader PID
  • When session exits, sends reset_session control message
  • Supports validation mode: when /run/redbear-kde-session.validation-request exists, session exits are non-blocking

Power actions:

  • Searches for /usr/bin/shutdown, shutdown, or poweroff (in order) for poweroff
  • Searches for /usr/bin/reboot or reboot (in order) for reboot

Dependencies: redbear-login-protocol (local), rust-argon2, sha-crypt, serde/serde_json.

Consumers

  • redbear-greeterd — primary client, sends authentication and session-start requests over the Unix socket
  • redbear-sessiond — receives state updates via control socket (/run/redbear-sessiond-control.sock)

Status Notes

  • Authentication: Fully implemented with SHA-crypt, argon2, and plaintext support. Rate limiting with 5-attempt/60s window and 30s lockout.
  • Session management: Launches redbear-session-launch for kde-wayland sessions. Updates sessiond control socket on state transitions.
  • Power actions: Shutdown and reboot via /usr/bin/shutdown and /usr/bin/reboot (fallback search for bare command names).
  • Validation mode: /run/redbear-kde-session.validation-request enables non-blocking session exit for test automation.
  • Missing: No PAM module integration. No GUI authentication prompt — credentials come from the greeter over the Unix socket. No pam-redbear backend integration beyond the socket protocol.

Cross-reference: local/docs/GREETER-LOGIN-IMPLEMENTATION-PLAN.md