diff options
author | Samuel Tan <samueltan@google.com> | 2015-08-13 16:27:29 -0700 |
---|---|---|
committer | Samuel Tan <samueltan@google.com> | 2015-08-18 13:46:49 -0700 |
commit | dd90b01b5502dc66e00ea6a4d00ebdf77ea1eddc (patch) | |
tree | 5e6ad29a7b7f02e33caf83e5dfe0a2341e5aa066 | |
parent | f20514bf582d08567217a3b06171bab5a11458ea (diff) | |
download | dhcpcd-6.8.2-dd90b01b5502dc66e00ea6a4d00ebdf77ea1eddc.tar.gz |
[PATCH] Fix dhcpcd running as a regular user.
Cherry-picked from
https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/
master/net-misc/dhcpcd/files/patches/dhcpcd-6.8.2-Fix-dhcpcd-running-as-a-
regular-user.patch.
Update the lease file permission to 0600 to prevent other
users from reading the lease file.
Moreover, also soften the log message shown when not running as root,
since by using Linux capabilities dhcpcd can run fine as a regular user.
BUG: 22956197
Change-Id: Ib6f4ae4a892c6f5697cd03e79e3aa018b80712fe
Reviewed-on: https://gerrit.chromium.org/gerrit/22644
-rw-r--r-- | dhcp.c | 2 | ||||
-rw-r--r-- | dhcpcd.c | 4 |
2 files changed, 3 insertions, 3 deletions
@@ -1082,7 +1082,7 @@ write_lease(const struct interface *ifp, const struct dhcp_message *dhcp) logger(ifp->ctx, LOG_DEBUG, "%s: writing lease `%s'", ifp->name, state->leasefile); - fd = open(state->leasefile, O_WRONLY | O_CREAT | O_TRUNC, 0644); + fd = open(state->leasefile, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fd == -1) return -1; @@ -1641,8 +1641,8 @@ main(int argc, char **argv) #endif if (geteuid()) - logger(&ctx, LOG_WARNING, - PACKAGE " will not work correctly unless run as root"); + logger(&ctx, LOG_NOTICE, + PACKAGE " is running with reduced privileges"); #ifdef USE_SIGNALS if (sig != 0) { |