Fix the hostname before requesting the certificate

Sometimes we see that the DHCP-supplied hostname is not the same as the
one specified in the profile, and this causes all sorts of problems.