Commit 2146307e authored by Thomas Haller's avatar Thomas Haller

core: fix file permissions for "/var/lib/NetworkManager/secret_key"

Ooherwise, the file has wrong permissions:

  # ls -la /var/lib/NetworkManager/secret_key
  ----r-xr-x. 1 root root 50 May 14 13:52 /var/lib/NetworkManager/secret_key

Luckily, /var/lib/NetworkManager should be already

  # ls -lad /var/lib/NetworkManager
  drwx------. 2 root root 8192 May 14 13:57 /var/lib/NetworkManager

which mitigates this a bit.

Fixes: dbcb1d6d ('core: let nm_utils_secret_key_read() handle failures internally')

(cherry picked from commit dc3a2f9b)
(cherry picked from commit 2d46247c)
(cherry picked from commit 7a0f8520)
(cherry picked from commit 869ac551)
parent add6f1c2
......@@ -2838,7 +2838,7 @@ _secret_key_read (guint8 **out_secret_key,
goto out;
if (!nm_utils_file_set_contents (NMSTATEDIR "/secret_key", (char *) secret_key, key_len, 0077, &error)) {
if (!nm_utils_file_set_contents (NMSTATEDIR "/secret_key", (char *) secret_key, key_len, 0600, &error)) {
nm_log_warn (LOGD_CORE, "secret-key: failure to persist secret key in \"%s\" (%s) (use non-persistent key)",
NMSTATEDIR "/secret_key", error->message);
success = FALSE;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment