sebastianfeldmann / phpbu

PHP Backup Utility - Creates and encrypts database and file backups, syncs your backups to other servers or cloud services and assists you monitor your backup process
https://phpbu.de
Other
1.29k stars 110 forks source link

Google Drive crypt failing #376

Closed kleo closed 3 months ago

kleo commented 4 months ago

Good day! Trying out phpbu and I'm having trouble on syncing to Google Drive with crypt.

Same result when using SSL cert encryption

No issues on syncing without crypt.

phpbu --version
phpbu 6.0.23 by Sebastian Feldmann and contributors.
/opt/phpbu/config.json

{
  "verbose": true,
  "logging": [
    {
      "type": "json",
      "target": "/opt/phpbu/json.log"
    }
  ],
  "backups": [
    {
      "name": "<db>",
      "source": {
        "type": "mysqldump",
        "options": {
          "host": "<ip>",
          "databases": "<db>",
          "user": "<user>",
          "password": "<password>"
        }
      },
      "target": {
        "dirname": "/opt/phpbu",
        "filename": "mysql-%Y%m%d-%H%i.sql",
        "compress":"bzip2"
      },
      "crypt": {
        "type": "openssl",
        "options": {
          "password": "mySecretPassword",
          "algorithm": "aes-256-cbc"
        }
      },
      "syncs": [
        {
          "type": "googledrive",
          "options": {
            "secret": "config/google/secret.json",
            "access": "config/google/access.json",
            "parentId": "<parentId>"
          }
        }
      ],
      "cleanup": {
        "type": "Capacity",
        "options": {
          "size": "30G"
        }
      }
    }
  ]
}
phpbu --verbose --configuration=config.json
phpbu 6.0.23 by Sebastian Feldmann and contributors.

Runtime:       PHP 8.1.2-1ubuntu2.15
Configuration: /opt/phpbu/config.json

Time: 9 seconds, Memory: 6.00MB

Exception 'phpbu\App\Backup\Sync\Exception' with message 'Failed to parse Content-Range header.'
in /home/ubuntu/.config/composer/vendor/phpbu/phpbu/src/Backup/Sync/GoogleDrive.php:146

backup db: OK, but skipped or failed Crypts, Syncs or Cleanups!

          | executed | skipped | failed |
----------+----------+---------+--------+
 checks   |        0 |         |      0 |
 crypts   |        1 |       0 |      0 |
 syncs    |        1 |       0 |      1 |
 cleanups |        1 |       1 |      0 |
----------+----------+---------+--------+

WARNING, skipped|failed Crypts, Syncs or Cleanups!
Backups: 1, Crypts: 0|0, Syncs: 0|1, Cleanups: 1|0

File without crypt

-rw-rw-r-- 1 ubuntu ubuntu  810 Apr 25 14:56 mysql-20240425-1456.sql.bz2

File with crypt

-rw-rw-r-- 1 ubuntu ubuntu 1.2K Apr 25 14:58 mysql-20240425-1458.sql.bz2.enc
kleo commented 4 months ago

I tried mcrypt as the encryption option and syncs without any issue.

kleo commented 4 months ago

checked out https://github.com/sebastianfeldmann/phpbu/pull/373 and also tried out compress zstd. all good now. thanks @veebkolm!