Infoblox’s global team of threat hunters uncovers a DNS operation with the ability to bypass traditional security measures and control the Great Firewall of China. Read about “Muddling Meerkat” and the many other threat actors discovered by Infoblox Threat Intel here.

API & Integration, DevOps,NetOps,SecOps

Reply

fileop?_function=restoredatabase fails with "Failed: Restore Database in Forced mode"

New Member
Posts: 3
4395     0

Hi,

 

I need some help with a database restore operation. I'm attempting to take a backup file taken from one server and restore it to another. The backup contains just a couple of zones and a few records.

I can successfully restore the backup file via the GUI, but it fails using the API,

 

I'm using PowerShell v6 running on mac.

 

 
$res = Invoke-RestMethod `
        -Uri "https://infobloxsvr/wapi/v2.6/fileop?_function=uploadinit" `
        -Method Post `
        -ContentType 'application/json' `
        -AllowUnencryptedAuthentication `
        -SkipCertificateCheck `
        -WebSession $authCookie2

$form = @{file = '@database.bak' }

Invoke-RestMethod `
        -Uri $res.url `
        -Method Post `
        -ContentType 'multipart/form-data' `
        -AllowUnencryptedAuthentication `
        -SkipCertificateCheck `
        -WebSession $authCookie2 `
        -Form $form

$token = ($res.token).replace("`n", "")
$data = "{""keep_grid_ip"": false, ""mode"": ""FORCED"",""token"": ""$token""}"


Invoke-WebRequest `
        -Uri "https://infobloxsvr/wapi/v2.6/fileop?_function=restoredatabase" `
        -Method Post `
        -ContentType 'application/json' `
        -AllowUnencryptedAuthentication `
        -SkipCertificateCheck `
        -WebSession $authCookie2 `
        -Body $data
 

 

This results in an error 

"Error": "AdmConDataError: None (IBDataError: IB.Data:Failed: Restore Database in Forced mode)",
"code": "Client.Ibap.Data",
"text": "Failed: Restore Database in Forced mode"

 

 I get the same error using Curl. It works fine using the GUI, so I know the backup file is OK.

Not sure where to go to troubleshoot this now. Any assistance you can give appreciated. 

Re: fileop?_function=restoredatabase fails with "Failed: Restore Database in Forced mode"

Moderator
Moderator
Posts: 289
4396     0

I'd reccomend turning on full debugging ("set debug all on" at the CLI) and try again. After you try, pull the support bundle from the gridmaster and take a look at /var/log/messages and other logfiles, to see if something sticks out.  It should tell you why it wasn't willing to complete the upgrade.

Re: fileop?_function=restoredatabase fails with "Failed: Restore Database in Forced mode"

New Member
Posts: 3
4396     0

Thanks for your reply MRichard.

Running 'set debug all on' gave me a bit more error information from the api call which gave me a clue as to where the issue was. It was in the file upload step, I think my form data wasn't quite right.

Re: fileop?_function=restoredatabase fails with "Failed: Restore Database in Forced mode"

New Member
Posts: 2
4396     0

Hi, I have exactly same issue. Did you managed to get it working?

Know anyone solution. I see a lot of discussion about this problem, but unfortunatelly I don't see any working solution. In my case I am using "NORMAL" mode and return message gives me error, which is:

{
"Error": "AdmConDataError: None (IBDataError: IB.Data:Restore Database : Grid Restore Failed - Extracting file failed, /storage/tmp/http_direct_file_io/req_id-UPLOAD-0115150156883218/errs)",
"code": "Client.Ibap.Data",
"text": "Restore Database : Grid Restore Failed - Extracting file failed, /storage/tmp/http_direct_file_io/req_id-UPLOAD-0115150156883218/errs"
}

 

 

I found out, that TOKEN looks weird. It includes a lot of "\n" characters, which looks suspicious.

I have used WAPI version 2.13.1 on NIOS 9.0.3

 

Thanks,

Michael.

Re: fileop?_function=restoredatabase fails with "Failed: Restore Database in Forced mode"

[ Edited ]
New Member
Posts: 2
4396     0
Hello Michael,

It seems like there's a problem with the file upload. Please ensure that no headers are used with the file upload block. In my Python script, I utilize the session class and directly employ requests to bypass headers from the session.

I have a functional Python script available. Check this out if you're interested:

https://github.com/Farseencbv/infoblox-python-scripts.git


Showing results for 
Search instead for 
Did you mean: 

Recommended for You