brianreumere / gandi-automatic-dns

Dynamic DNS shell script for Gandi
Other
100 stars 22 forks source link

Request header field is missing ':' separator. for Gandi Automatic DNS 0.3 #7

Closed datentod closed 9 years ago

datentod commented 9 years ago

[root@router ~/bin]# /root/bin/gad -v -i em1 -a MASKED -d MASKED -r "@" Activating version of the zonefile for domain MASKED...

openssl s_client output and domain.zone.version.set() method response:

HTTP/1.1 400 Bad Request Date: Sat, 24 Jan 2015 22:47:59 GMT Server: Apache/2.2.16 (Debian) mod_ssl/2.2.16 OpenSSL/0.9.8o mod_wsgi/3.3 Python/2.6.6 Vary: Accept-Encoding Content-Length: 329 Connection: close Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

400 Bad Request

Bad Request

Your browser sent a request that this server could not understand.
Request header field is missing ':' separator.

<?xml version="1.0"?>

Tried to update the following A records to MASKED: @

There is no error checking on the RPCs so check the web interface if you want to be sure the update was successful, or look at the methodResponse from domain.zone.version.set() above (a response of 1 means success). [root@router ~/bin]# [root@router ~/bin]# uname -a FreeBSDMASKED 10.1-RELEASE-p4 FreeBSD 10.1-RELEASE-p4 #0 36d7dec(releng/10.1)-dirty: Thu Jan 22 15:12:35 CST 2015 root@pfsense-22-amd64-builder:/usr/obj.amd64/usr/pfSensesrc/src/sys/pfSense_SMP.10 amd64 [root@router ~/bin]# openssl version OpenSSL 1.0.1k-freebsd 8 Jan 2015 [root@router ~/bin]# ifconfig em1 em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=4209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,VLAN_HWTSO> ether MASKED inet6 fe80::225:90ff:fe93:ea61%em1 prefixlen 64 scopeid 0x2 inet MASKED netmask 0xfffffe00 broadcast 255.255.255.255 nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL> media: Ethernet autoselect (1000baseT ) status: active [root@router ~/bin]#

brianreumere commented 9 years ago

Thanks for the bug report. I will do some testing with OpenSSL > 1.

brianreumere commented 9 years ago

I've tested with the same version of OpenSSL and am unable to reproduce this. Could you try again to see if it was perhaps an intermittent issue on Gandi's end?

datentod commented 9 years ago

Hi Brian,

Got same error.

brianreumere commented 9 years ago

Can you try the latest commit and use the new -e option? I'm curious what the XML looks like. I can reproduce the 400 response by not including a blank line after the headers and before the XML content, but the script should be including that blank line.

datentod commented 9 years ago

Here's the output. Let me know if you need unmasked output...

[2.2-RELEASE][root@router.MASKED]/root/bin: /root/bin/gad -e -v -i em1 -a MASKED -d MASKED -r "@" Initial flags:

apikey = MASKED domain = MASKED records = @ record_type = A ipregex = ([0-9].[0-9].[0-9].[0-9]_)

IP information:

ext_ip_method = ifconfig em1 ext_ip = MASKED

RPC call to methodName = domain.info

Sending XML-RPC message tmp_message =

POST /xmlrpc/ HTTP/1.0 User-Agent: Gandi Automatic DNS shell script/0.3 Host: rpc.gandi.net:443 Content-Type: text/xml Content-Length: 272 <?xml version="1.0"?>

domain.info _MASKED_ _MASKED_

zone_id =

RPC call to methodName = domain.zone.record.list

Sending XML-RPC message tmp_message =

POST /xmlrpc/ HTTP/1.0 User-Agent: Gandi Automatic DNS shell script/0.3 Host: rpc.gandi.net:443 Content-Type: text/xml Content-Length: 646 <?xml version="1.0"?>

domain.zone.record.list _MASKED_ 0 name @ type A

record = @ record_value = records_to_create = @ records_to_update =

RPC call to methodName = domain.zone.version.new

Sending XML-RPC message tmp_message =

POST /xmlrpc/ HTTP/1.0 User-Agent: Gandi Automatic DNS shell script/0.3 Host: rpc.gandi.net:443 Content-Type: text/xml Content-Length: 268 <?xml version="1.0"?>

domain.zone.version.new _MASKED_

new_version_id =

RPC call to methodName = domain.zone.record.add

Sending XML-RPC message tmp_message =

POST /xmlrpc/ HTTP/1.0 User-Agent: Gandi Automatic DNS shell script/0.3 Host: rpc.gandi.net:443 Content-Type: text/xml Content-Length: 773 <?xml version="1.0"?>

domain.zone.record.add _MASKED_ name @ type A value _MASKED_

HTTP/1.1 400 Bad Request Date: Mon, 26 Jan 2015 01:13:23 GMT Server: Apache/2.2.16 (Debian) mod_ssl/2.2.16 OpenSSL/0.9.8o mod_wsgi/3.3 Python/2.6.6 Vary: Accept-Encoding Content-Length: 329 Connection: close Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

400 Bad Request

Bad Request

Your browser sent a request that this server could not understand.
Request header field is missing ':' separator.

<?xml version="1.0"?>

Activating version of the zonefile for domain MASKED...

openssl s_client output and domain.zone.version.set() method response:

RPC call to methodName = domain.zone.version.set

Sending XML-RPC message tmp_message =

POST /xmlrpc/ HTTP/1.0 User-Agent: Gandi Automatic DNS shell script/0.3 Host: rpc.gandi.net:443 Content-Type: text/xml Content-Length: 326 <?xml version="1.0"?>

domain.zone.version.set _MASKED_

HTTP/1.1 400 Bad Request Date: Mon, 26 Jan 2015 01:13:24 GMT Server: Apache/2.2.16 (Debian) mod_ssl/2.2.16 OpenSSL/0.9.8o mod_wsgi/3.3 Python/2.6.6 Vary: Accept-Encoding Content-Length: 329 Connection: close Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

400 Bad Request

Bad Request

Your browser sent a request that this server could not understand.
Request header field is missing ':' separator.

<?xml version="1.0"?>

Tried to update the following A records to MASKED: @

There is no error checking on the RPCs so check the web interface if you want to be sure the update was successful, or look at the methodResponse from domain.zone.version.set() above (a response of 1 means success). [2.2-RELEASE][root@router.MASKED]/root/bin:

brianreumere commented 9 years ago

Interesting; it's missing the blank line between the headers and the XML content. I spun up a pfSense test box and still can't replicate it. Can you try running this?:

/bin/sh /root/bin/gad -e -v -i em1 -a MASKED -d MASKED -r "@"

I moved where the blank line is in the latest commit as well (not that it should really make a difference) so try that too.

datentod commented 9 years ago

Latest output from last commit. I tried with bash(4.3.33(0)-release (amd64-portbld-freebsd10.0)) as well, same error.

[2.2-RELEASE][root@router.MASKED]/root/bin: /bin/sh ./2 -e -v -i em1 -a MASKED -d MASKED -r "@" Initial flags:

apikey = MASKED domain = MASKED records = @ record_type = A ipregex = ([0-9].[0-9].[0-9].[0-9]_)

IP information:

ext_ip_method = ifconfig em1 ext_ip = MASKED

RPC call to methodName = domain.info

Sending XML-RPC message tmp_message =

POST /xmlrpc/ HTTP/1.0 User-Agent: Gandi Automatic DNS shell script/0.3 Host: rpc.gandi.net:443 Content-Type: text/xml Content-Length: 272 <?xml version="1.0"?>

domain.info _MASKED_ _MASKED_

zone_id =

RPC call to methodName = domain.zone.record.list

Sending XML-RPC message tmp_message =

POST /xmlrpc/ HTTP/1.0 User-Agent: Gandi Automatic DNS shell script/0.3 Host: rpc.gandi.net:443 Content-Type: text/xml Content-Length: 646 <?xml version="1.0"?>

domain.zone.record.list _MASKED_ 0 name @ type A

record = @ record_value = records_to_create = @ records_to_update =

RPC call to methodName = domain.zone.version.new

Sending XML-RPC message tmp_message =

POST /xmlrpc/ HTTP/1.0 User-Agent: Gandi Automatic DNS shell script/0.3 Host: rpc.gandi.net:443 Content-Type: text/xml Content-Length: 268 <?xml version="1.0"?>

domain.zone.version.new _MASKED_

new_version_id =

RPC call to methodName = domain.zone.record.add

Sending XML-RPC message tmp_message =

POST /xmlrpc/ HTTP/1.0 User-Agent: Gandi Automatic DNS shell script/0.3 Host: rpc.gandi.net:443 Content-Type: text/xml Content-Length: 773 <?xml version="1.0"?>

domain.zone.record.add _MASKED_ name @ type A value _MASKED_

HTTP/1.1 400 Bad Request Date: Mon, 26 Jan 2015 14:40:31 GMT Server: Apache/2.2.16 (Debian) mod_ssl/2.2.16 OpenSSL/0.9.8o mod_wsgi/3.3 Python/2.6.6 Vary: Accept-Encoding Content-Length: 329 Connection: close Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

400 Bad Request

Bad Request

Your browser sent a request that this server could not understand.
Request header field is missing ':' separator.

<?xml version="1.0"?>

Activating version of the zonefile for domain MASKED...

openssl s_client output and domain.zone.version.set() method response:

RPC call to methodName = domain.zone.version.set

Sending XML-RPC message tmp_message =

POST /xmlrpc/ HTTP/1.0 User-Agent: Gandi Automatic DNS shell script/0.3 Host: rpc.gandi.net:443 Content-Type: text/xml Content-Length: 326 <?xml version="1.0"?>

domain.zone.version.set _MASKED_

HTTP/1.1 400 Bad Request Date: Mon, 26 Jan 2015 14:40:32 GMT Server: Apache/2.2.16 (Debian) mod_ssl/2.2.16 OpenSSL/0.9.8o mod_wsgi/3.3 Python/2.6.6 Vary: Accept-Encoding Content-Length: 329 Connection: close Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

400 Bad Request

Bad Request

Your browser sent a request that this server could not understand.
Request header field is missing ':' separator.

<?xml version="1.0"?>

Tried to update the following A records to MASKED: @

There is no error checking on the RPCs so check the web interface if you want to be sure the update was successful, or look at the methodResponse from domain.zone.version.set() above (a response of 1 means success). [2.2-RELEASE][root@router.MASKED]/root/bin:

datentod commented 9 years ago

Works now with latest code. Thanks Brian.