I am attempting to ascertain and control actual hostname during dhcp AP association.
Changes to the /etc/hostname file break sudo.
An inspection of journalctl -u NetworkManager shows Network Manager consistently setting itself to the value in the above file. Dmesg association logs make no mention of hostname.
According to man NetworkManager.conf, Nm used to include a hostname option allowing hostname to be set per connection in the config file, but this is depracated (for some reason, implying perhaps there is a more obvious way to achieve the same functionality).
A hostname option also appears in dhclient.conf, much like the NetworkManager.conf option; but Network Manager still shows hostname being set to the value in /etc/hostname using hostnamed, regardless of dhclient.conf entry:
NetworkManager[9405]:[1595351700.9848] settings: hostname: using hostnamed
NetworkManager[9405]: <info> [1595351700.9849] settings: hostname changed from (none) to "debian"
This seems a security fundament, at least if hostname can be sniffed or inspected in AP association logs.
What value is really being handed out at dhcp association, and how can it easily be controlled?