mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 00:10:07 +01:00
policy: add a friendly warning
We don't want to admin CAP_SYS_ADMIN to our capability set in our .service file: If we're running with systemd then hostnamed should be used to manage the hostname, otherwise we likely have all capabilities anyway. Let the user know. Really, use systemd-hostnamed. Use it.
This commit is contained in:
parent
546272b216
commit
d6d343ef65
1 changed files with 5 additions and 1 deletions
|
|
@ -148,8 +148,12 @@ set_system_hostname (const char *new_hostname, const char *msg)
|
|||
nm_log_info (LOGD_DNS, "Setting system hostname to '%s' (%s)", name, msg);
|
||||
ret = sethostname (name, strlen (name));
|
||||
if (ret != 0) {
|
||||
int errsv = errno;
|
||||
|
||||
nm_log_warn (LOGD_DNS, "couldn't set the system hostname to '%s': (%d) %s",
|
||||
name, errno, strerror (errno));
|
||||
name, errsv, strerror (errsv));
|
||||
if (errsv == EPERM)
|
||||
nm_log_warn (LOGD_DNS, "You should use hostnamed when systemd hardening is in effect!");
|
||||
}
|
||||
|
||||
return (ret == 0);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue