Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of hostnameclt causes hostname rename lowercase for RHEL 7.x #686

Closed
CraigWiand opened this issue May 1, 2017 · 2 comments
Closed
Milestone

Comments

@CraigWiand
Copy link

Summary

In WALA version 2.2.3 we included change: #533 to go from setting the hostname via changing /etc/hostname to using hostnamectl. A result of this change was the logic in the Red Hat utility to move to lowercase was then applied. Per their documentation:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/ch-Configure_Host_Names.html#sec_Understanding_Host_Names

A host name can be a free-form string up to 64 characters in length. However, Red Hat recommends that both static and transient names match the fully-qualified domain name (FQDN) used for the machine in DNS, such as host.example.com. It is also recommended that the static and transient names consists only of 7 bit ASCII lower-case characters, no spaces or dots, and limits itself to the format allowed for DNS domain name labels, even though this is not a strict requirement. Older specifications do not permit the underscore, and so their use is not recommended.

hostnameclt enforces this recommendation unless you tell it not to via the --static switch.

Repo steps

  • Provision a new RHEL 7.x VM from marketplace
  • name vm TEST-LOWER (capitalized)
  • SSH into VM
  • Expect behavior: VM name is TEST-LOWER
  • Actual behavior: VM name is test-lower

More info/Analysis

  1. Hostname is set during provisioning from the ovf-env file based on what was provided in the Azure portal:

2017/04/27 14:47:19.317120 INFO Handle ovf-env.xml.
2017/04/27 14:47:19.320364 INFO Set hostname [TEST-LOWER]
2017/04/27 14:47:19.732764 INFO Publish hostname [TEST-LOWER]

  1. Azure Linux agent provisioning will call set_hostname which will call hostnamectl
  2. hostnamectl will set the hostname in lowercase
  3. Azure Linux agent background process that monitors for hostname changes 5. The next time the monitoring occurs the agent see the difference between upper and lower case names and again calls sethostname which will call hostnamectl. This is a bit confusing because although the agent is using the cached ovf-env name the actual hostname is already lowercase at this point.

2017/04/27 14:47:28.524685 INFO EnvMonitor: Detected hostname change: TEST-LOWER -> test-lower

  1. Setting the hostname to a upper case value, manually or otherwise, using hostnamectl without --static will result in lower case static hostname

$ sudo hostnamectl status
Static hostname: test-lower
Pretty hostname: TEST-LOWER
Icon name: computer-vm
Chassis: vm
Machine ID: ade8768222574cb5a05e4d6ca79988c0
Boot ID: abe975d033db44dd868ae00c50534ec0
Virtualization: microsoft
Operating System: Red Hat Enterprise Linux Server 7.2 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.2:GA:server
Kernel: Linux 3.10.0-514.16.1.el7.x86_64

@brendandixon brendandixon added this to the v2.2.11 milestone May 1, 2017
@brendandixon
Copy link
Contributor

brendandixon added a commit that referenced this issue May 1, 2017
Enabled FIPS support and address #668.
Support mixed case hostnames on RedHat #686.
@brendandixon
Copy link
Contributor

Addressed by #690

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants