TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Are there wrapper/runner programs that encrypt writes and decrypt reads?

6 pointsby wesamcoabout 1 year ago
Are there any wrapper programs that run a program and make the program transparently encrypt its writes and decrypt its reads?<p>i.e. with the program launched being oblivious to the fact that the file it is reading from and writing to, is in fact encrypted on disk (on top of a file system, what could be an unencrypted file system)<p>I&#x27;m specifically interested in being able to run a program with a wrapper program, type a password, and only that process that is started being able to read from and write to the file, transparently (I don&#x27;t want to use file permissions to limit which processes can read from or write to the file)<p>Oh and by the way, I know disk encryption file systems exist, I use LUKS, not really what I&#x27;m asking about.<p>I&#x27;ve done some searches and I was only able to find FUSE filesystems that can transparently encrypt files on top of a file system, they work by initializing a directory, to store the encrypted files in, and then mounting that directory to a FUSE filesystem mount point, a mount point where any process can access and read or write (if one doesn&#x27;t leverage file-system permissions, which is not what I&#x27;m looking for)<p>Here&#x27;s a useful page that talks about and compares these open-source file encryption solutions (gocryptfs, encfs, ecryptfs, cryptomator, securefs, CryFS): https:&#x2F;&#x2F;nuetzlich.net&#x2F;gocryptfs&#x2F;comparison&#x2F; (https:&#x2F;&#x2F;archive.is&#x2F;gMwpV)<p>Inspiration to think of using such a program came from reading about NixGL[1], a program that wraps and runs programs (programs installed with Nix on a distro that is not NixOS), to make OpenGL or Vulkan applications able to run and work on distros that are not NixOS, it works like this:<p><pre><code> $ nixGL program $ nixVulkan program </code></pre> I imagine this program does some things so the program it wraps&#x2F;runs correctly loads the right graphics driver libraries, something that&#x27;s not really analogous to changing the behavior of file-system operations (I think).<p>What would it take&#x2F;require to change the behavior of file-system operations&#x2F;syscalls&#x2F;APIs in a program (besides recompiling it)? syscalls or APIs like fopen(), write(), fsync(), fflush(), fclose(), FlushFileBuffers() (on Windows).<p>How can a program accomplish this? by using&#x2F;doing something like virtualization? emulation? syscall&#x2F;API translation? e.g. like WINE?<p><pre><code> [1] https:&#x2F;&#x2F;github.com&#x2F;nix-community&#x2F;nixGL</code></pre>

5 comments

cpachabout 1 year ago
I assume that in this scenario we don’t want to change the behaviour (program code, source code) of the application itself.<p>Why is it important that the syscalls (write et al) encrypts? (Even if they do so only under the hood.) Is it not sufficient that the application writes to a place that is encrypted?<p>It’s probably not impossible to modify the syscalls, but I think it would be vastly easier to let the outside system handle the encryption.<p><i>“I was only able to find FUSE filesystems that can transparently encrypt files on top of a file system”</i><p>I believe the reason that you mostly found such solutions is that they are much more “cost-effective” than implementing a system that operates on the syscall level.<p>If you need to ensure that the application writes only to the specific mountpoint you can probably use some kind of “jail” to achieve that. Here’s a decent starting point on that: <a href="https:&#x2F;&#x2F;blog.mnus.de&#x2F;2020&#x2F;05&#x2F;sandboxing-soldatserver-with-bubblewrap-and-seccomp&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.mnus.de&#x2F;2020&#x2F;05&#x2F;sandboxing-soldatserver-with-bu...</a> (assuming that the application runs on Linux)
solardevabout 1 year ago
Can&#x27;t you just run the program inside a VM of some sort and encrypt the whole image that way? I guess during runtime the contents in RAM won&#x27;t be encrypted, but when the image gets saved back to disk, it should be.<p>e.g. in Parallels, they have built-in AES-based password VM encryption: <a href="https:&#x2F;&#x2F;kb.parallels.com&#x2F;8832" rel="nofollow">https:&#x2F;&#x2F;kb.parallels.com&#x2F;8832</a><p>Or in VirtualBox: <a href="https:&#x2F;&#x2F;docs.oracle.com&#x2F;en&#x2F;virtualization&#x2F;virtualbox&#x2F;6.0&#x2F;admin&#x2F;diskencryption.html" rel="nofollow">https:&#x2F;&#x2F;docs.oracle.com&#x2F;en&#x2F;virtualization&#x2F;virtualbox&#x2F;6.0&#x2F;adm...</a>
评论 #40130853 未加载
nrdxpabout 1 year ago
You would have to be able to overwrite a syscall in userspace (which would be a massive security hole) or have some kinda kernel driver (but you said disk encryption doesn&#x27;t work for some odd reason, otherwise that&#x27;s your solution right there).<p>I guess, as you stated, you might be able to write a fuse application to do it, but I don&#x27;t see the benefit over just an encrypted disk.
评论 #40128510 未加载
评论 #40128669 未加载
helpfulfrondabout 1 year ago
FHE is interesting: <a href="https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Homomorphic_encryption" rel="nofollow">https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Homomorphic_encryption</a>
评论 #40130862 未加载
stop50about 1 year ago
Maybe something like ext4 transparent encryption?