1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-06-14 23:44:58 +02:00

Enforce requiring repo-cipher-pass at config parse time.

This was not enforced at parse time because repo1-cipher-type could be passed on the command-line even in cases where encryption was not needed by the subprocess.

Filter repo-cipher-type so it is never passed on the command line.  If the subprocess does not have access to the passphrase then knowing the encryption type is useless anyway.
This commit is contained in:
David Steele
2019-06-05 11:43:17 -04:00
parent d7bd0c58cd
commit 6ff3325c77
7 changed files with 19 additions and 17 deletions

View File

@ -125,11 +125,9 @@ sub run
{
my $strStanzaEncrypt = 'test-encrypt';
$self->optionTestSet(CFGOPT_REPO_CIPHER_TYPE, CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC);
$self->configTestLoad(CFGCMD_ARCHIVE_PUSH);
# Encryption passphrase required when encryption type not 'none' (default)
$self->testException(sub {storageRepo({strStanza => $strStanzaEncrypt})}, ERROR_ASSERT, 'option ' .
cfgOptionName(CFGOPT_REPO_CIPHER_PASS) . ' is required');
$self->testException(
sub {$self->configTestLoad(CFGCMD_ARCHIVE_PUSH)}, ERROR_OPTION_REQUIRED,
'archive-push command requires option: repo1-cipher-pass');
# Set the encryption passphrase and confirm passphrase and type have been set in the storage object
$self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, 'x');