wp-media / backwpup

BackWPup - WordPress Backup Plugin
https://backwpup.com
GNU General Public License v2.0
88 stars 35 forks source link

ERROR: Microsoft Azure API: Fail: Code: 400 Value: The account being accessed does not support http. #85

Closed the1bit closed 5 years ago

the1bit commented 5 years ago

Hi,

I am writing to ask your support regarding your BackWPUP plugin for wordpress.

I have been using it for ages and 1 week ago I had to made my Azure storage account safer. Therefore I denied http access on that. Since that I am facing the following issue during Wordpress backup:

1. Try sending backup to a Microsoft Azure (Blob) …
ERROR: Microsoft Azure API: Fail: Code: 400 Value: The account being accessed does not support http. details (if any): <?xml version="1.0" encoding="utf-8"?><Error><Code>AccountRequiresHttps</Code><Message>The account being accessed does not support http. RequestId:7f515ae9-f01e-003e-1560-ebd8aa000000 Time:2019-04-05T03:34:54.9779434Z</Message><AccountName>sarecovery</AccountName></Error>.
2. Try sending backup to a Microsoft Azure (Blob) …
ERROR: Microsoft Azure API: Fail: Code: 400 Value: The account being accessed does not support http. details (if any): <?xml version="1.0" encoding="utf-8"?><Error><Code>AccountRequiresHttps</Code><Message>The account being accessed does not support http. RequestId:7f515b17-f01e-003e-4260-ebd8aa000000 Time:2019-04-05T03:34:55.0540159Z</Message><AccountName>sarecovery</AccountName></Error>.
3. Try sending backup to a Microsoft Azure (Blob) …
ERROR: Microsoft Azure API: Fail: Code: 400 Value: The account being accessed does not support http. details (if any): <?xml version="1.0" encoding="utf-8"?><Error><Code>AccountRequiresHttps</Code><Message>The account being accessed does not support http. RequestId:7f515b3f-f01e-003e-6660-ebd8aa000000 Time:2019-04-05T03:34:55.1110706Z</Message><AccountName>sarecovery</AccountName></Error>.
ERROR: Step aborted: too many attempts!

It's 100% clear that your plugin wants to try to connect to Azure storage account with HTTP and not HTTPS.

Then I found this article: https://wordpress.org/support/topic/backwpup-v3-5-0-breaks-microsoft-azure-api-fail-code-400-value/

Unfortunately I use version 3.6.8 of your plugin and the fix does not work.

Finally I started an investigation in the code and I found the root cause of issue.

Line 222 in class-destination-msazure.php:

$blobRestProxy = WindowsAzure\Common\ServicesBuilder::getInstance()->createBlobService('DefaultEndpointsProtocol=http;AccountName=' . $job_object->job[ 'msazureaccname' ] . ';AccountKey=' . BackWPup_Encryption::decrypt( $job_object->job[ 'msazurekey' ] ) );

Here you use http as default protocol instead of https.

Now I fixed this line:

$blobRestProxy = WindowsAzure\Common\ServicesBuilder::getInstance()->createBlobService('DefaultEndpointsProtocol=https;AccountName=' . $job_object->job[ 'msazureaccname' ] . ';AccountKey=' . BackWPup_Encryption::decrypt( $job_object->job[ 'msazurekey' ] ) );

And now the backup works now.

Please review then implement this fix to code if you feel this is the real solution.

Thank you for your support in this matter.

Best Regards, Tibor

danielhuesken commented 5 years ago

Will be fixed with next update

the1bit commented 5 years ago

Thank you so much. :-)

jonpscutt commented 5 years ago

Great fix @the1bit

ghost commented 5 years ago

I'm experiencing this issue with version 3.6.9.

danielhuesken commented 5 years ago

@devdeer Should be fixed in 3.6.10 coming in the next days.