aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2015-11-14 13:20:47 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2015-11-14 13:20:47 -0500
commitd3cbab9b3cf9bdfc0af94830fa2b7b373f7f66de (patch)
tree15f63a41ca510caea6dbf1951f74c1e9c209b9db
parentfirefox profile (diff)
downloadfirejail-d3cbab9b3cf9bdfc0af94830fa2b7b373f7f66de.tar.gz
firejail-d3cbab9b3cf9bdfc0af94830fa2b7b373f7f66de.tar.zst
firejail-d3cbab9b3cf9bdfc0af94830fa2b7b373f7f66de.zip
fixed sysconfdir
-rw-r--r--Makefile.in92
-rwxr-xr-xconfigure8
-rw-r--r--configure.ac8
-rwxr-xr-xmketc.sh18
-rw-r--r--src/firejail/Makefile.in4
-rw-r--r--src/firejail/main.c4
-rw-r--r--src/firejail/profile.c2
-rw-r--r--src/firejail/restricted_shell.c6
8 files changed, 91 insertions, 51 deletions
diff --git a/Makefile.in b/Makefile.in
index bcf9d613f..65f43884b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -8,9 +8,7 @@ bindir=@bindir@
8libdir=@libdir@ 8libdir=@libdir@
9datarootdir=@datarootdir@ 9datarootdir=@datarootdir@
10mandir=@mandir@ 10mandir=@mandir@
11# todo: fix sysconfdir 11sysconfdir=@sysconfdir@
12# sysconfdir=@sysconfdir@
13sysconfdir=/etc
14 12
15VERSION=@PACKAGE_VERSION@ 13VERSION=@PACKAGE_VERSION@
16NAME=@PACKAGE_NAME@ 14NAME=@PACKAGE_NAME@
@@ -72,51 +70,53 @@ realinstall:
72 install -c -m 0644 README $(DESTDIR)/$(DOCDIR)/. 70 install -c -m 0644 README $(DESTDIR)/$(DOCDIR)/.
73 install -c -m 0644 RELNOTES $(DESTDIR)/$(DOCDIR)/. 71 install -c -m 0644 RELNOTES $(DESTDIR)/$(DOCDIR)/.
74 # etc files 72 # etc files
73 ./mketc.sh $(sysconfdir)
75 mkdir -p $(DESTDIR)/$(sysconfdir)/firejail 74 mkdir -p $(DESTDIR)/$(sysconfdir)/firejail
76 install -c -m 0644 etc/audacious.profile $(DESTDIR)/$(sysconfdir)/firejail/. 75 install -c -m 0644 .etc/audacious.profile $(DESTDIR)/$(sysconfdir)/firejail/.
77 install -c -m 0644 etc/clementine.profile $(DESTDIR)/$(sysconfdir)/firejail/. 76 install -c -m 0644 .etc/clementine.profile $(DESTDIR)/$(sysconfdir)/firejail/.
78 install -c -m 0644 etc/gnome-mplayer.profile $(DESTDIR)/$(sysconfdir)/firejail/. 77 install -c -m 0644 .etc/gnome-mplayer.profile $(DESTDIR)/$(sysconfdir)/firejail/.
79 install -c -m 0644 etc/rhythmbox.profile $(DESTDIR)/$(sysconfdir)/firejail/. 78 install -c -m 0644 .etc/rhythmbox.profile $(DESTDIR)/$(sysconfdir)/firejail/.
80 install -c -m 0644 etc/totem.profile $(DESTDIR)/$(sysconfdir)/firejail/. 79 install -c -m 0644 .etc/totem.profile $(DESTDIR)/$(sysconfdir)/firejail/.
81 install -c -m 0644 etc/firefox.profile $(DESTDIR)/$(sysconfdir)/firejail/. 80 install -c -m 0644 .etc/firefox.profile $(DESTDIR)/$(sysconfdir)/firejail/.
82 install -c -m 0644 etc/icedove.profile $(DESTDIR)/$(sysconfdir)/firejail/. 81 install -c -m 0644 .etc/icedove.profile $(DESTDIR)/$(sysconfdir)/firejail/.
83 install -c -m 0644 etc/iceweasel.profile $(DESTDIR)/$(sysconfdir)/firejail/. 82 install -c -m 0644 .etc/iceweasel.profile $(DESTDIR)/$(sysconfdir)/firejail/.
84 install -c -m 0644 etc/midori.profile $(DESTDIR)/$(sysconfdir)/firejail/. 83 install -c -m 0644 .etc/midori.profile $(DESTDIR)/$(sysconfdir)/firejail/.
85 install -c -m 0644 etc/evince.profile $(DESTDIR)/$(sysconfdir)/firejail/. 84 install -c -m 0644 .etc/evince.profile $(DESTDIR)/$(sysconfdir)/firejail/.
86 install -c -m 0644 etc/chromium-browser.profile $(DESTDIR)/$(sysconfdir)/firejail/. 85 install -c -m 0644 .etc/chromium-browser.profile $(DESTDIR)/$(sysconfdir)/firejail/.
87 install -c -m 0644 etc/chromium.profile $(DESTDIR)/$(sysconfdir)/firejail/. 86 install -c -m 0644 .etc/chromium.profile $(DESTDIR)/$(sysconfdir)/firejail/.
88 install -c -m 0644 etc/google-chrome.profile $(DESTDIR)/$(sysconfdir)/firejail/. 87 install -c -m 0644 .etc/google-chrome.profile $(DESTDIR)/$(sysconfdir)/firejail/.
89 install -c -m 0644 etc/disable-mgmt.inc $(DESTDIR)/$(sysconfdir)/firejail/. 88 install -c -m 0644 .etc/disable-mgmt.inc $(DESTDIR)/$(sysconfdir)/firejail/.
90 install -c -m 0644 etc/disable-secret.inc $(DESTDIR)/$(sysconfdir)/firejail/. 89 install -c -m 0644 .etc/disable-secret.inc $(DESTDIR)/$(sysconfdir)/firejail/.
91 install -c -m 0644 etc/disable-common.inc $(DESTDIR)/$(sysconfdir)/firejail/. 90 install -c -m 0644 .etc/disable-common.inc $(DESTDIR)/$(sysconfdir)/firejail/.
92 install -c -m 0644 etc/dropbox.profile $(DESTDIR)/$(sysconfdir)/firejail/. 91 install -c -m 0644 .etc/dropbox.profile $(DESTDIR)/$(sysconfdir)/firejail/.
93 install -c -m 0644 etc/opera.profile $(DESTDIR)/$(sysconfdir)/firejail/. 92 install -c -m 0644 .etc/opera.profile $(DESTDIR)/$(sysconfdir)/firejail/.
94 install -c -m 0644 etc/thunderbird.profile $(DESTDIR)/$(sysconfdir)/firejail/. 93 install -c -m 0644 .etc/thunderbird.profile $(DESTDIR)/$(sysconfdir)/firejail/.
95 install -c -m 0644 etc/transmission-gtk.profile $(DESTDIR)/$(sysconfdir)/firejail/. 94 install -c -m 0644 .etc/transmission-gtk.profile $(DESTDIR)/$(sysconfdir)/firejail/.
96 install -c -m 0644 etc/transmission-qt.profile $(DESTDIR)/$(sysconfdir)/firejail/. 95 install -c -m 0644 .etc/transmission-qt.profile $(DESTDIR)/$(sysconfdir)/firejail/.
97 install -c -m 0644 etc/vlc.profile $(DESTDIR)/$(sysconfdir)/firejail/. 96 install -c -m 0644 .etc/vlc.profile $(DESTDIR)/$(sysconfdir)/firejail/.
98 install -c -m 0644 etc/deluge.profile $(DESTDIR)/$(sysconfdir)/firejail/. 97 install -c -m 0644 .etc/deluge.profile $(DESTDIR)/$(sysconfdir)/firejail/.
99 install -c -m 0644 etc/qbittorrent.profile $(DESTDIR)/$(sysconfdir)/firejail/. 98 install -c -m 0644 .etc/qbittorrent.profile $(DESTDIR)/$(sysconfdir)/firejail/.
100 install -c -m 0644 etc/generic.profile $(DESTDIR)/$(sysconfdir)/firejail/. 99 install -c -m 0644 .etc/generic.profile $(DESTDIR)/$(sysconfdir)/firejail/.
101 install -c -m 0644 etc/pidgin.profile $(DESTDIR)/$(sysconfdir)/firejail/. 100 install -c -m 0644 .etc/pidgin.profile $(DESTDIR)/$(sysconfdir)/firejail/.
102 install -c -m 0644 etc/xchat.profile $(DESTDIR)/$(sysconfdir)/firejail/. 101 install -c -m 0644 .etc/xchat.profile $(DESTDIR)/$(sysconfdir)/firejail/.
103 install -c -m 0644 etc/empathy.profile $(DESTDIR)/$(sysconfdir)/firejail/. 102 install -c -m 0644 .etc/empathy.profile $(DESTDIR)/$(sysconfdir)/firejail/.
104 install -c -m 0644 etc/server.profile $(DESTDIR)/$(sysconfdir)/firejail/. 103 install -c -m 0644 .etc/server.profile $(DESTDIR)/$(sysconfdir)/firejail/.
105 install -c -m 0644 etc/icecat.profile $(DESTDIR)/$(sysconfdir)/firejail/. 104 install -c -m 0644 .etc/icecat.profile $(DESTDIR)/$(sysconfdir)/firejail/.
106 install -c -m 0644 etc/quassel.profile $(DESTDIR)/$(sysconfdir)/firejail/. 105 install -c -m 0644 .etc/quassel.profile $(DESTDIR)/$(sysconfdir)/firejail/.
107 install -c -m 0644 etc/deadbeef.profile $(DESTDIR)/$(sysconfdir)/firejail/. 106 install -c -m 0644 .etc/deadbeef.profile $(DESTDIR)/$(sysconfdir)/firejail/.
108 install -c -m 0644 etc/filezilla.profile $(DESTDIR)/$(sysconfdir)/firejail/. 107 install -c -m 0644 .etc/filezilla.profile $(DESTDIR)/$(sysconfdir)/firejail/.
109 install -c -m 0644 etc/fbreader.profile $(DESTDIR)/$(sysconfdir)/firejail/. 108 install -c -m 0644 .etc/fbreader.profile $(DESTDIR)/$(sysconfdir)/firejail/.
110 install -c -m 0644 etc/spotify.profile $(DESTDIR)/$(sysconfdir)/firejail/. 109 install -c -m 0644 .etc/spotify.profile $(DESTDIR)/$(sysconfdir)/firejail/.
111 install -c -m 0644 etc/steam.profile $(DESTDIR)/$(sysconfdir)/firejail/. 110 install -c -m 0644 .etc/steam.profile $(DESTDIR)/$(sysconfdir)/firejail/.
112 install -c -m 0644 etc/skype.profile $(DESTDIR)/$(sysconfdir)/firejail/. 111 install -c -m 0644 .etc/skype.profile $(DESTDIR)/$(sysconfdir)/firejail/.
113 install -c -m 0644 etc/wine.profile $(DESTDIR)/$(sysconfdir)/firejail/. 112 install -c -m 0644 .etc/wine.profile $(DESTDIR)/$(sysconfdir)/firejail/.
114 install -c -m 0644 etc/disable-devel.inc $(DESTDIR)/$(sysconfdir)/firejail/. 113 install -c -m 0644 .etc/disable-devel.inc $(DESTDIR)/$(sysconfdir)/firejail/.
115 install -c -m 0644 etc/conkeror.profile $(DESTDIR)/$(sysconfdir)/firejail/. 114 install -c -m 0644 .etc/conkeror.profile $(DESTDIR)/$(sysconfdir)/firejail/.
116 install -c -m 0644 etc/unbound.profile $(DESTDIR)/$(sysconfdir)/firejail/. 115 install -c -m 0644 .etc/unbound.profile $(DESTDIR)/$(sysconfdir)/firejail/.
117 install -c -m 0644 etc/dnscrypt-proxy.profile $(DESTDIR)/$(sysconfdir)/firejail/. 116 install -c -m 0644 .etc/dnscrypt-proxy.profile $(DESTDIR)/$(sysconfdir)/firejail/.
118 install -c -m 0644 etc/whitelist-common.inc $(DESTDIR)/$(sysconfdir)/firejail/. 117 install -c -m 0644 .etc/whitelist-common.inc $(DESTDIR)/$(sysconfdir)/firejail/.
119 bash -c "if [ ! -f $(DESTDIR)/$(sysconfdir)/firejail/login.users ]; then install -c -m 0644 etc/login.users $(DESTDIR)/$(sysconfdir)/firejail/.; fi;" 118 bash -c "if [ ! -f $(DESTDIR)/$(sysconfdir)/firejail/login.users ]; then install -c -m 0644 etc/login.users $(DESTDIR)/$(sysconfdir)/firejail/.; fi;"
119 rm -fr .etc
120 # man pages 120 # man pages
121 rm -f firejail.1.gz 121 rm -f firejail.1.gz
122 gzip -9n firejail.1 122 gzip -9n firejail.1
diff --git a/configure b/configure
index 3e3676f40..fe05f2a80 100755
--- a/configure
+++ b/configure
@@ -3558,6 +3558,11 @@ fi
3558 3558
3559 3559
3560 3560
3561# set sysconfdir
3562if test "$prefix" = /usr; then
3563 sysconfdir="/etc"
3564fi
3565
3561ac_config_files="$ac_config_files Makefile src/lib/Makefile src/firejail/Makefile src/firemon/Makefile src/libtrace/Makefile src/ftee/Makefile" 3566ac_config_files="$ac_config_files Makefile src/lib/Makefile src/firejail/Makefile src/firemon/Makefile src/libtrace/Makefile src/ftee/Makefile"
3562 3567
3563cat >confcache <<\_ACEOF 3568cat >confcache <<\_ACEOF
@@ -4731,9 +4736,12 @@ fi
4731echo 4736echo
4732echo "Configuration options:" 4737echo "Configuration options:"
4733echo " prefix: $prefix" 4738echo " prefix: $prefix"
4739echo " sysconfdir: $sysconfdir"
4734echo " seccomp: $HAVE_SECCOMP" 4740echo " seccomp: $HAVE_SECCOMP"
4735echo " <linux/seccomp.h>: $HAVE_SECCOMP_H" 4741echo " <linux/seccomp.h>: $HAVE_SECCOMP_H"
4736echo " chroot: $HAVE_CHROOT" 4742echo " chroot: $HAVE_CHROOT"
4737echo " bind: $HAVE_BIND" 4743echo " bind: $HAVE_BIND"
4738echo " fatal warnings: $HAVE_FATAL_WARNINGS" 4744echo " fatal warnings: $HAVE_FATAL_WARNINGS"
4739echo 4745echo
4746
4747
diff --git a/configure.ac b/configure.ac
index 589451cab..f7db96ee7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,14 +47,22 @@ AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed
47AC_CHECK_HEADER([linux/seccomp.h], HAVE_SECCOMP_H="-DHAVE_SECCOMP_H", HAVE_SECCOMP_H="") 47AC_CHECK_HEADER([linux/seccomp.h], HAVE_SECCOMP_H="-DHAVE_SECCOMP_H", HAVE_SECCOMP_H="")
48AC_SUBST(HAVE_SECCOMP_H) 48AC_SUBST(HAVE_SECCOMP_H)
49 49
50# set sysconfdir
51if test "$prefix" = /usr; then
52 sysconfdir="/etc"
53fi
54
50AC_OUTPUT(Makefile src/lib/Makefile src/firejail/Makefile src/firemon/Makefile src/libtrace/Makefile src/ftee/Makefile) 55AC_OUTPUT(Makefile src/lib/Makefile src/firejail/Makefile src/firemon/Makefile src/libtrace/Makefile src/ftee/Makefile)
51 56
52echo 57echo
53echo "Configuration options:" 58echo "Configuration options:"
54echo " prefix: $prefix" 59echo " prefix: $prefix"
60echo " sysconfdir: $sysconfdir"
55echo " seccomp: $HAVE_SECCOMP" 61echo " seccomp: $HAVE_SECCOMP"
56echo " <linux/seccomp.h>: $HAVE_SECCOMP_H" 62echo " <linux/seccomp.h>: $HAVE_SECCOMP_H"
57echo " chroot: $HAVE_CHROOT" 63echo " chroot: $HAVE_CHROOT"
58echo " bind: $HAVE_BIND" 64echo " bind: $HAVE_BIND"
59echo " fatal warnings: $HAVE_FATAL_WARNINGS" 65echo " fatal warnings: $HAVE_FATAL_WARNINGS"
60echo 66echo
67
68
diff --git a/mketc.sh b/mketc.sh
new file mode 100755
index 000000000..7b86a69e4
--- /dev/null
+++ b/mketc.sh
@@ -0,0 +1,18 @@
1#!/bin/bash
2rm -fr .etc
3mkdir .etc
4
5result=$(echo $1 | sed 's/\//\\\//g')
6echo $result
7
8FILES=`ls etc/*.profile`
9for file in $FILES
10do
11 sed "s/\/etc/$result/g" $file > .$file
12done
13
14FILES=`ls etc/*.inc`
15for file in $FILES
16do
17 sed "s/\/etc/$result/g" $file > .$file
18done
diff --git a/src/firejail/Makefile.in b/src/firejail/Makefile.in
index 255784ac7..c2663f1a9 100644
--- a/src/firejail/Makefile.in
+++ b/src/firejail/Makefile.in
@@ -3,6 +3,7 @@ all: firejail
3prefix=@prefix@ 3prefix=@prefix@
4exec_prefix=@exec_prefix@ 4exec_prefix=@exec_prefix@
5libdir=@libdir@ 5libdir=@libdir@
6sysconfdir=@sysconfdir@
6 7
7VERSION=@PACKAGE_VERSION@ 8VERSION=@PACKAGE_VERSION@
8NAME=@PACKAGE_NAME@ 9NAME=@PACKAGE_NAME@
@@ -12,11 +13,12 @@ HAVE_CHROOT=@HAVE_CHROOT@
12HAVE_BIND=@HAVE_BIND@ 13HAVE_BIND=@HAVE_BIND@
13HAVE_FATAL_WARNINGS=@HAVE_FATAL_WARNINGS@ 14HAVE_FATAL_WARNINGS=@HAVE_FATAL_WARNINGS@
14 15
16
15H_FILE_LIST = $(wildcard *.[h]) 17H_FILE_LIST = $(wildcard *.[h])
16C_FILE_LIST = $(wildcard *.c) 18C_FILE_LIST = $(wildcard *.c)
17OBJS = $(C_FILE_LIST:.c=.o) 19OBJS = $(C_FILE_LIST:.c=.o)
18BINOBJS = $(foreach file, $(OBJS), $file) 20BINOBJS = $(foreach file, $(OBJS), $file)
19CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -DPREFIX='"$(prefix)"' -DLIBDIR='"$(libdir)"' $(HAVE_SECCOMP) $(HAVE_SECCOMP_H) $(HAVE_CHROOT) $(HAVE_BIND) -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security 21CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -DPREFIX='"$(prefix)"' -DSYSCONFDIR='"$(sysconfdir)/firejail"' -DLIBDIR='"$(libdir)"' $(HAVE_SECCOMP) $(HAVE_SECCOMP_H) $(HAVE_CHROOT) $(HAVE_BIND) -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security
20LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now -lpthread 22LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now -lpthread
21 23
22%.o : %.c $(H_FILE_LIST) 24%.o : %.c $(H_FILE_LIST)
diff --git a/src/firejail/main.c b/src/firejail/main.c
index 601999db5..3a2da0852 100644
--- a/src/firejail/main.c
+++ b/src/firejail/main.c
@@ -1222,7 +1222,7 @@ int main(int argc, char **argv) {
1222 } 1222 }
1223 if (!custom_profile) { 1223 if (!custom_profile) {
1224 // look for a user profile in /etc/firejail directory 1224 // look for a user profile in /etc/firejail directory
1225 int rv = profile_find(cfg.command_name, "/etc/firejail"); 1225 int rv = profile_find(cfg.command_name, SYSCONFDIR);
1226 custom_profile = rv; 1226 custom_profile = rv;
1227 } 1227 }
1228 } 1228 }
@@ -1252,7 +1252,7 @@ int main(int argc, char **argv) {
1252 1252
1253 if (!custom_profile) { 1253 if (!custom_profile) {
1254 // look for the profile in /etc/firejail directory 1254 // look for the profile in /etc/firejail directory
1255 custom_profile = profile_find(profile_name, "/etc/firejail"); 1255 custom_profile = profile_find(profile_name, SYSCONFDIR);
1256 } 1256 }
1257 1257
1258 if (custom_profile && !arg_quiet) 1258 if (custom_profile && !arg_quiet)
diff --git a/src/firejail/profile.c b/src/firejail/profile.c
index 5ab6bc776..de89cf40f 100644
--- a/src/firejail/profile.c
+++ b/src/firejail/profile.c
@@ -429,7 +429,7 @@ void profile_read(const char *fname) {
429 // open profile file: 429 // open profile file:
430 FILE *fp = fopen(fname, "r"); 430 FILE *fp = fopen(fname, "r");
431 if (fp == NULL) { 431 if (fp == NULL) {
432 fprintf(stderr, "Error: cannot open profile file\n"); 432 fprintf(stderr, "Error: cannot open profile file %s\n", fname);
433 exit(1); 433 exit(1);
434 } 434 }
435 435
diff --git a/src/firejail/restricted_shell.c b/src/firejail/restricted_shell.c
index 72354d71b..5b1ce12e0 100644
--- a/src/firejail/restricted_shell.c
+++ b/src/firejail/restricted_shell.c
@@ -27,7 +27,11 @@ int restricted_shell(const char *user) {
27 assert(user); 27 assert(user);
28 28
29 // open profile file: 29 // open profile file:
30 FILE *fp = fopen("/etc/firejail/login.users", "r"); 30 char *fname;
31 if (asprintf(&fname, "%s/login.users", SYSCONFDIR) == -1)
32 errExit("asprintf");
33 FILE *fp = fopen(fname, "r");
34 free(fname);
31 if (fp == NULL) 35 if (fp == NULL)
32 return 0; 36 return 0;
33 37