rauc/rauc-hawkbit-updater

hawkbit URL regression

einoj opened this issue · 7 comments

einoj commented

I am unable use the new tags v1.0 and v1.1. I've identified the issue stemming from a regression caused by commit 8624e71

I had a look at the old code

int status = rest_request(GET, get_resource_url, NULL, &json_response_parser, error);

and the new
int status = rest_request(GET, deployment, NULL, &json_response_parser, error);

and printed the variables deployment in the new version and get_resource_url in the old version, and see that in the new deployment variable the domain name and TLD of the URL is missing.

(gdb) print deployment
$1 = (gchar *) 0xaaaaaabc7100 "http://hawkbit:8080/DEFAULT/controller/v1/TEST/deploymentBase/2065?c=-1956918325"  `
(gdb) print get_resource_url
$1 = (gchar *) 0xaaaaaaceb560 "https://hawkbit.mydomain.se/DEFAULT/controller/v1/TEST/deploymentBase/2065?c=-1956918325"

Hi,

please run rauc-hawkbit-updater with --debug. This should print the json responses from the server. I'd like to see the response to the base resource, similar to this example.

Wild guess: you're using some kind of HTTP proxy hawkBit does not know about.

Might be similar to #85.

einoj commented

Hi,

Thanks for the feedback. With the --debug flag running v1.1 I get the same result as with GDB

MESSAGE: Checking for new software...
DEBUG: Response body: {
  "config" : {
    "polling" : {
      "sleep" : "23:59:00"
    }
  },
  "_links" : {
    "deploymentBase" : {
      "href" : "http://hawkbit:8080/DEFAULT/controller/v1/TEST/deploymentBase/2137?c=-1956918325"
    }
  }
}
WARNING: Couldn't resolve host name

I'll have a look at the example and #85

einoj commented

with commit 8624e71 the error message is slightly different

MESSAGE: Checking for new software...
DEBUG: Response body: {
  "config" : {
    "polling" : {
      "sleep" : "23:59:00"
    }
  },
  "_links" : {
    "deploymentBase" : {
      "href" : "http://hawkbit:8080/DEFAULT/controller/v1/TEST/deploymentBase/2137?c=-1956918325"
    }
  }
}
DEBUG: Failed to get resource from hawkbit server. Status: 0
CRITICAL: Error: HTTP request failed: Couldn't resolve host name

And with the parent commit cbafe65 it works fine

MESSAGE: Checking for new software...
DEBUG: Response body: {
  "config" : {
    "polling" : {
      "sleep" : "23:59:00"
    }
  },
  "_links" : {
    "deploymentBase" : {
      "href" : "http://hawkbit:8080/DEFAULT/controller/v1/TEST/deploymentBase/2137?c=-1956918325"               
    }
  }                                                           
}                                                             
DEBUG: Response body: {                                       
  "id" : "2137",                     
  "deployment" : {        
    "download" : "forced",
    "update" : "forced",
    "chunks" : [             
      {       
        "part" : "os",
        "version" : "v1.2.3",
        "name" : "test-linux",
        "artifacts" : [  
          {      
            "filename" : "test-linux-delta.raucb",
            "hashes" : {
              "sha1" : "dcf25521b1ca54da339354bb98d25daab51d767e",                            
              "md5" : **"a8ce7ac760017c4bd7e3173f0ce6a6f30",**     
              "sha256" : "6bbf1a9ee6025a44974561cc63366e7b950503f71e44d694383f21ef9539163d"
            },                 
            "size" : 143726,              
            "_links" : {                           
              "download-http" : {
                "href" : "https://hawkbit.mydomain.se/DEFAULT/controller/v1/TEST/softwaremodules/294/artifacts/test-linux.raucb"    
              },
              "md5sum-http" : {
                "href" : "https://hawkbit.mydomain.se/DEFAULT/controller/v1/TEST/softwaremodules/294/artifacts/test-linux-delta.raucb.MD5SUM"
              }   
            }
          }
        ]
      }                                                       
    ]                                                         
  }                                                           
}                      

Okay, then this is expected behavior. rauc-hawkbit-updater queries the deploymentBase resource as advertised by your hawkBit instance. Quoting myself:

the depoymentBase URL is used as given by hawkBit since 8624e71. Before that the URL was handcrafted. In my opinion the correct way is to use the URLs as provided by hawkBit.

[1]

What makes hawkBit think that your instance is running on hawkbit:8080? If you fix your hawkBit configuration, rauc-hawkbit-updater will also work. I am not a hawkBit expert, but I assume that you can specify your FQDN and port somewhere.

Maybe someone who successfully fixed this should add a hint to the documentation on how to fix/configure this in hawkBit.

einoj commented

It was indeed the same issue as #85.
This was the fix: server.forward-headers-strategy=NATIVE along with setting the correct incoming "Host:" header.