Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't encrypt the local-tar metadata file, so it can be accessed with… #574

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions pghoard/basebackup/base.py
Expand Up @@ -721,6 +721,7 @@ def run_local_tar_basebackup(self, delta: bool = False, with_delta_stats: bool =
temp_dir=compressed_base,
files_to_backup=control_files,
file_type=FileType.Basebackup,
encrypt=False, # do not encrypt the metadata file
extra_metadata={
**self.metadata,
"end-time": backup_end_time,
Expand Down
9 changes: 5 additions & 4 deletions pghoard/basebackup/chunks.py
Expand Up @@ -138,7 +138,8 @@ def tar_one_file(
callback_queue: CallbackQueue,
file_type: FileType = FileType.Basebackup_chunk,
extra_metadata: Optional[Dict[str, Any]] = None,
delta_stats: Optional[DeltaStats] = None
delta_stats: Optional[DeltaStats] = None,
encrypt=True
) -> Tuple[str, int, int]:
start_time = time.monotonic()

Expand All @@ -148,7 +149,7 @@ def tar_one_file(
compression_algorithm=self.compression_data.algorithm,
compression_level=self.compression_data.level,
compression_threads=self.site_config["basebackup_compression_threads"],
rsa_public_key=self.encryption_data.rsa_public_key,
rsa_public_key=self.encryption_data.rsa_public_key if encrypt else None,
fileobj=raw_output_obj
) as output_obj:
with tarfile.TarFile(fileobj=output_obj, mode="w") as output_tar:
Expand All @@ -161,7 +162,7 @@ def tar_one_file(
os.link(raw_output_obj.name, chunk_path)

rohmufile.log_compression_result(
encrypted=bool(self.encryption_data.encryption_key_id),
encrypted=bool(self.encryption_data.encryption_key_id) if encrypt else False,
elapsed=time.monotonic() - start_time,
original_size=input_size,
result_size=result_size,
Expand All @@ -182,7 +183,7 @@ def tar_one_file(

metadata = {
"compression-algorithm": self.compression_data.algorithm,
"encryption-key-id": self.encryption_data.encryption_key_id,
"encryption-key-id": self.encryption_data.encryption_key_id if encrypt else None,
"format": BaseBackupFormat.v2,
"original-file-size": input_size,
"host": socket.gethostname(),
Expand Down