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

GPG encryption is not working #369

Open RegH3x opened 7 months ago

RegH3x commented 7 months ago

Hi, I'm trying to use the GPG crypt method, that was added here #201 .

This is not documented in the wiki, but I tried anyway as I saw it only ask for "user" option.

Version of phpbu: /usr/local/bin/phpbu.phar --version

phpbu 6.0.22 by Sebastian Feldmann and contributors.

My phpbu.xml:

<?xml version="1.0" encoding="UTF-8"?>
<phpbu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="http://schema.phpbu.de/6.0/phpbu.xsd">
  <backups>
    <backup name="TEST">
      <source type="tar">
        <option name="path" value="/XXX/test_bck"/>
        <option name="ignoreFailedRead" value="true"/>
      </source>
      <target dirname="TEST"
              filename="TEST-%Y%m%d-%H%i"
              compress="bzip2"/>
      <crypt type="gpg">
          <option name="user" value="master"/>
      </crypt>
      <cleanup type="capacity">
        <option name="size" value="1MB"/>
      </cleanup>
    </backup>
  </backups>
</phpbu>

My gpg key:

pub   rsa3072 2024-02-13 [SC]
      9387614B4534B51B9AB54C6D775600A8A8A2E37A
uid           [ultimate] master
sub   rsa3072 2024-02-13 [E]

Whena I run the phpbu with these options I get this error:

/usr/local/bin/phpbu.phar --configuration=phpbu_TEST.xml -v --debug

phpbu 6.0.22 by Sebastian Feldmann and contributors.

Runtime:       PHP 8.1.2-1ubuntu2.14
Configuration: /XXX/phpbu_TEST.xml

backup: [tar] *************************************************************
"/usr/bin/tar" --ignore-failed-read -jcf '/XXX/TEST-20240215-1341.bz2' -C '/XXX' 'test_bck'
ok

crypt: [gpg] **************************************************************
exception: Command failed:
  exit-code: 2
  message:   gpg: WARNING: no command supplied.  Trying to guess what you mean ...
gpg: processing message failed: Unknown system error

failed

Time: 1 second, Memory: 6.68MB

Exception 'RuntimeException' with message 'Command failed:
  exit-code: 2
  message:   gpg: WARNING: no command supplied.  Trying to guess what you mean ...
gpg: processing message failed: Unknown system error

'
in phar:///usr/local/bin/phpbu.phar/lib/sf-cli/Command/Runner/Simple.php:61

backup TEST: FAILED

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

FAILURE!
Backups: 1, failed Checks: 0, failed Crypts: 0, failed Syncs: 0, failed Cleanups: 0.

Can you tell me what I am doing wrong?

I need GPG because the output file are very big, only GPG can be used to encrypt and decrypt such large files.