Project

General

Profile

Actions

Bug #12754

closed
DP VG

Google Domains Dynamic DNS responses are not parsed properly

Bug #12754: Google Domains Dynamic DNS responses are not parsed properly

Added by Daniel Pontillo over 4 years ago. Updated about 4 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Viktor Gurov
Category:
Dynamic DNS
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
22.05
Release Notes:
Default
Affected Version:
2.5.2
Affected Architecture:
amd64

Description

When using Google Domains with the Dynamic DNS feature, it fails for Unknown Response. This is due to Google requiring POST requests to be of type Content-Type: application/x-www-form-urlencoded, and can be fixed by using URL encoded post parametrs.

/services_dyndns_edit.php: phpDynDNS (<domain>): (Unknown Response)

Here is code to fix it in /etc/inc/dyndns.class:

case 'googledomains':
  $needsIP = FALSE;
  $post_data['username:password'] = $this->_dnsUser . ':' . $this->_dnsPass;
  $post_data['hostname'] = $this->_dnsHost;
  $post_data['myip'] = $this->_dnsIP;
  $post_data['offline'] = 'no';
  $server = "https://domains.google.com/nic/update";
  $port = "";
  curl_setopt($ch, CURLOPT_URL, 'https://domains.google.com/nic/update');
  curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
  curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
  curl_setopt($ch, CURLOPT_USERAGENT, $this->_UserAgent);
  curl_setopt($ch, CURLOPT_POST,1);
  break;

To get around the issue, the main thing is changing the CURLOPT_POSTFIELDS value to be http_build_query($post_data) instead of just the $post_data Array. Doing this will force PHP's curl lib to use Content-Type: application/x-www-form-urlencoded... this fixes the issue with P3P and post requests. I threw in the USERAGENT also, since Google says we should use it.

VG Updated by Viktor Gurov over 4 years ago Actions #1

JP Updated by Jim Pingle over 4 years ago Actions #2

  • Status changed from New to Pull Request Review
  • Target version set to 2.7.0
  • Plus Target Version set to 22.05

DH Updated by Dakota Hourie over 4 years ago Actions #3

Thank you for this. I edited my /etc/inc/dyndns.class file with your code snippet and that resolved my same issue.

VG Updated by Viktor Gurov over 4 years ago Actions #4

  • Status changed from Pull Request Review to Feedback
  • % Done changed from 0 to 100

Applied in changeset commit:b5360f49fb3c1fdc36ebf13c20b68d4ff1e15fe6.

JP Updated by Jim Pingle over 4 years ago Actions #5

  • Subject changed from DynDNS fails with Unknown Response when uploading IP to Google Domains to Google Domains Dynamic DNS responses are not parsed properly

Updating subject for release notes.

JP Updated by Jim Pingle over 4 years ago Actions #6

  • Status changed from Feedback to Resolved

AN Updated by Alex Neihaus about 4 years ago Actions #7

FWIW, this fix didn't work for me (CE running 2.6).

Instead, I had to use the recommendation at https://forum.netgate.com/topic/169652/new-isp-dynamic-dns-is-not-updating/5

Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Dynamic DNS googledomains (HOSTNAME_REDACTED): _update() starting.
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header: HTTP/2 400
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header: content-type: text/html; charset=utf-8
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header: cache-control: no-cache, no-store, max-age=0, must-revalidate
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header: pragma: no-cache
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header: expires: Mon, 01 Jan 1990 00:00:00 GMT
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header: date: Fri, 22 Jul 2022 20:15:42 GMT
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header: p3p: CP="This is not a P3P policy! See g.co/p3phelp for more info."
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header: server: ESF
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header: x-xss-protection: 0
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header: x-content-type-options: nosniff
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header: set-cookie: NID=511=K5vZ-jHj5JeUlJ8PvKqNbRmkNVTncND9IdA2jP9Yff4wLa2SN1p0rrabZbe_gLulobe0rqiEwrpH88lRio3esD84SkS3JSE1xa_LaA5Hbh3--tE1RfPR6Ku8zG_txAth9dmRT7IHnmJIvJqj8R50cY8vcpjlvSOjsLA8Uf3jUAA; expires=Sat, 21-Jan-2023 20:15:42 GMT; path=/; domain=.google.com; HttpOnly
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header: alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header: accept-ranges: none
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header: vary: Accept-Encoding
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header:
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Response Header:
Jul 22 16:15:42 php-fpm 361
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: Dynamic DNS googledomains (HOSTNAME_REDACTED): _checkStatus() starting.
Jul 22 16:15:42 php-fpm 361
Jul 22 16:15:42 php-fpm 361 /services_dyndns.php: phpDynDNS (HOSTNAME_REDACTED): (Unknown Response)

Actions

Also available in: Atom