0

I'm having an issue relating to host names and SSL signing. The certificate signing process works fine if my host name is puppet. With the IP of the puppet master server being set in /etc/hosts.

I don't want to use the IP as it will likely change and I'll have to update /etc/hosts again.

Instead I point directly to the url but this causes additional issues relating to inconsistency in certificate names.

Is there anyway to set a host to url? E.g. something like the following in /etc/hosts:

example.com puppet
8
  • That's not an URL. The format of that file should be ip-address hostname alias(es).
    – Kusalananda
    May 31, 2017 at 18:25
  • 2
    No, /etc/hosts is used specifically to assign an IP address to a given set of hostnames.
    – DopeGhoti
    May 31, 2017 at 18:26
  • 1
    Just use DNS instead. May 31, 2017 at 18:29
  • @SatoKatsura can I do this to associate local host name puppet with a url? May 31, 2017 at 18:30
  • 2
    Not until you understand what DNS does. May 31, 2017 at 18:31

1 Answer 1

4

Is there anyway to set a host to url? E.g. something like the following in /etc/hosts

That is not a URL. Its a hostname. The point of the /etc/hosts file is that it provides and alternative to DNS for resolving hostnames to addresses.

The files nameservice (the bit of code that sits between your application and the /etc/hosts file) does not support this.

If you have your own nameserver then you could setup a CNAME record pointing the name puppet to example,com

Alternatively you could write a script to capture the DNS address of example.com and append it to a template to create the hosts file (at boot up or at intervals).

Or just fix your certificates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.