daily pastebin goal
92%
SHARE
TWEET

Untitled

a guest Mar 15th, 2017 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ~$ cat /var/lib/snapd/seccomp/profiles/snap.core.hook.configure
  2.  
  3. # Description: Allows access to app-specific directories and basic runtime
  4. #
  5. # The default seccomp policy is default deny with a whitelist of allowed
  6. # syscalls. The default policy is intended to be safe for any application to
  7. # use and should be evaluated in conjunction with other security backends (eg
  8. # AppArmor). For example, a few particularly problematic syscalls that are left
  9. # out of the default policy are (non-exhaustive):
  10. # - kexec_load
  11. # - create_module, init_module, finit_module, delete_module (kernel modules)
  12. # - name_to_handle_at (history of vulnerabilities)
  13. # - open_by_handle_at (history of vulnerabilities)
  14. # - ptrace (can be used to break out of sandbox with <4.8 kernels)
  15. # - add_key, keyctl, request_key (kernel keyring)
  16.  
  17. #
  18. # Allowed accesses
  19. #
  20.  
  21. access
  22. faccessat
  23.  
  24. alarm
  25. brk
  26.  
  27. # ARM private syscalls
  28. breakpoint
  29. cacheflush
  30. set_tls
  31. usr26
  32. usr32
  33.  
  34. capget
  35. # AppArmor mediates capabilities, so allow capset (useful for apps that for
  36. # example want to drop capabilities)
  37. capset
  38.  
  39. chdir
  40. fchdir
  41.  
  42. # We can't effectively block file perms due to open() with O_CREAT, so allow
  43. # chmod until we have syscall arg filtering (LP: #1446748)
  44. chmod
  45. fchmod
  46. fchmodat
  47.  
  48. # snappy doesn't currently support per-app UID/GIDs. All daemons run as 'root'
  49. # so allow chown to 'root'. DAC will prevent non-root from chowning to root.
  50. chown - 0 0
  51. chown32 - 0 0
  52. fchown - 0 0
  53. fchown32 - 0 0
  54. lchown - 0 0
  55. lchown32 - 0 0
  56.  
  57. clock_getres
  58. clock_gettime
  59. clock_nanosleep
  60. clone
  61. close
  62.  
  63. # needed by ls -l
  64. connect
  65.  
  66. creat
  67. dup
  68. dup2
  69. dup3
  70. epoll_create
  71. epoll_create1
  72. epoll_ctl
  73. epoll_ctl_old
  74. epoll_pwait
  75. epoll_wait
  76. epoll_wait_old
  77. eventfd
  78. eventfd2
  79. execve
  80. execveat
  81. _exit
  82. exit
  83. exit_group
  84. fallocate
  85.  
  86. # requires CAP_SYS_ADMIN
  87. #fanotify_init
  88. #fanotify_mark
  89.  
  90. fcntl
  91. fcntl64
  92. flock
  93. fork
  94. ftime
  95. futex
  96. get_mempolicy
  97. get_robust_list
  98. get_thread_area
  99. getcpu
  100. getcwd
  101. getdents
  102. getdents64
  103. getegid
  104. getegid32
  105. geteuid
  106. geteuid32
  107. getgid
  108. getgid32
  109. getgroups
  110. getgroups32
  111. getitimer
  112. getpgid
  113. getpgrp
  114. getpid
  115. getppid
  116. getpriority
  117. getrandom
  118. getresgid
  119. getresgid32
  120. getresuid
  121. getresuid32
  122.  
  123. getrlimit
  124. ugetrlimit
  125.  
  126. getrusage
  127. getsid
  128. gettid
  129. gettimeofday
  130. getuid
  131. getuid32
  132.  
  133. getxattr
  134. fgetxattr
  135. lgetxattr
  136.  
  137. inotify_add_watch
  138. inotify_init
  139. inotify_init1
  140. inotify_rm_watch
  141.  
  142. # TIOCSTI allows for faking input (man tty_ioctl)
  143. # TODO: this should be scaled back even more
  144. #ioctl - !TIOCSTI
  145. # FIXME: replace this with the filter of TIOCSTI once snap-confine can read this syntax
  146. # See LP:#1662489 for context.
  147. ioctl
  148.  
  149. io_cancel
  150. io_destroy
  151. io_getevents
  152. io_setup
  153. io_submit
  154. ioprio_get
  155. # affects other processes, requires CAP_SYS_ADMIN. Potentially allow with
  156. # syscall filtering of (at least) IOPRIO_WHO_USER (LP: #1446748)
  157. #ioprio_set
  158.  
  159. ipc
  160. kill
  161. link
  162. linkat
  163.  
  164. listxattr
  165. llistxattr
  166. flistxattr
  167.  
  168. lseek
  169. llseek
  170. _llseek
  171. lstat
  172. lstat64
  173.  
  174. madvise
  175. fadvise64
  176. fadvise64_64
  177. arm_fadvise64_64
  178.  
  179. mbind
  180. membarrier
  181. memfd_create
  182. mincore
  183. mkdir
  184. mkdirat
  185. mlock
  186. mlock2
  187. mlockall
  188. mmap
  189. mmap2
  190. modify_ldt
  191. mprotect
  192.  
  193. # LP: #1448184 - these aren't currently mediated by AppArmor. Deny for now
  194. #mq_getsetattr
  195. #mq_notify
  196. #mq_open
  197. #mq_timedreceive
  198. #mq_timedsend
  199. #mq_unlink
  200.  
  201. mremap
  202. msgctl
  203. msgget
  204. msgrcv
  205. msgsnd
  206. msync
  207. munlock
  208. munlockall
  209. munmap
  210.  
  211. nanosleep
  212.  
  213. # Allow using nice() with default or lower priority
  214. # FIXME: https://github.com/seccomp/libseccomp/issues/69 which means we
  215. # currently have to use <=19. When that bug is fixed, use >=0
  216. nice <=19
  217. # Allow using setpriority to set the priority of the calling process to default
  218. # or lower priority (eg, 'nice -n 9 <command>')
  219. # default or lower priority.
  220. # FIXME: https://github.com/seccomp/libseccomp/issues/69 which means we
  221. # currently have to use <=19. When that bug is fixed, use >=0
  222. setpriority PRIO_PROCESS 0 <=19
  223.  
  224. # LP: #1446748 - support syscall arg filtering for mode_t with O_CREAT
  225. open
  226.  
  227. openat
  228. pause
  229. personality
  230. pipe
  231. pipe2
  232. poll
  233. ppoll
  234.  
  235. # LP: #1446748 - support syscall arg filtering
  236. prctl
  237. arch_prctl
  238.  
  239. read
  240. pread
  241. pread64
  242. preadv
  243. readv
  244.  
  245. readahead
  246. readdir
  247. readlink
  248. readlinkat
  249.  
  250. # allow reading from sockets
  251. recv
  252. recvfrom
  253. recvmsg
  254. recvmmsg
  255.  
  256. remap_file_pages
  257.  
  258. removexattr
  259. fremovexattr
  260. lremovexattr
  261.  
  262. rename
  263. renameat
  264. renameat2
  265.  
  266. # The man page says this shouldn't be needed, but we've seen denials for it
  267. # in the wild
  268. restart_syscall
  269.  
  270. rmdir
  271. rt_sigaction
  272. rt_sigpending
  273. rt_sigprocmask
  274. rt_sigqueueinfo
  275. rt_sigreturn
  276. rt_sigsuspend
  277. rt_sigtimedwait
  278. rt_tgsigqueueinfo
  279. sched_getaffinity
  280. sched_getattr
  281. sched_getparam
  282. sched_get_priority_max
  283. sched_get_priority_min
  284. sched_getscheduler
  285. sched_rr_get_interval
  286. # enforce pid_t is 0 so the app may only change its own scheduler and affinity.
  287. # Use process-control interface for controlling other pids.
  288. sched_setaffinity 0 - -
  289. sched_setparam 0 -
  290.  
  291. # 'sched_setscheduler' without argument filtering was allowed in 2.21 and
  292. # earlier and 2.22 added 'sched_setscheduler 0 - -', introducing LP: #1661265.
  293. # For now, continue to allow sched_setscheduler unconditionally.
  294. sched_setscheduler
  295.  
  296. sched_yield
  297.  
  298. # Allow configuring seccomp filter. This is ok because the kernel enforces that
  299. # the new filter is a subset of the current filter (ie, no widening
  300. # permissions)
  301. seccomp
  302.  
  303. select
  304. _newselect
  305. pselect
  306. pselect6
  307.  
  308. semctl
  309. semget
  310. semop
  311. semtimedop
  312.  
  313. # allow sending to sockets
  314. send
  315. sendto
  316. sendmsg
  317. sendmmsg
  318.  
  319. sendfile
  320. sendfile64
  321.  
  322. # While we don't yet have seccomp arg filtering (LP: #1446748), we must allow
  323. # these because the launcher drops privileges after seccomp_load(). Eventually
  324. # we will only allow dropping to particular UIDs. For now, we mediate this with
  325. # AppArmor
  326. setgid
  327. setgid32
  328. setregid
  329. setregid32
  330. setresgid
  331. setresgid32
  332. setresuid
  333. setresuid32
  334. setreuid
  335. setreuid32
  336. setuid
  337. setuid32
  338. #setgroups
  339. #setgroups32
  340.  
  341. # These break isolation but are common and can't be mediated at the seccomp
  342. # level with arg filtering
  343. setpgid
  344. setpgrp
  345.  
  346. set_thread_area
  347. setitimer
  348.  
  349. # apps don't have CAP_SYS_RESOURCE so these can't be abused to raise the hard
  350. # limits
  351. setrlimit
  352. prlimit64
  353.  
  354. set_mempolicy
  355. set_robust_list
  356. setsid
  357. set_tid_address
  358.  
  359. setxattr
  360. fsetxattr
  361. lsetxattr
  362.  
  363. shmat
  364. shmctl
  365. shmdt
  366. shmget
  367. signal
  368. sigaction
  369. signalfd
  370. signalfd4
  371. sigaltstack
  372. sigpending
  373. sigprocmask
  374. sigreturn
  375. sigsuspend
  376. sigtimedwait
  377. sigwaitinfo
  378.  
  379. # AppArmor mediates AF_UNIX/AF_LOCAL via 'unix' rules and all other AF_*
  380. # domains via 'network' rules. We won't allow bare 'network' AppArmor rules, so
  381. # we can allow 'socket' for any domain and let AppArmor handle the rest.
  382. socket
  383.  
  384. # needed by snapctl
  385. getsockopt
  386. setsockopt
  387. getsockname
  388. getpeername
  389.  
  390. # Per man page, on Linux this is limited to only AF_UNIX so it is ok to have
  391. # in the default template
  392. socketpair
  393.  
  394. splice
  395.  
  396. stat
  397. stat64
  398. fstat
  399. fstat64
  400. fstatat64
  401. lstat
  402. newfstatat
  403. oldfstat
  404. oldlstat
  405. oldstat
  406.  
  407. statfs
  408. statfs64
  409. fstatfs
  410. fstatfs64
  411. statvfs
  412. fstatvfs
  413. ustat
  414.  
  415. symlink
  416. symlinkat
  417.  
  418. sync
  419. sync_file_range
  420. sync_file_range2
  421. arm_sync_file_range
  422. fdatasync
  423. fsync
  424. syncfs
  425. sysinfo
  426. syslog
  427. tee
  428. tgkill
  429. time
  430. timer_create
  431. timer_delete
  432. timer_getoverrun
  433. timer_gettime
  434. timer_settime
  435. timerfd
  436. timerfd_create
  437. timerfd_gettime
  438. timerfd_settime
  439. times
  440. tkill
  441.  
  442. truncate
  443. truncate64
  444. ftruncate
  445. ftruncate64
  446.  
  447. umask
  448.  
  449. uname
  450. olduname
  451. oldolduname
  452.  
  453. unlink
  454. unlinkat
  455.  
  456. utime
  457. utimensat
  458. utimes
  459. futimesat
  460.  
  461. vfork
  462. vmsplice
  463. wait4
  464. oldwait4
  465. waitpid
  466. waitid
  467.  
  468. write
  469. writev
  470. pwrite
  471. pwrite64
  472. pwritev
  473.  
  474. # FIXME: remove this after LP: #1446748 is implemented
  475. # This is an older interface and single entry point that can be used instead
  476. # of socket(), bind(), connect(), etc individually.
  477. socketcall
RAW Paste Data
Top