1

When setting up an Apache server, it's obviously possible to allow connections from a specific IP address [/range].

I have a dynamic IP and I'm wondering, if I use a DDNS service, whether it's possible to allow connections if the incoming IP matches the current DDNS IP? I'm aware you could make a task to run every few minutes, ping and update the config file with the current IP address, but that would require a service restart which I'd like to avoid if possible.

1 Answer 1

1

The forward-dns directive seems to be what you're after. According to the docs, it

simply queries the DNS for the host name and allows a client if its IP matches. As a consequence, it will only work with host names, not domain names. However, as the reverse DNS is not used, it will work with clients which use a dynamic DNS service.

So you can specify something like

<Location / >
    Require forward-dns your.ddns.server
</Location>

and it will do a DNS query whenever a client connects, and denies the connection if it is not from the specified name. Two things to consider:

  1. The forward-dns directive is available from 2.4.19.
  2. Caching DNS servers can still cause some surprise.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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