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

Validate Hosts File Entry #100

Open
JoelProminic opened this issue Oct 4, 2023 · 2 comments
Open

Validate Hosts File Entry #100

JoelProminic opened this issue Oct 4, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@JoelProminic
Copy link
Contributor

I went through Super.Human.Installer with @feather812002, and he ran into some trouble because the IP address changed for the VM, and he did not update the /etc/hosts file.

NOTE: Currently /etc/hosts is not updated automatically because we don't want to prompt the user for Administrator permissiones. If we change this later, this issue will probably be unnecessary.

My idea for this is:

  1. User creates or restarts server
  2. Vagrant scripts run. When they finish, they write some information to verify (at least the IP address)
  3. SHI updates the status
  4. SHI runs a check to verify that the hosts file is configured properly. This will normally fail when the server is first created, and it will also fail if the assigned IP address changed on a restart or recreate.
  5. SHI shows some instructions to update the hosts file. This could be as simple as pointing the user to the Welcome page

Some options for the status check

  • Do a simple regex against the hosts file to check for an entry for the domain
  • Do a ping or other lookup to check that the base domain resolves correctly. Note that a command or API like nslookup can bypass the hosts file, so this would not work.
  • Do validation against all entries or the full host file line

Here are some ideas for the data returned by the provisioner. If we want to support future provisioners, we would need a standardized format this output:

  • The current IP address. This should be sufficient for a basic test against the base domain. I think this is already returned
  • The expected subdomains - this can vary based on the provisioner or which roles the user enabled
  • The full hosts file line - this would be needed if we want to add full instructions in the SHI UI.

This isssue is not a high priority, and we could start with a simple implementation before adding some of the more complicated ideas above.

@JoelProminic JoelProminic added the enhancement New feature or request label Oct 4, 2023
@JoelProminic JoelProminic added this to the v0.8.21 milestone Oct 4, 2023
@JoelProminic
Copy link
Contributor Author

Also note that we recently found that there was a limit to the length of the hosts file lines, so the user could potentially need to add multiple lines. This will make it more difficult to verify the exact hosts file lines. We'll also need to keep this in mind if we want to display the expected hosts lines in the instructions.

@JoelProminic
Copy link
Contributor Author

Note that the changes to #120 should mean that we will be better able to detect IP changes that could require an update to the Hosts file.

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

No branches or pull requests

3 participants