Sunil Mohan Adapa c47a856e3e
privileged: Introduce a UNIX socket daemon for privileged calls
- This daemon will be faster than running actions using 'sudo' because the
actions sometimes load all the modules before certain safety checks can be
performed. The daemon will load just once for many privileged calls.

Tests:

- After daemon is started, systemd shows the status as 'activated'.

- When daemon is started using socket activation and requests are sent, the
  requests succeed.

- When daemon is started manually and requests are sent, the requests succeed.
  The socket file is created with root:root ownership and 0666 permissions.
  Parent directory is created if not exists. After the daemon exits, the socket
  file is removed. When daemon is started manually, automatic idle timeout exit
  does not happen.

- According to journalctl, server exists after 5 seconds. Proper log message is
  seen.

- Without development mode, server exists after 5 minutes of idle. Proper log
  message is seen.

- When a sleep is added in one of the actions and when the action is running,
  server does not exit. Server exits after the request is completed.

- When an error is raised in verify request, the server exits with proper error
  message. If the server exists with non-zero error code and is immediately
  restarted by systemd.

- Sending a sample request using nc from root user and plinth user works.

- Sending a sample request using nc from fbx user is rejected.

- If a non-unicode text is sent as request, the response is a valid error
  dictionary.

- If the request is larger than 1M, an 'request too large' error is thrown.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2025-08-16 22:40:54 +05:30
..
2025-05-05 20:31:43 -04:00
2025-08-16 22:39:18 +05:30