aboutsummaryrefslogtreecommitdiff
path: root/configs/imagemagick-convert.cfg
blob: 479b293bfa372f430e8a40ecd9c651d332204051 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Example config for nsjail

name: "imagemagick-convert"

description: "This policy allows to run ImageMagick's convert inside a jail."
description: "Your $HOME's Documents will be mapped as /user/Documents"
description: ""
description: "Run as:"
description: ""
description: "./nsjail --config imagemagick-convert.cfg -- /usr/bin/convert jpg:/user/Documents/input.jpg png:/user/Documents/output.png "
description: "or "
description: "./nsjail --config imagemagick-convert.cfg -- /usr/bin/convert jpg:- png:- <file.jpg >file.png

mode: ONCE
hostname: "IM-CONVERT"
cwd: "/user"

time_limit: 120

envar: "HOME=/user"
envar: "TMP=/tmp"

rlimit_as: 2048
rlimit_cpu: 1000
rlimit_fsize: 1024
rlimit_nofile: 64

mount {
	src: "/lib"
	dst: "/lib"
	is_bind: true
}

mount {
	src: "/usr/lib"
	dst: "/usr/lib"
	is_bind: true
}

mount {
	src: "/lib64"
	dst: "/lib64"
	is_bind: true
	mandatory: false
}

mount {
	src: "/lib32"
	dst: "/lib32"
	is_bind: true
	mandatory: false
}

mount {
	dst: "/tmp"
	fstype: "tmpfs"
	rw: true
	is_bind: false
}

mount {
	dst: "/user"
	fstype: "tmpfs"
	rw: true
}

mount {
	prefix_src_env: "HOME"
	src: "/Documents"
	dst: "/user/Documents"
	rw: true
	is_bind: true
	mandatory: false
}

seccomp_string: "ALLOW {"
seccomp_string: "  read, write, open, openat, close, newstat, newfstat,"
seccomp_string: "  newlstat, lseek, mmap, mprotect, munmap, brk,"
seccomp_string: "  rt_sigaction, rt_sigprocmask, pwrite64, access,"
seccomp_string: "  getpid, execveat, getdents, unlink, fchmod,"
seccomp_string: "  getrlimit, getrusage, sysinfo, times, futex,"
seccomp_string: "  arch_prctl, sched_getaffinity, set_tid_address,"
seccomp_string: "  clock_gettime, set_robust_list, exit_group,"
seccomp_string: "  clone, getcwd, pread64, readlink, prlimit64, madvise"
seccomp_string: "}"
seccomp_string: "DEFAULT KILL"

exec_bin {
	path: ""
	arg0: "/usr/bin/convert"
	exec_fd: true
}