Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using --digest option for 'digest authentication' with curl in linux

I am trying to change the date of an Onvif based camera using curl in linux. I have already succeded doing it in c# and using digest authentication, but I am stuck in this case.

I am using the following command:

curl -u "admin:admin" --digest http://10.104.37.1:80/onvif/device_service --data '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SetSystemDateAndTime xmlns="http://www.onvif.org/ver10/device/wsdl"><DateTimeType>Manual</DateTimeType><DaylightSavings>false</DaylightSavings><TimeZone><TZ xmlns="http://www.onvif.org/ver10/schema">CST-0:00:00</TZ></TimeZone><UTCDateTime><Time xmlns="http://www.onvif.org/ver10/schema"><Hour>8</Hour><Minute>8</Minute><Second>8</Second></Time><Date xmlns="http://www.onvif.org/ver10/schema"><Year>2008</Year><Month>8</Month><Day>8</Day></Date></UTCDateTime></SetSystemDateAndTime></s:Body></s:Envelope>'

And I am obtaining the following result (it seems to get stuck):

  • About to connect() to 10.104.37.1 port 80 (#0)
  • Trying 10.104.37.1... connected
  • Connected to 10.104.37.1 (10.104.37.1) port 80 (#0)
  • Server auth using Digest with user 'admin'
  • POST /onvif/device_service HTTP/1.1
  • User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
  • Host: 10.104.37.1
  • Accept: /
  • Content-Length: 0
  • Content-Type: application/x-www-form-urlencoded

After this, nothing happens.

I have to say that if I just read the date (this action does not need auth)...

curl -u admin:admin http://10.104.37.1:80/onvif/device_service --data '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetSystemDateAndTime xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>' 

...it does it correctly, but if I add the "--digest", the process follows the behaviour commented before.

Anyone can give me a hint?

Thanks!

EDIT: Isnt it strange that the content length=0?

like image 751
bilbinight Avatar asked Oct 18 '22 14:10

bilbinight


1 Answers

I have finally found a solution to this problem: I added the option --anyauth to the full command. Anyway, I still do not know why using --digest option stucks the process.

like image 57
bilbinight Avatar answered Oct 21 '22 06:10

bilbinight