{"action":"created","issue":{"url":"https://api.github.com/repos/systemd/systemd/issues/4646","repository_url":"https://api.github.com/repos/systemd/systemd","labels_url":"https://api.github.com/repos/systemd/systemd/issues/4646/labels{/name}","comments_url":"https://api.github.com/repos/systemd/systemd/issues/4646/comments","events_url":"https://api.github.com/repos/systemd/systemd/issues/4646/events","html_url":"https://github.com/systemd/systemd/issues/4646","id":188624597,"number":4646,"title":"networkd fails to set transient hostname","user":{"login":"martinpitt","id":200109,"avatar_url":"https://avatars.githubusercontent.com/u/200109?v=3","gravatar_id":"","url":"https://api.github.com/users/martinpitt","html_url":"https://github.com/martinpitt","followers_url":"https://api.github.com/users/martinpitt/followers","following_url":"https://api.github.com/users/martinpitt/following{/other_user}","gists_url":"https://api.github.com/users/martinpitt/gists{/gist_id}","starred_url":"https://api.github.com/users/martinpitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinpitt/subscriptions","organizations_url":"https://api.github.com/users/martinpitt/orgs","repos_url":"https://api.github.com/users/martinpitt/repos","events_url":"https://api.github.com/users/martinpitt/events{/privacy}","received_events_url":"https://api.github.com/users/martinpitt/received_events","type":"User","site_admin":false},"labels":[{"id":241057944,"url":"https://api.github.com/repos/systemd/systemd/labels/hostname","name":"hostname","color":"bfd4f2","default":false},{"id":219549709,"url":"https://api.github.com/repos/systemd/systemd/labels/network","name":"network","color":"fad8c7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-10T21:35:32Z","updated_at":"2016-11-18T14:18:44Z","closed_at":null,"body":"### Submission type\r\n\r\n  - [X] Bug report\r\n  - [ ] Request for enhancement (RFE)\r\n\r\n### systemd version the issue has been seen with\r\n\r\n> 232\r\n\r\n### Used distribution\r\n\r\n> Debian\r\n\r\nWhile investigating issue #4504 and what would break when networkd starts before D-Bus, I noticed that the only reason why networkd currently runs after `dbus.service` is setting a transient hostname received through DHCP. But this doesn't actually seem to work: When DHCP does send a hostname, networkd says\r\n```\r\nsystemd-networkd[516]: ens3: Could not set hostname: Interactive authentication required.\r\n```\r\nPresumably because networkd drops its privileges to user `systemd-network` and the polkit policy of hostnamed only allows root to change the host name.\r\n\r\nFTR, I reproduced this in QEMU with `-net nic,model=virtio -net user,hostname=fizzy` which will send a hostname along with DHCP.\r\n\r\nFixing this should go along with actually testing this in `test/networkd-test.py`, as this is quite a subtle problem that isn't obvious when reviewing PRs for privilege reduction."},"comment":{"url":"https://api.github.com/repos/systemd/systemd/issues/comments/261542020","html_url":"https://github.com/systemd/systemd/issues/4646#issuecomment-261542020","issue_url":"https://api.github.com/repos/systemd/systemd/issues/4646","id":261542020,"user":{"login":"martinpitt","id":200109,"avatar_url":"https://avatars.githubusercontent.com/u/200109?v=3","gravatar_id":"","url":"https://api.github.com/users/martinpitt","html_url":"https://github.com/martinpitt","followers_url":"https://api.github.com/users/martinpitt/followers","following_url":"https://api.github.com/users/martinpitt/following{/other_user}","gists_url":"https://api.github.com/users/martinpitt/gists{/gist_id}","starred_url":"https://api.github.com/users/martinpitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinpitt/subscriptions","organizations_url":"https://api.github.com/users/martinpitt/orgs","repos_url":"https://api.github.com/users/martinpitt/repos","events_url":"https://api.github.com/users/martinpitt/events{/privacy}","received_events_url":"https://api.github.com/users/martinpitt/received_events","type":"User","site_admin":false},"created_at":"2016-11-18T14:18:44Z","updated_at":"2016-11-18T14:18:44Z","body":"Confirming that this works if you set `<allow_any>yes</allow_any>` for `org.freedesktop.hostname1.set-hostname` in `/usr/share/polkit-1/actions/org.freedesktop.hostname1.policy` (this is of course only for testing). `*.policy` files don't have a syntax for \"also grant this policy to Unix users, that's where the pklocalauthority(8) files come in -- and unfortunately there's *two* formats around: the old ini-style declarative ones (`Identity=systemd-network\\nAction=org.freedesktop.hostname1.set-hostname\\nResultAny=yes`) and the \"free-form JavaScript\" ones from newer polkits. IMNSHO these have been a ridiculously bad idea for several reasons and Debian/Ubuntu never got those, but Fedora did. So we could auto-detect the available polkit version during package build, or ship both files and the distro picks, or we provide a `./configure` switch for those."}}
{"actor":{"display_login":"martinpitt"}}