|OS type and version:
||Ubuntu 18.04.6 LTS
On just a single server we have an issue where S3 backups are failing to upload. Virtualmin only responds with:
Uploading archive to Amazon's S3 service ..
.. upload failed!
Invalid HTTP response : HTTP/1.1 400 Bad Request Backup failed!
See the progress output above for the reason why.
Triple checked credentials and have tried with S3 encryption on and off.
Using the aws cli tool on command line works fine, but fails through Virtualmin.
We enabled debug logging in Webmin and could see that there were multiple TCP connections to AWS but the logs didn’t give anything of use.
The backup file is just 4MB so filesize shouldn’t cause any issues.
If you don’t use strftime as destination directory, does it change anything?
If you enable logging on S3 side, what do you get logged at the moment of running a backup?
With strftime off get the same.
REDACTED BUCKETNAME [18/Oct/2021:07:08:37 +0000] SERVERIP arn:aws:iam:REDACTED:user/REDACTED REDACTED REST.PUT.OBJECT PATH/TO/FILE "PUT /PATH/TO/FILE HTTP/1.1" 200 - - 1862 84 27 "-" "aws-cli/1.16.290 Python/3.6.9 Linux/4.15.0-159-generic botocore/1.13.26" - REDACTED SigV4 ECDHE-RSA-AES128-GCM-SHA256 AuthHeader BUCKETNAME.s3.eu-west-2.amazonaws.com TLSv1.2 -
REDACTED BUCKETNAME [18/Oct/2021:06:54:43 +0000] SERVERIP - REDACTED REST.PUT.OBJECT PATH/TO/FILE "PUT /PATH/TO/FILE HTTP/1.0" 400 InvalidRequest 324 - 3 - "-" "-" - REDACTED= SigV2 ECDHE-RSA-AES128-GCM-SHA256 AuthHeader BUCKETNAME.s3.eu-west-2.amazonaws.com TLSv1.2 -
Also have this logged followed by a couple of attempts at Virtualmin trying to delete the file off S3.
REDACTED BUCKETNAME [18/Oct/2021:06:53:13 +0000] SERVERIP - REDACTED REST.PUT.OBJECT /PATH/TO/FILE "PUT /PATH/TO/FILE HTTP/1.0" 301 PermanentRedirect 461 - 2 - "-" "-" - REDACTED - ECDHE-RSA-AES128-GCM-SHA256 - s3.amazonaws.com TLSv1.2 -
Obvious differences to me are CLI uses SigV4 and passes in the arn:aws:iam:REDACTED:user/REDACTED
Managed to find the problem.
Turns out that at some point Virtualmin had saved the wrong secret key in /root/.aws/credentials despite what has been put into the settings on the backup form which I guess is only used by the backup Perl script but when it uses the awscli that’s ignored and it uses the .aws/credentials file instead
so it was not the virtualmin fail, basically you really read it wrong.
Read what wrong? All the virtualmin files had the correct credentials showing.
At some point when creating a backup to S3, virtualmin must save the credentials in /root/.aws/credentials. I assume I pasted the access key in both key+secret at first then after updating the secret key virtualmin updated its own files but not the /.aws/credentials file.
Virtualmin should probably be updating the .aws/credentials file if details are changed within virtualmin.
as well said by me and makred your solution, in end of the day mistake was done on your end… you did saved wrong key, remember API just do what you want. and I thinking virtualmin API is going like 10 years straight… without issues. that was my 2pi for you. end of the day you realise that issue and was able to fix it without anyone…so correctly saying it was you not virtualmin
Your response comes off as rude and isn’t warranted. You had nothing useful to add so you didn’t need to comment.
And with regards to it not being a virtualmin problem, it is a problem. Virtualmin isn’t updating credentials, only saving on initial setting up. It also isn’t pulling through the error from S3 that credentials are wrong but just shows a 400 bad request error.
A user making a small mistake on set up shouldn’t be irreversible. Every other issue I’ve had with Virtualmin has been solvable through UI.
I’m not aware of anything to be offending towards you or others nor to be rude. if you feel offended or that I was rude to you please accept my apologies and I wish you could solve your issues here on forum. have pleasent day.
THANK YOU! This solved it for me. /root/.aws/credentials looked like this:
aws_access_key_id = MYACCESSKEY
aws_secret_access_key = MYACCESSKEY
aws_access_key_id = MYACCESSKEY
aws_secret_access_key = MYSECRETACCESSKEY
I copied the real secret access key into the first section and backing up to S3 now works. I don’t recall getting the secret access key wrong when I set it up (though it was a while ago) but it was certainly correct in Virtualmin.
I find it strange that I was getting an error message telling me to use AWS4-HMAC-SHA256 as opposed to an error that my secret key was wrong but at least it’s working.
This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.