diff --git a/tutorbackup/templates/backup/build/backup/Dockerfile b/tutorbackup/templates/backup/build/backup/Dockerfile index 80d5160..dbb4cb3 100644 --- a/tutorbackup/templates/backup/build/backup/Dockerfile +++ b/tutorbackup/templates/backup/build/backup/Dockerfile @@ -8,7 +8,7 @@ RUN curl -fsSL https://www.mongodb.org/static/pgp/server-4.2.asc | gpg --dearmor apt-get update && \ apt-get install -y --no-install-recommends default-mysql-client mongodb-org-tools && \ pip install --upgrade pip && \ - pip install boto3 click && \ + pip install boto3 tarsafe click && \ mkdir data backup COPY backup_services.py . diff --git a/tutorbackup/templates/backup/build/backup/restore_services.py b/tutorbackup/templates/backup/build/backup/restore_services.py index 781a45a..0657937 100755 --- a/tutorbackup/templates/backup/build/backup/restore_services.py +++ b/tutorbackup/templates/backup/build/backup/restore_services.py @@ -4,13 +4,13 @@ import os import shutil import sys -import tarfile from datetime import datetime from pathlib import Path from subprocess import check_call import click from botocore.exceptions import ClientError +from tarsafe import TarSafe ENV = os.environ @@ -98,7 +98,7 @@ def extract(file_name): logger.info(f"Extracting archive {file_name} to {out_dir}") try: - with tarfile.open(file_name, "r:xz") as tar: + with TarSafe.open(file_name, "r:xz") as tar: tar.extractall() except FileNotFoundError as e: logger.exception(e, exc_info=True)