platform/upstream/nsjail.git
4 years agoFix build
Wiktor Garbacz [Thu, 28 Jan 2021 08:47:31 +0000 (09:47 +0100)]
Fix build

4 years agoAdd new capabilities, ignore unsupported caps for bounding set
Wiktor Garbacz [Wed, 27 Jan 2021 13:37:12 +0000 (14:37 +0100)]
Add new capabilities, ignore unsupported caps for bounding set

4 years agonsjail: don't add connections to the proxy map if launching a new process failed
Robert Swiecki [Sun, 30 Aug 2020 21:22:22 +0000 (23:22 +0200)]
nsjail: don't add connections to the proxy map if launching a new process failed

4 years agosubproc: kill a process once in the -Ml mode once the TCP connection has ended
Robert Swiecki [Sun, 30 Aug 2020 20:02:08 +0000 (22:02 +0200)]
subproc: kill a process once in the -Ml mode once the TCP connection has ended

4 years agoMerge pull request #150 from joemiller/patch-1
robertswiecki [Wed, 26 Aug 2020 15:02:02 +0000 (17:02 +0200)]
Merge pull request #150 from joemiller/patch-1

remove build dependency on which

4 years agomake indent
Robert Swiecki [Wed, 26 Aug 2020 14:09:55 +0000 (16:09 +0200)]
make indent

4 years agoremove build dependency on which
joe miller [Sat, 15 Aug 2020 00:07:30 +0000 (17:07 -0700)]
remove build dependency on which

4 years agoMerge pull request #148 from boryspoplawski/master
robertswiecki [Mon, 3 Aug 2020 20:42:28 +0000 (22:42 +0200)]
Merge pull request #148 from boryspoplawski/master

Fix compilation errors on old gcc (5.4.0)

4 years agoMakefile: compile kafel with -fPIE (maybe fixes #149)
Robert Swiecki [Mon, 3 Aug 2020 18:43:08 +0000 (20:43 +0200)]
Makefile: compile kafel with -fPIE (maybe fixes #149)

4 years agoFix compilation errors on old gcc (5.4.0)
borysp [Wed, 29 Jul 2020 13:18:10 +0000 (15:18 +0200)]
Fix compilation errors on old gcc (5.4.0)

4 years agoconfig.proto: make indent
Robert Swiecki [Tue, 28 Jul 2020 12:03:27 +0000 (14:03 +0200)]
config.proto: make indent

4 years agoconfig.proto: renumerate config fields
Robert Swiecki [Tue, 28 Jul 2020 12:02:34 +0000 (14:02 +0200)]
config.proto: renumerate config fields

4 years agoMerge pull request #147 from disconnect3d/patch-2 3.0
robertswiecki [Wed, 22 Jul 2020 22:09:23 +0000 (00:09 +0200)]
Merge pull request #147 from disconnect3d/patch-2

Fixes #146: cgroups_mem_max unit in config.proto

4 years agoFixes #146: cgroups_mem_max unit in config.proto
Disconnect3d [Thu, 16 Jul 2020 12:43:43 +0000 (14:43 +0200)]
Fixes #146: cgroups_mem_max unit in config.proto

This commit fixes the incorrect cgroups_mem_max unit described in a config.proto comment.

We do not perform any calculations on this value and we don't specify the values unit (k/M/G) when writing to memory cgroup controller files, so the value is specified in bytes.

4 years agomake indent
Robert Swiecki [Thu, 9 Jul 2020 15:29:02 +0000 (17:29 +0200)]
make indent

4 years agoconfig: remove deprecated config options
Robert Swiecki [Thu, 9 Jul 2020 15:28:56 +0000 (17:28 +0200)]
config: remove deprecated config options

4 years agoMerge pull request #145 from cblichmann/master
robertswiecki [Tue, 7 Jul 2020 14:52:21 +0000 (16:52 +0200)]
Merge pull request #145 from cblichmann/master

Fix a few typos.

4 years agoFix a few typos.
Christian Blichmann [Tue, 7 Jul 2020 12:07:22 +0000 (14:07 +0200)]
Fix a few typos.

These were found by external tooling while preparing the Debian package.

* Uknown -> Unknown
* Writting -> Writing
* commited -> committed
* processess -> processes

Signed-off-by: Christian Blichmann <mail@blichmann.eu>
4 years agoMerge pull request #144 from arcz/config-deps-paths
happyCoder92 [Tue, 7 Jul 2020 09:55:11 +0000 (11:55 +0200)]
Merge pull request #144 from arcz/config-deps-paths

Build-time config of newuidmap and newgidmap paths

4 years agoStringify CLI-passed paths
Artur Cygan [Mon, 6 Jul 2020 12:38:11 +0000 (14:38 +0200)]
Stringify CLI-passed paths

4 years agoBuild-time config of newuidmap and newgidmap paths
Artur Cygan [Mon, 22 Jun 2020 11:42:22 +0000 (13:42 +0200)]
Build-time config of newuidmap and newgidmap paths

4 years agonsjail: don't change cwd during daemon()
Robert Swiecki [Tue, 21 Apr 2020 09:25:06 +0000 (11:25 +0200)]
nsjail: don't change cwd during daemon()

4 years agoFix format specifier for size_t
Wiktor Garbacz [Fri, 27 Mar 2020 09:19:40 +0000 (10:19 +0100)]
Fix format specifier for size_t

4 years agoMerge pull request #136 from c7f-m0d3/master
happyCoder92 [Thu, 19 Mar 2020 12:50:35 +0000 (13:50 +0100)]
Merge pull request #136 from c7f-m0d3/master

fix non-functional max_conns_per_ip

4 years agofix non-functional max_conns_per_ip
Piotr Krysiuk [Thu, 19 Mar 2020 00:13:28 +0000 (00:13 +0000)]
fix non-functional max_conns_per_ip

Starting with nsjail::listenMode update to pipe socket traffic [commit 273ce6bc846b7325c7f0915067c54bf8cf6f5654], a pipe file descriptor is passed as connsock parameter when calling net::limitConns and also as sock parameter when calling addProc in subproc::runChild.
This breaks net::limitConns because pid.remote_addr and also local variable addr are left uninitialized despite net::connToText calls when counting number of existing network connections from the same peer.

The subsequent correction to fetch remote address [commit 2cf562160d308f9b5cca767a2459332f2041b41c] made the bug even more interesting, since the loop in net::limitConns now compares unsanitized content of stack with network addresses of already connected clients.

4 years agoMerge pull request #133 from sirdarckcat/master
happyCoder92 [Mon, 2 Mar 2020 14:31:37 +0000 (15:31 +0100)]
Merge pull request #133 from sirdarckcat/master

Create dockerpush.yml

4 years agoCreate dockerpush.yml
Eduardo' Vela" Nava (sirdarckcat) [Sun, 1 Mar 2020 06:56:34 +0000 (07:56 +0100)]
Create dockerpush.yml

5 years agomake indent
Robert Swiecki [Mon, 17 Feb 2020 19:33:45 +0000 (20:33 +0100)]
make indent

5 years agofix POLLNVAL in pipeTraffic
Wiktor Garbacz [Mon, 17 Feb 2020 14:55:08 +0000 (15:55 +0100)]
fix POLLNVAL in pipeTraffic

5 years agofix infinite loop in pipeTraffic
Wiktor Garbacz [Mon, 17 Feb 2020 13:16:40 +0000 (14:16 +0100)]
fix infinite loop in pipeTraffic

5 years agosubproc: debug log when hotting SIHQUIT (Ctrl+\) #2 - better check
Robert Swiecki [Mon, 17 Feb 2020 13:13:17 +0000 (14:13 +0100)]
subproc: debug log when hotting SIHQUIT (Ctrl+\) #2 - better check

5 years agosubproc: debug log when hotting SIHQUIT (Ctrl+\)
Robert Swiecki [Mon, 17 Feb 2020 13:11:58 +0000 (14:11 +0100)]
subproc: debug log when hotting SIHQUIT (Ctrl+\)

5 years agosubproc: verify that a pid in a pid map doesn't exist before inserting
Robert Swiecki [Mon, 17 Feb 2020 13:07:25 +0000 (14:07 +0100)]
subproc: verify that a pid in a pid map doesn't exist before inserting

5 years agonsjail/pid/subproc: a). keep childrens' PIDs in a map indexed by pid b). correctly...
Robert Swiecki [Sun, 16 Feb 2020 21:34:19 +0000 (22:34 +0100)]
nsjail/pid/subproc: a). keep childrens' PIDs in a map indexed by pid b). correctly fetch remote IPv6 address text

5 years agoMerge pull request #130 from happyCoder92/proxy
robertswiecki [Fri, 14 Feb 2020 16:08:41 +0000 (17:08 +0100)]
Merge pull request #130 from happyCoder92/proxy

pipe socket traffic in and out of sandboxee

5 years agoMerge pull request #128 from disconnect3d/patch-2
robertswiecki [Fri, 14 Feb 2020 16:08:07 +0000 (17:08 +0100)]
Merge pull request #128 from disconnect3d/patch-2

Update Dockerfile to use ubuntu:18.04 image

5 years agopipe socket traffic in and out of sandboxee
Wiktor Garbacz [Thu, 13 Feb 2020 11:24:28 +0000 (12:24 +0100)]
pipe socket traffic in and out of sandboxee

5 years agoMakefile: fix kafel submodule init for parallel build
Wiktor Garbacz [Mon, 27 Jan 2020 09:32:10 +0000 (10:32 +0100)]
Makefile: fix kafel submodule init for parallel build

5 years agosubproc: recognize CLONE_PIDFD
Robert Swiecki [Tue, 10 Dec 2019 10:09:14 +0000 (11:09 +0100)]
subproc: recognize CLONE_PIDFD

5 years agoMerge pull request #129 from disconnect3d/patch-3
robertswiecki [Sat, 7 Dec 2019 16:24:29 +0000 (17:24 +0100)]
Merge pull request #129 from disconnect3d/patch-3

Fix default rlimit_stack value

5 years agoFix default rlimit_stack value
Disconnect3d [Sat, 7 Dec 2019 16:05:45 +0000 (17:05 +0100)]
Fix default rlimit_stack value

The default `rlimit_stack` value was set to 1048576. However, this value is in MiB and so is later multiplied by 1024*1024 in https://github.com/google/nsjail/blob/b3d544d155f5d1543dce1bd3e5327ef41583815a/config.cc#L161-L162 and it ends up as a limit of 1 TB for the stack size.

This PR changes it to 8 MB which is a more sane default or, at least I took it from my virtual machine's ulimits:
```
$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31175
max locked memory       (kbytes, -l) 16384
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 31175
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
```

5 years agoUpdate Dockerfile to use ubuntu:18.04 image
Disconnect3d [Sat, 7 Dec 2019 13:24:32 +0000 (14:24 +0100)]
Update Dockerfile to use ubuntu:18.04 image

5 years agoallow setgroups when using exclusively newgid
Wiktor Garbacz [Fri, 1 Nov 2019 12:40:25 +0000 (13:40 +0100)]
allow setgroups when using exclusively newgid

5 years agoconfigs/: indent
Robert Swiecki [Tue, 29 Oct 2019 00:40:52 +0000 (01:40 +0100)]
configs/: indent

5 years agoconfigs/znc: remove a problematic quote
Robert Swiecki [Thu, 3 Oct 2019 22:35:36 +0000 (00:35 +0200)]
configs/znc: remove a problematic quote

5 years agonsjail: don't restore console if nsjail runs in background
Robert Swiecki [Thu, 3 Oct 2019 22:33:29 +0000 (00:33 +0200)]
nsjail: don't restore console if nsjail runs in background

5 years agoconfig: simplify log/logfd setting
Robert Swiecki [Wed, 2 Oct 2019 17:43:58 +0000 (19:43 +0200)]
config: simplify log/logfd setting

5 years agoconfigs: new config for znc - remove log_fd
Robert Swiecki [Wed, 2 Oct 2019 06:28:23 +0000 (08:28 +0200)]
configs: new config for znc - remove log_fd

5 years agoconfigs: new config for znc
Robert Swiecki [Tue, 1 Oct 2019 06:27:17 +0000 (08:27 +0200)]
configs: new config for znc

5 years agoconfigs/xchat: daemonize by default
Robert Swiecki [Sat, 28 Sep 2019 21:00:21 +0000 (23:00 +0200)]
configs/xchat: daemonize by default

5 years agoMerge branch 'master' of ssh://github.com/google/nsjail
Robert Swiecki [Thu, 12 Sep 2019 20:22:04 +0000 (22:22 +0200)]
Merge branch 'master' of ssh://github.com/google/nsjail

5 years agouser: better formatting directives for printf'like functions
Robert Swiecki [Thu, 12 Sep 2019 20:21:49 +0000 (22:21 +0200)]
user: better formatting directives for printf'like functions

5 years agoMerge pull request #123 from LMMilewski/master
robertswiecki [Sat, 7 Sep 2019 00:04:39 +0000 (02:04 +0200)]
Merge pull request #123 from LMMilewski/master

Fix typo in config.proto: s/lofs/logs/

5 years agoFix typo in config.proto: s/lofs/logs/
Lukasz Milewski [Fri, 6 Sep 2019 22:08:30 +0000 (15:08 -0700)]
Fix typo in config.proto: s/lofs/logs/

5 years agoMerge branch 'master' of github.com:google/nsjail 2.9
Robert Swiecki [Mon, 2 Sep 2019 14:10:28 +0000 (16:10 +0200)]
Merge branch 'master' of github.com:google/nsjail

5 years agosubproc: fix invalid conversions from util::syscall to syscall
Robert Swiecki [Mon, 2 Sep 2019 14:10:19 +0000 (16:10 +0200)]
subproc: fix invalid conversions from util::syscall to syscall

5 years agomnt: shorter description of mount points
Robert Swiecki [Sat, 31 Aug 2019 20:08:02 +0000 (22:08 +0200)]
mnt: shorter description of mount points

5 years agostandardize on envar vs envvar
Robert Swiecki [Wed, 28 Aug 2019 20:18:58 +0000 (22:18 +0200)]
standardize on envar vs envvar

5 years agolog: close previous log descriptor a bit later:
Robert Swiecki [Sun, 25 Aug 2019 09:23:20 +0000 (11:23 +0200)]
log: close previous log descriptor a bit later:

5 years agomnt: use setcwd unconditionally with and w/o clone_newns
Robert Swiecki [Sun, 25 Aug 2019 09:17:12 +0000 (11:17 +0200)]
mnt: use setcwd unconditionally with and w/o clone_newns

5 years agomnt: use setcwd unconditionally with and w/o clone_newns
Robert Swiecki [Sun, 25 Aug 2019 09:16:12 +0000 (11:16 +0200)]
mnt: use setcwd unconditionally with and w/o clone_newns

5 years agolog: a bit clearer calls to dup()
Robert Swiecki [Thu, 22 Aug 2019 11:59:15 +0000 (13:59 +0200)]
log: a bit clearer calls to dup()

5 years agoFix missing chdir in non-CLONE_NEWNS path
Robert Swiecki [Wed, 21 Aug 2019 12:29:35 +0000 (14:29 +0200)]
Fix missing chdir in non-CLONE_NEWNS path

5 years agolog: simplify logging code
Robert Swiecki [Tue, 20 Aug 2019 12:16:21 +0000 (14:16 +0200)]
log: simplify logging code

5 years agoconfig.proto: move disable_rl higher
Robert Swiecki [Mon, 19 Aug 2019 12:28:45 +0000 (14:28 +0200)]
config.proto: move disable_rl higher

5 years agoMerge pull request #120 from jaylees14/disable-rlimits
robertswiecki [Mon, 19 Aug 2019 12:26:27 +0000 (14:26 +0200)]
Merge pull request #120 from jaylees14/disable-rlimits

Add flag to disable rlimits

5 years agoMerge branch 'master' of github.com:google/nsjail
Robert Swiecki [Mon, 19 Aug 2019 09:35:17 +0000 (11:35 +0200)]
Merge branch 'master' of github.com:google/nsjail

5 years agonet/cmdline: better checks for TCP port values
Robert Swiecki [Mon, 19 Aug 2019 09:34:34 +0000 (11:34 +0200)]
net/cmdline: better checks for TCP port values

5 years agoAdd flag to disable rlimits
Jay Lees [Mon, 5 Aug 2019 10:25:22 +0000 (03:25 -0700)]
Add flag to disable rlimits

5 years agocgroup-code: remove some spaces to make code more consistent
Robert Swiecki [Sun, 4 Aug 2019 07:54:38 +0000 (09:54 +0200)]
cgroup-code: remove some spaces to make code more consistent

5 years agomake indent depend
Robert Swiecki [Sun, 4 Aug 2019 07:50:34 +0000 (09:50 +0200)]
make indent depend

5 years agoMerge pull request #119 from jaylees14/cgroup-v2
robertswiecki [Sun, 4 Aug 2019 07:49:35 +0000 (09:49 +0200)]
Merge pull request #119 from jaylees14/cgroup-v2

[cgroup-v2] support cgroup v2 for mem, cpu and pids

5 years ago[cgroup-v2] support cgroup v2 for mem, cpu and pids
Jay Lees [Fri, 26 Jul 2019 14:02:17 +0000 (07:02 -0700)]
[cgroup-v2] support cgroup v2 for mem, cpu and pids

5 years agoconfigs/imagemagick-convert: add madvise
Robert Swiecki [Fri, 12 Jul 2019 14:07:06 +0000 (16:07 +0200)]
configs/imagemagick-convert: add madvise

5 years agoMerge branch 'master' of github.com:google/nsjail
Robert Swiecki [Mon, 1 Jul 2019 12:52:32 +0000 (14:52 +0200)]
Merge branch 'master' of github.com:google/nsjail

5 years agoDisable securebits again to avoid spawned programs unexpectedly retaining capabilitie...
Robert Swiecki [Mon, 1 Jul 2019 12:51:32 +0000 (14:51 +0200)]
Disable securebits again to avoid spawned programs unexpectedly retaining capabilities after a UID/GID change

5 years agocmdline: no need to check for nice values
Robert Swiecki [Sun, 30 Jun 2019 20:03:57 +0000 (22:03 +0200)]
cmdline: no need to check for nice values

5 years agoAdd nice_level to cmd-line/config options
Robert Swiecki [Sun, 30 Jun 2019 19:50:56 +0000 (21:50 +0200)]
Add nice_level to cmd-line/config options

5 years agouser: typo
Robert Swiecki [Fri, 28 Jun 2019 17:08:21 +0000 (19:08 +0200)]
user: typo

5 years agouser: don't fail on setgroup() if not groups were specified
Robert Swiecki [Fri, 28 Jun 2019 11:31:43 +0000 (13:31 +0200)]
user: don't fail on setgroup() if not groups were specified

5 years agoMerge pull request #116 from pks-t/pks/setgroups-without-userns
robertswiecki [Mon, 24 Jun 2019 12:26:19 +0000 (14:26 +0200)]
Merge pull request #116 from pks-t/pks/setgroups-without-userns

user: allow setting multiple groups without user namespaces

5 years agouser: allow setting multiple groups without user namespaces
Patrick Steinhardt [Thu, 20 Jun 2019 09:45:27 +0000 (11:45 +0200)]
user: allow setting multiple groups without user namespaces

When not using a user namespace, then we'll completely ignore
whether multiple groups have been specified by the user and only set
up the process's GID. With user namespaces, we in fact cannot set up
supplementary groups as we have set up "/proc/self/setgroups" to
deny any call to setgroups(2). But we can do better than that when
not using user namespaces, as we're free to use that syscall.

As nsjail(1) documents that "--group" can be specified multiple
times without mentioning that this won't work with
"--disable_clone_newuser", change the code to make that
constellation work.

5 years agouse TEMP_FAILURE_RETRY with some restartable funcs
Robert Swiecki [Wed, 17 Apr 2019 21:10:18 +0000 (23:10 +0200)]
use TEMP_FAILURE_RETRY with some restartable funcs

5 years agoconfigs/image-magic: make convert be overridable
Robert Swiecki [Mon, 1 Apr 2019 21:32:06 +0000 (23:32 +0200)]
configs/image-magic: make convert be overridable

5 years agocmdline: don't clear cmdline exec_file is arguments are provided on cmdline
Robert Swiecki [Mon, 1 Apr 2019 20:46:39 +0000 (22:46 +0200)]
cmdline: don't clear cmdline exec_file is arguments are provided on cmdline

5 years agoconfig.proto: Exe.path is required
Robert Swiecki [Mon, 1 Apr 2019 20:43:17 +0000 (22:43 +0200)]
config.proto: Exe.path is required

5 years agocmdline: make sure that argv[0] exists
Robert Swiecki [Mon, 1 Apr 2019 20:42:14 +0000 (22:42 +0200)]
cmdline: make sure that argv[0] exists

5 years agouser: function naming
Robert Swiecki [Sun, 31 Mar 2019 13:16:24 +0000 (15:16 +0200)]
user: function naming

5 years agoconfigs/firefox-with-cloned-net: add fontconfig config envvars
Robert Swiecki [Sat, 30 Mar 2019 15:20:04 +0000 (16:20 +0100)]
configs/firefox-with-cloned-net: add fontconfig config envvars

5 years agoconfigs/firefox: add fontconfig config envvars
Robert Swiecki [Sat, 30 Mar 2019 15:19:30 +0000 (16:19 +0100)]
configs/firefox: add fontconfig config envvars

5 years agocmdline: allow to override config cmdline with cmdline cmdline
Robert Swiecki [Sat, 30 Mar 2019 15:10:14 +0000 (16:10 +0100)]
cmdline: allow to override config cmdline with cmdline cmdline

5 years agoconfigs/conver: revert the last one to properly figure it out
Robert Swiecki [Sat, 30 Mar 2019 14:49:18 +0000 (15:49 +0100)]
configs/conver: revert the last one to properly figure it out

5 years agoMerge pull request #114 from disconnect3d/patch-1
robertswiecki [Sat, 30 Mar 2019 14:45:04 +0000 (15:45 +0100)]
Merge pull request #114 from disconnect3d/patch-1

Fixes issue #113

5 years agoFixes issue #113
Disconnect3d [Fri, 29 Mar 2019 22:48:56 +0000 (23:48 +0100)]
Fixes issue #113

5 years agonsjail: remove warning about CLONE_NEWUSER
Robert Swiecki [Fri, 29 Mar 2019 20:42:05 +0000 (21:42 +0100)]
nsjail: remove warning about CLONE_NEWUSER

5 years agoallow to use nsjail w/o namespaces
Robert Swiecki [Fri, 29 Mar 2019 20:38:14 +0000 (21:38 +0100)]
allow to use nsjail w/o namespaces

5 years agomnt: try /run/user/<uid>/nsjail as a root mount dir first
Robert Swiecki [Thu, 28 Mar 2019 22:25:15 +0000 (23:25 +0100)]
mnt: try /run/user/<uid>/nsjail as a root mount dir first

5 years agomnt: use /run/usr/<uid> first when mounting dirs
Robert Swiecki [Mon, 18 Mar 2019 15:37:04 +0000 (16:37 +0100)]
mnt: use /run/usr/<uid> first when mounting dirs

5 years agosubproc: save/restore errno when printing error message twice
Robert Swiecki [Tue, 12 Mar 2019 16:07:24 +0000 (17:07 +0100)]
subproc: save/restore errno when printing error message twice

5 years agoflush stdin after nsjail ends
Robert Swiecki [Sun, 10 Mar 2019 14:00:45 +0000 (15:00 +0100)]
flush stdin after nsjail ends