summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2017-03-11 08:47:44 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2017-03-11 08:47:44 -0500
commit912bbbeecd68e1931a034f527c33778521747f81 (patch)
tree57a27292d7985db23eb8c525f6acd482b0d5d779 /src
parentallow tmpfs for regular users for files in home directory (diff)
downloadfirejail-912bbbeecd68e1931a034f527c33778521747f81.tar.gz
firejail-912bbbeecd68e1931a034f527c33778521747f81.tar.zst
firejail-912bbbeecd68e1931a034f527c33778521747f81.zip
mount a tmpfs on top of ~/.cache directory by default
Diffstat (limited to 'src')
-rw-r--r--src/firejail/fs.c13
-rw-r--r--src/firejail/sandbox.c6
2 files changed, 19 insertions, 0 deletions
diff --git a/src/firejail/fs.c b/src/firejail/fs.c
index 801bde57c..cf96a01e4 100644
--- a/src/firejail/fs.c
+++ b/src/firejail/fs.c
@@ -237,6 +237,7 @@ static void globbing(OPERATION op, const char *pattern, const char *noblacklist[
237 237
238// blacklist files or directories by mounting empty files on top of them 238// blacklist files or directories by mounting empty files on top of them
239void fs_blacklist(void) { 239void fs_blacklist(void) {
240printf("here: start fs_blacklist\n");
240 char *homedir = cfg.homedir; 241 char *homedir = cfg.homedir;
241 assert(homedir); 242 assert(homedir);
242 ProfileEntry *entry = cfg.profile; 243 ProfileEntry *entry = cfg.profile;
@@ -479,8 +480,19 @@ void fs_mnt(void) {
479 disable_file(BLACKLIST_FILE, "//run/media"); 480 disable_file(BLACKLIST_FILE, "//run/media");
480} 481}
481 482
483
484void fs_cache(void) {
485printf("here: deploy ~/.cache tmpfs\n");
486 char *cache;
487 if (asprintf(&cache, "%s/.cache", cfg.homedir) == -1)
488 errExit("asprintf");
489 disable_file(MOUNT_TMPFS, cache);
490 free(cache);
491}
492
482// mount /proc and /sys directories 493// mount /proc and /sys directories
483void fs_proc_sys_dev_boot(void) { 494void fs_proc_sys_dev_boot(void) {
495printf("here: fs_proc_sys_boot\n");
484 if (arg_debug) 496 if (arg_debug)
485 printf("Remounting /proc and /proc/sys filesystems\n"); 497 printf("Remounting /proc and /proc/sys filesystems\n");
486 if (mount("proc", "/proc", "proc", MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_REC, NULL) < 0) 498 if (mount("proc", "/proc", "proc", MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_REC, NULL) < 0)
@@ -618,6 +630,7 @@ static void disable_config(void) {
618 630
619// build a basic read-only filesystem 631// build a basic read-only filesystem
620void fs_basic_fs(void) { 632void fs_basic_fs(void) {
633printf("here: start fs_basic_fs\n");
621 uid_t uid = getuid(); 634 uid_t uid = getuid();
622 635
623 if (arg_debug) 636 if (arg_debug)
diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c
index 83afff516..f517316ed 100644
--- a/src/firejail/sandbox.c
+++ b/src/firejail/sandbox.c
@@ -771,6 +771,12 @@ int sandbox(void* sandbox_arg) {
771 fs_mnt(); 771 fs_mnt();
772 772
773 //**************************** 773 //****************************
774 // deploy a tmpfs on ~/.cache directory
775 //****************************
776 fs_cache();
777
778
779 //****************************
774 // apply the profile file 780 // apply the profile file
775 //**************************** 781 //****************************
776 // apply all whitelist commands ... 782 // apply all whitelist commands ...