Yesterday, I was setting up a new web server. On the management side of things, I decided to use the powerful combination of Webmin/Virtualmin.
When I first used Virtualmin back in the day (which was a Wednesday, by the way), the only cloud backup options available to use were Amazon’s S3 and RackSpace Cloud Files. At the time, Backblaze B2 (my preferred cloud storage provider) was still in its infancy and only provided the option to use their proprietary developed API.
Fast-forward to 2022, Virtualmin now allows ‘S3-compatible’ servers for backup and B2 now supports the S3 API.
The setup itself is pretty standard. Enter your Access Key, Secret Key, and the S3-compatible endpoint URL. Should be simple enough, right? After entering my B2 information, I navigated over to the ‘Amazon S3 Buckets’ page in an attempt to load my available buckets. That’s when the error came up.
One or more errors occurred listing your S3 buckets : Failed to list S3 buckets : The V2 signature authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256
Virtualmin
Well then.
The first thing I did was check the credentials I entered in the Virtualmin settings, which were correct. The next thing was a Google search which brought me to a ticket asking for a Virtualmin update to prevent this issue. This is where I learned they switched from using their own implementation to using the aws-cli tools already available. So I headed over to Amazon, downloaded the cli, and installed it. As an extra precaution, I also set the full path the tool in Virtualmin (System Settings > Virtualmin Configuration > Backup and Restore > Full path to aws command for S3 operations). For me, this was /usr/local/bin/aws
. “Surely that will fix it”, I thought. Nope!
It was then I had the thought that maybe I was focusing too much on the “Please use AWS4-HMAC-SHA256” portion of the error. So the next word that jumped out at me was “authorization” and, wouldn’t you know it: the stored credentials were wrong. In the Vurtualmin WebUI, everything was correct, but in the aws cli credentials file, the Application Key was also in the Secret Key value (for reference, the aws cli credentials file is normally located at /root/.aws/credentials
).
[001ed00000000000000000026] aws_access_key_id = 001ed00000000000000000026 aws_secret_access_key = K001S000000000000000000agjn4
Back to the Buckets List, and there were my B2 buckets.
So why did the wrong credentials show up in the ‘credentials’ file when the web interface showed the correct details? I have 2 guesses. Either:
As everything is now working correctly, combined with a lack of free time, I decided to forego diving deeper to investigate the exact cause.
When using Virtualmin and S3-compatible storage, you may receive the error message:
"One or more errors occurred listing your S3 buckets : Failed to list S3 buckets : The V2 signature authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256"
That same error might also have nothing to do with AWS4-HMAC-SHA256 (well, not specifically, and at least not in my case).
To reiterate the steps I took to correct this error:
/usr/local/bin/aws
‘) (sidenote: this step may not be needed, but it doesn’t hurt either)/root/.aws/credentials
‘).[<Application Key>] aws_access_key_id = <Application Key> aws_secret_access_key = <Secret Key>
After saving the credentials file, I was able to navigate to ‘Backups and Restore > Amazon S3 Buckets” and see my buckets listed correctly without the error.
While I was using Backblaze B2 and not AWS S3, I have no doubt the same steps will correct either platform (or any S3-compatible storage provider, really). Hopefully, this helps someone out there.