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

Mounting a password-protected 7z archive #141

Open
TadavomnisT opened this issue Aug 16, 2024 · 2 comments
Open

Mounting a password-protected 7z archive #141

TadavomnisT opened this issue Aug 16, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@TadavomnisT
Copy link

TadavomnisT commented Aug 16, 2024

Is it possible to use ratarmount to mount to a password-protected (encrypted) 7z archive?

I tried this:

ratarmount archive.7z mount-point

UPDATE: I also tried this:

ratarmount --password [PASSWORD] archive.7z mount-point

It makes a mount file, but it's not a valid file since no password was used.


PS: I'm trying to extract large 7z nested archives to get SomeFile.ext, like this:

OuterArchive.7z (200GB/Encrypted)
    └── InnerArchive.7z (200GB/Encrypted)
        ├── SomeFile.ext (1GB)
        └── ...

Please see this question for more info.

@mxmlnkn
Copy link
Owner

mxmlnkn commented Aug 21, 2024

Sorry for the late answer. I was on vacation.

Passwords should work the same way you pointed out. But, it seems that the underlying libarchive is missing password support for 7z files :(. I even documented it in the tests, which is good, because I did forget it:

    @staticmethod
    # 7z : libarchive.exception.ArchiveError: The file content is encrypted, but currently not supported
    #      (errno=-1, retcode=-30, archive_p=94443813387248)
    # RAR: libarchive.exception.ArchiveError: Unsupported block header size (was 4, max is 2)
    #      (errno=84, retcode=-30, archive_p=94443813892640)
    # Basically only ZIP has encryption support provided by libarchive, much less than I would have thought.
    # https://github.com/libarchive/libarchive/issues/579#issuecomment-118440525
    # @pytest.mark.parametrize("compression", ["7z", "rar", "zip"])
    @pytest.mark.parametrize('compression', ['zip'])
    def test_password(compression):

Missing feature can be reproduced with:

echo bar > foo
7z a -pPASSWORD foo.7z foo
ratarmount --password PASSWORD foo.7z mounted

Support for this should ideally be added to libarchive upstream. Alternatively, other 7z wrapper such as py7z could be used.

Error-handling on ratarmount side could be better though. For me, it showed the file lists, but when trying to access a file, I would get an Input/Output error. A helpful message only shows with ratarmount -f -d 3 ...

@mxmlnkn mxmlnkn added the enhancement New feature or request label Aug 21, 2024
@TadavomnisT
Copy link
Author

@mxmlnkn
Thanks for you time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants