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

Adding a flag for RDNS domain #123

Open
Powerhamster opened this issue May 6, 2024 · 2 comments
Open

Adding a flag for RDNS domain #123

Powerhamster opened this issue May 6, 2024 · 2 comments

Comments

@Powerhamster
Copy link

Powerhamster commented May 6, 2024

I want to create whitelisting in our firewall for specific RDNS entries because I don't know the PrimaryIPv4 address of the machine that will be created.

Is it possible to add a flag for providing a domain that is used for the RDNS pointer?

I am a go newbie. Would something like this work?

func (d *Driver) setupRDNS() error {
	if d.RDNSDomain == "" {
		return nil
	}
	log.Infof("configuring RDNS ...")
	opts := hcloud.PrimaryIPChangeDNSPtrOpts{
		DNSPtr: d.MachineName + "." + d.RDNSDomain,
	}
	act, _, err := d.getClient().PrimaryIP.ChangeDNSPtr(context.Background(), opts)

	if err != nil {
		return fmt.Errorf("could not change DNS pointer: %w", err)
	}

	return d.waitForAction(act)
}
@JonasProgrammer
Copy link
Owner

Hi,

sorry for being gone for so long. Juding from just glaring a the code, I don't see why this should not work. I'll have a look.

@JonasProgrammer
Copy link
Owner

After a little bit of trying, I think, we need a bit more discussion here.

First of all, I dislike the idea of just giving a domain suffix and having the machine name hardcoded as the actual hostname. While this surely makes sense a lot of times, I feel like the user specifying it once more is much less of a hassle than providing a somewhat usable flag interface for the non-default case.
The much bigger problem I see is the fact you have to specify the IP you actually want to assign the PTR for. It is easy for the IPv4 case, but for IPv6 you can actually assign multiple RDNS ptrs to the same prefix. So the question is, should the user specify suffix-name pairs for the IPv6 case or actual IPs. If you do know the IP beforehand though, you already have an existing one configured and could just add the RDNS there.

In 2024, providing an IPv4-only solution is a step backward. But right now I cannot think of a nice interface that is actually intuitive and does not feel like two separate things.

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