Skip to content

Commit

Permalink
ddclient: T5144: Warn against configuration with broken IP lookup ser…
Browse files Browse the repository at this point in the history
…vice

We always enable HTTPS in ddclient configuration, however
`http://checkip.dyndns.org` is HTTP only and does not support HTTPS.
Warn the user if they are using this service.

Also, make `url` in `web-options` mandatory.
  • Loading branch information
indrajitr committed Dec 26, 2023
1 parent 3b6f2e3 commit 78beafe
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/conf_mode/dns_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import os

import re
from sys import exit

from vyos.base import Warning
Expand Down Expand Up @@ -103,6 +103,16 @@ def verify(dyndns):
raise ConfigError(f'"web-options" is applicable only when using HTTP(S) '
f'web request to obtain the IP address')

# Warn if using checkip.dyndns.org, as it does not support HTTPS
# See: https://github.com/ddclient/ddclient/issues/597
if 'web_options' in config:
if 'url' not in config['web_options']:
raise ConfigError(f'"url" in "web-options" {error_msg_req} '
f'with protocol "{config["protocol"]}"')
elif re.search("^(https?://)?checkip\.dyndns\.org", config['web_options']['url']):
Warning(f'"checkip.dyndns.org" does not support HTTPS requests for IP address '
f'lookup. Please use a different IP address lookup service.')

# RFC2136 uses 'key' instead of 'password'
if config['protocol'] != 'nsupdate' and 'password' not in config:
raise ConfigError(f'"password" {error_msg_req}')
Expand Down

0 comments on commit 78beafe

Please sign in to comment.