After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 783707 - [RFE] lr/systemd-ask-password: utilize the systemd-ask-password protocol for connection secrets
[RFE] lr/systemd-ask-password: utilize the systemd-ask-password protocol for ...
Status: RESOLVED OBSOLETE
Product: NetworkManager
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-06-12 17:16 UTC by Lubomir Rintel
Modified: 2020-11-12 14:27 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Lubomir Rintel 2017-06-12 17:16:08 UTC
There's no way to request secrets for a connection during early boot or on servers. systemd-ask-password provides a way to ask for a single password which might be sufficient in most cases.

A PoC branch asks for a single secret from systemd-ask-password as if it were a secret agent:

https://cgit.freedesktop.org/NetworkManager/NetworkManager/?h=lr/systemd-ask-password

An alternative solution would be to implement a secret agent that would forward the requests to systemd-ask-password. The downside would be that a D-Bus or private connection would be needed. On the other hand we could avoid adding complexity to the server.
Comment 1 Thomas Haller 2017-06-13 07:52:58 UTC
>> nm-agent: add NMAgent interface for secret agents

indentation is wrong at several places.


-    req->current_call_id = nm_secret_agent_get_secrets (req->current,
+    req->current_call_id = nm_agent_get_secrets (req->current,
                                                         req->con.path,
                                                         tmp,

-    req->current_call_id = nm_secret_agent_save_secrets (req->current,
+    req->current_call_id = nm_agent_save_secrets (req->current,
                                                          req->con.path,

indentation


+1 for adding tooltip to new fields. It's not clear (to me) what "Domains" is.


Rest lgtm. Nice!!
Comment 2 Thomas Haller 2017-06-13 09:18:59 UTC
(In reply to Thomas Haller from comment #1)
> >> nm-agent: add NMAgent interface for secret agents
>
> +1 for adding tooltip to new fields. It's not clear (to me) what "Domains" is.

oh, wrong bug :) Was intended for rh#1457542
Comment 3 Thomas Haller 2017-06-13 14:14:59 UTC
why does request_start() use link() instead of rename()?

request_start() can leak @tmpname. Why not gs_free (inside the while loop)?

request_start() handles error from nm_utils_fd_set_contents() wrong.



nm_utils_fd_set_contents() doesn't properly handle lenght==-1. If you fix that, request_start() could just pass -1 as length.



+    if (secs)
+         req->timeout_id = g_timeout_add_seconds (secs, request_timeout, req);

the name "secs" is not great... timeout_s would be better. Anyway, it seems you can disable timeout by setting it to zero. However 
+    if (clock_gettime (CLOCK_MONOTONIC, &tp) == 0)
+         tp.tv_sec += secs;
doesn't consider whether the timeout is disabled.



+     "NotAfter=%ld%ld\n"

+     getpid (), req->sockname, tp.tv_sec, tp.tv_nsec / 1000,

the timeout is wrong. Should be (tp.tv_sec * 10000000 + tp.tv_nsec / 1000).
Comment 4 Thomas Haller 2017-06-13 14:15:30 UTC
(In reply to Thomas Haller from comment #3)
> why does request_start() use link() instead of rename()?

ignore that, I figured it out myself
Comment 5 Thomas Haller 2017-06-13 14:33:05 UTC
request_start():

+         tmpname = g_strdup (RUNSTATEDIR "/systemd/ask-password/tmp.XXXXXX");
  char tmpname[] = RUNSTATEDIR "/systemd/ask-password/tmp.XXXXXX";


sizeof (RUNSTATEDIR "/systemd/ask-password/") - 1
NM_STRLEN()?



leaks @error. gs_free_error.
Comment 6 André Klapper 2020-11-12 14:27:15 UTC
bugzilla.gnome.org is being shut down in favor of a GitLab instance. 
We are closing all old bug reports and feature requests in GNOME Bugzilla which have not seen updates for a long time.

If you still use NetworkManager and if you still see this bug / want this feature in a recent and supported version of NetworkManager, then please feel free to report it at https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/

Thank you for creating this report and we are sorry it could not be implemented (workforce and time is unfortunately limited).