Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

1.2 KB
Raw Blame
/* netd.c — lord-netd: LordOS networking belongs to the system, not to a session (docs/NETWORK.md,
 * "The network belongs to the system").
 *
 * lord-sessiond starts it at boot (fixed path next to its own binary, root-owned and not writable
 * by others), with no arguments, and restarts it if it exits. It brings the network up before
 * anyone logs in (DHCP, saved Wi-Fi, /etc/lordos/net/if configs, DNS), so the greeter shows the IP
 * and the remote desktop is reachable, and keeps it up while sessions come and go. It is admin.c
 * built with LORD_NETD: its table has only the net-* actions (same validation), served on
 * /run/lordos/netd.sock, a 0600 socket that only the sessions' root helpers connect to. It runs
 * nothing beyond what those actions already run (wpa_supplicant, openvpn, charon, pppd, resolvectl,
 * networkctl… at fixed paths). */
#include "../admin.h"

#include <stdio.h>
#include <string.h>
#include <unistd.h>

int main(int argc, char **argv) {
    (void)argv;
    if (argc != 1) { fprintf(stderr, "usage: lord-netd (no arguments; started by lord-sessiond)\n"); return 2; }
    if (geteuid() != 0) { fprintf(stderr, "lord-netd: must run as root\n"); return 1; }
    setvbuf(stderr, NULL, _IOLBF, 0);
    return admin_netd_serve();
}