forked from netblue30/firejail
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
disable x11 abstract socket for --x11=block
- Loading branch information
netblue30
committed
Oct 1, 2016
1 parent
0bec95a
commit 27bffbf
Showing
13 changed files
with
118 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,4 +149,3 @@ | |
/etc/firejail/synfigstudio.profile | ||
/etc/firejail/gimp.profile | ||
/etc/firejail/inkscape.profile | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
PREFIX=@prefix@ | ||
VERSION=@PACKAGE_VERSION@ | ||
NAME=@PACKAGE_NAME@ | ||
HAVE_FATAL_WARNINGS=@HAVE_FATAL_WARNINGS@ | ||
|
||
H_FILE_LIST = $(sort $(wildcard *.[h])) | ||
C_FILE_LIST = $(sort $(wildcard *.c)) | ||
OBJS = $(C_FILE_LIST:.c=.o) | ||
BINOBJS = $(foreach file, $(OBJS), $file) | ||
CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIC -Wformat -Wformat-security | ||
LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now | ||
|
||
all: libx11.so | ||
|
||
%.o : %.c $(H_FILE_LIST) | ||
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ | ||
|
||
libx11.so: $(OBJS) | ||
$(CC) $(LDFLAGS) -shared -fPIC -z relro -o $@ $(OBJS) -ldl | ||
|
||
|
||
clean:; rm -f $(OBJS) libx11.so | ||
|
||
distclean: clean | ||
rm -fr Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (C) 2014-2016 Firejail Authors | ||
* | ||
* This file is part of firejail project | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
#define _GNU_SOURCE | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <dlfcn.h> | ||
#include <sys/types.h> | ||
#include <unistd.h> | ||
#include <sys/socket.h> | ||
#include <netinet/in.h> | ||
#include <arpa/inet.h> | ||
#include <sys/un.h> | ||
#include <sys/stat.h> | ||
#include <dirent.h> | ||
#include <errno.h> | ||
|
||
//#define DEBUG | ||
|
||
//static int check_sockaddr(int sockfd, const char *call, const struct sockaddr *addr, int rv) { | ||
static int check_sockaddr(const struct sockaddr *addr) { | ||
if (addr->sa_family == AF_UNIX) { | ||
struct sockaddr_un *a = (struct sockaddr_un *) addr; | ||
if (a->sun_path[0] == '\0') { | ||
// printf("@%s\n", a->sun_path + 1); | ||
errno = ENOENT; | ||
return -1; | ||
} | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
// | ||
// syscalls | ||
// | ||
|
||
// connect | ||
typedef int (*orig_connect_t)(int sockfd, const struct sockaddr *addr, socklen_t addrlen); | ||
static orig_connect_t orig_connect = NULL; | ||
int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) { | ||
if (!orig_connect) | ||
orig_connect = (orig_connect_t)dlsym(RTLD_NEXT, "connect"); | ||
|
||
if (check_sockaddr(addr) == -1) | ||
return -1; | ||
|
||
return orig_connect(sockfd, addr, addrlen); | ||
} |