tizbac / pmoxs3backuproxy

Proxy written in golang that will emulate a PBS server and work on one or more S3 buckets
GNU General Public License v3.0
55 stars 4 forks source link

How to use with external S3 server #12

Closed mmomjian closed 3 months ago

mmomjian commented 3 months ago

I have setup as following (running on a custom port, not 8007). I'm happy to provide an access/secret key for my Backblaze B2 instance for testing.

Error: create storage failed: s3pbs: error fetching datastores - 500 Internal Server Error (500)

PBS settings:

S3 proxy command: pmoxs3backuproxy -bind ':18491' -endpoint 's3.us-east-005.backblazeb2.com:443' -cert /certs/fullchain.pem -key /certs/privkey.pem -debug

Bucket: image

Key perms: 00.....02e s3-proxy-proxmox listAllBucketNames,listBuckets,readBuckets,listFiles,readFiles,writeFiles,readBucketEncryption,readBucketReplications

Logs (this is a result of trying to add twice)

2024/07/30 16:02:30 [INFO]Starting PBS api server on :18491 , upstream: s3.us-east-005.backblazeb2.com:443
2024/07/30 16:03:30 [DEBG]Request:/
2024/07/30 16:04:07 [DEBG]Request:/api2/json/access/ticket
2024/07/30 16:04:07 [DEBG]Accept-Encoding=gzip
2024/07/30 16:04:07 [DEBG]User-Agent=libwww-perl/6.68
2024/07/30 16:04:07 [DEBG]Content-Length=81
2024/07/30 16:04:07 [DEBG]Content-Type=application/x-www-form-urlencoded
2024/07/30 16:04:07 [DEBG]Te=deflate,gzip;q=0.3
2024/07/30 16:04:07 [DEBG]Keep-Alive=300
2024/07/30 16:04:07 [DEBG]Connection=Keep-Alive, TE
2024/07/30 16:04:07 [DEBG]{"data":{"CSRFPreventionToken":"3..23","ticket":"yCDC...rAKe","username":"00...02e@pbs"}}
2024/07/30 16:04:07 [DEBG]Request:/api2/json/admin/datastore
2024/07/30 16:04:07 [DEBG]List buckets
2024/07/30 16:04:12 [DEBG]Request:/api2/json/access/ticket
2024/07/30 16:04:12 [DEBG]Te=deflate,gzip;q=0.3
2024/07/30 16:04:12 [DEBG]Keep-Alive=300
2024/07/30 16:04:12 [DEBG]Connection=Keep-Alive, TE
2024/07/30 16:04:12 [DEBG]Accept-Encoding=gzip
2024/07/30 16:04:12 [DEBG]User-Agent=libwww-perl/6.68
2024/07/30 16:04:12 [DEBG]Content-Length=81
2024/07/30 16:04:12 [DEBG]Content-Type=application/x-www-form-urlencoded
2024/07/30 16:04:12 [DEBG]{"data":{"CSRFPreventionToken":"35h...h23","ticket":"HJ...UKb","username":"00...2e@pbs"}}
2024/07/30 16:04:12 [DEBG]Request:/api2/json/admin/datastore
2024/07/30 16:04:12 [DEBG]List buckets
abbbi commented 3 months ago

not sure if the used minio-go implementation is compatible to backblaze.. unfortunately the errors not printed/returned, you may want to retry with:

https://github.com/tizbac/pmoxs3backuproxy/pull/14/files

that should give a bit more information on whats wrong (maybe missing region settings or something like that)

mmomjian commented 3 months ago

The error is exactly as you suggest. I will try to build the SSL branch #15

2024/07/31 15:33:46 [INFO]Starting PBS api server on :18491 , upstream: s3.us-east-005.backblazeb2.com:443
2024/07/31 15:34:46 [DEBG]Request:/
2024/07/31 15:34:57 [DEBG]Request:/api2/json/access/ticket
2024/07/31 15:34:57 [DEBG]Content-Length=81
2024/07/31 15:34:57 [DEBG]Content-Type=application/x-www-form-urlencoded
2024/07/31 15:34:57 [DEBG]Te=deflate,gzip;q=0.3
2024/07/31 15:34:57 [DEBG]Keep-Alive=300
2024/07/31 15:34:57 [DEBG]Connection=Keep-Alive, TE
2024/07/31 15:34:57 [DEBG]Accept-Encoding=gzip
2024/07/31 15:34:57 [DEBG]User-Agent=libwww-perl/6.68
2024/07/31 15:34:57 [DEBG]{"data":{"CSRFPreventionToken":"35..23","ticket":"JDrs,,QP","username":"00..02e@pbs"}}
2024/07/31 15:34:57 [DEBG]Request:/api2/json/admin/datastore
2024/07/31 15:34:57 [DEBG]List buckets
2024/07/31 15:34:57 [ERR ]Failed to list buckets: <html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>nginx</center>
</body>
</html>
tizbac commented 3 months ago

Changes merged , confirmed working on PR