问题描述
现在,我使用cryfs或gocryptfs加密某些数据。 该数据只能由指定的进程访问。 如果另一个进程要访问此数据,那么cryfs或gocryptfs只需将密文返回给该未经授权的进程。
libfuse是否支持此功能?或者有一些好的方法来了解哪个进程正在访问机密数据。
解决方法
libfuse通过以下调用提供当前的调用进程ID(除其他外):fuse_get_context()
返回的结构为:
struct fuse_context {
/** Pointer to the fuse object */
struct fuse *fuse;
/** User ID of the calling process */
uid_t uid;
/** Group ID of the calling process */
gid_t gid;
/** Process ID of the calling thread */
pid_t pid;
/** Private filesystem data */
void *private_data;
/** Umask of the calling process */
mode_t umask;
};