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

Feature Request: Encrypt file in-place #869

Open
Anuskuss opened this issue Sep 10, 2024 · 0 comments
Open

Feature Request: Encrypt file in-place #869

Anuskuss opened this issue Sep 10, 2024 · 0 comments

Comments

@Anuskuss
Copy link

Let's consider this file layout:

πŸ—€ /mnt/
β”œβ”€ πŸ—€ enc/
β”‚  β”œβ”€ πŸ—‹ gocryptfs.conf
β”‚  └─ πŸ—‹ gocryptfs.diriv
β”œβ”€ πŸ—€ dec/
└─ πŸ—‹ file
$ stat -c %w file
2024-09-10 00:00:00.000000000 +0000

Everything resides on the same file system. Now I mount enc at dec. I want to encrypt file so I mv file dec/. The issue with that is that file no loses it's btime because it has to be copied into dec, creating a new file which inherits every property except btime:

πŸ—€ /mnt/
β”œβ”€ πŸ—€ enc/
β”‚  β”œβ”€ πŸ—‹ gocryptfs.conf
β”‚  β”œβ”€ πŸ—‹ gocryptfs.diriv
β”‚  └─ πŸ—‹ tmQgCkoEOwR6t6gIHuLfbg
└─ πŸ—€ dec/
   └─ πŸ—‹ file
$ stat -c %w enc/tmQgCkoEOwR6t6gIHuLfbg
2024-09-10 00:00:01.000000000 +0000

What I'm asking for is the ability to retain all properties by encrypting the file in-place,

  • either always: Moving a file first checks if the file and the encrypted directory are on the same filesystem, then it "hijacks" the move by moving the file into the encrypted directory instead, encrypting it's data, renaming and then finally restoring the mtime
  • or via a new tool: gocryptfs-xray -encrypt file enc.sock which will encrypt and place the file into the root of the encrypted directory (it can then be moved freely in the decrypted directory)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant