pvizeli/securetar


Secure Tarfile library

License: Apache-2.0

Language: Python


Secure Tar

Secure Tarfile library

It's a streaming wrapper around python tarfile and allow secure handling files and support encryption.

with SecureTarFile("test.tar", "w") as tar_file:
        atomic_contents_add(
            tar_file,
            temp_orig,
            excludes=[],
            arcname=".",
        )

with SecureTarFile("test.tar", "w", b"AES128_KEY_SIZE") as tar_file:
        atomic_contents_add(
            tar_file,
            temp_orig,
            excludes=[],
            arcname=".",
        )

A common pattern is to create an outer uncompressed tarfile that contains a variety of inner tar files. This can be accomplished without writing out multiple files with the following pattern.

outer_secure_tar_file = SecureTarFile("pkg.tar", "w", gzip=False)
with outer_secure_tar_file as outer_tar_file:
    with outer_secure_tar_file.create_inner_tar(
        "./backup1.tar.gz", gzip=True
    ) as inner_tar_file:
        atomic_contents_add(
            inner_tar_file,
            path_1,
            excludes=[],
            arcname=".",
        )

    with outer_secure_tar_file.create_inner_tar(
        "./backup2.tar.gz", gzip=True
    ) as inner_tar_file:
        atomic_contents_add(
            inner_tar_file,
            path_2,
            excludes=[],
            arcname=".",
        )

Project Statistics

Sourcerank 6
Repository Size 95.7 KB
Stars 6
Forks 2
Watchers 4
Open issues 2
Dependencies 1
Contributors 4
Tags 5
Created
Last updated
Last pushed

Top Contributors See all

J. Nick Koston Stefan Agner dependabot[bot] Pascal Vizeli

Packages Referencing this Repo

securetar
Python module to handle tarfile backups.
Latest release 2024.2.1 - Updated - 6 stars

Recent Tags See all

2024.2.1 February 26, 2024
2024.2.0 February 12, 2024
2023.12.0 December 13, 2023
2023.3.0 March 31, 2023
2022.02.0 February 17, 2022

Something wrong with this page? Make a suggestion

Last synced: 2024-11-14 18:25:33 UTC

Login to resync this repository