1
0

systrace.policy 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #
  2. # Sample systrace policy for ngIRCd on OpenBSD
  3. # Author: Benjamin Pineau <ben@zouh.org>
  4. #
  5. # $Id: systrace.policy,v 1.1 2004/04/28 12:16:59 alex Exp $
  6. #
  7. # Tune me, put me in /etc/systrace/usr_local_bin_ngircd and start ngIRCd
  8. # (with root privileges) as:
  9. #
  10. # systrace -a /usr/local/bin/ngircd
  11. #
  12. # I didn't tried this on NetBSD, but it should work as is.
  13. #
  14. # On systems with pf, it can be supplemented by strict firewall rules:
  15. # for a ngircd running as '$ircuser', binding on '$ircport' and accepting
  16. # 30 connections:
  17. #
  18. # block out log quick proto tcp from any port $ircport to any \
  19. # user != $ircuser
  20. # pass in inet proto tcp from any to any port $ircport user $ircuser \
  21. # keep state (max 30) flags S/SA
  22. #
  23. Policy: /usr/local/bin/ngircd, Emulation: native
  24. native-__sysctl: permit
  25. native-fsread: filename eq "/etc/malloc.conf" then permit
  26. native-fsread: filename sub "/usr/share/zoneinfo/" then permit
  27. native-fsread: filename eq "/usr/local/etc/ngircd.conf" then permit
  28. native-fsread: filename eq "/usr/local/etc/ngircd.motd" then permit
  29. native-fsread: filename eq "/etc/ngircd.conf" then permit
  30. native-fsread: filename eq "/etc/ngircd.motd" then permit
  31. native-fsread: filename eq "/etc/spwd.db" then deny[eperm]
  32. native-fsread: filename eq "/etc/group" then permit
  33. native-fsread: filename eq "/etc/resolv.conf" then permit
  34. native-fsread: filename eq "/etc/localtime" then permit
  35. native-fsread: filename eq "/etc/hosts" then permit
  36. native-fsread: filename sub "<non-existent filename>" then deny[enoent]
  37. native-socket: sockdom eq "AF_UNIX" and socktype eq "SOCK_DGRAM" then permit
  38. native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_STREAM" then permit
  39. native-bind: sockaddr match "inet-*:6667" then permit, if user != root
  40. native-connect: sockaddr eq "/dev/log" then permit, if user != root
  41. native-connect: sockaddr match "inet-*:53" then permit, if user != root
  42. native-setsockopt: permit, if user != root
  43. native-listen: permit, if user != root
  44. native-accept: permit, if user != root
  45. native-sendto: true then permit, if user != root
  46. native-recvfrom: permit, if user != root
  47. native-read: permit
  48. native-pread: permit
  49. native-write: permit, if user != root
  50. native-mmap: permit
  51. native-munmap: permit
  52. native-mprotect: permit
  53. native-break: permit
  54. native-umask: permit
  55. native-fork: permit
  56. native-setsid: permit
  57. native-chdir: permit
  58. native-chroot: permit
  59. native-setgid: gid neq "0" then permit
  60. native-setuid: uid neq "0" and uname neq "root" then permit
  61. native-getuid: permit
  62. native-getgid: permit
  63. native-gettimeofday: permit
  64. native-getpid: permit
  65. native-select: permit
  66. native-fcntl: permit
  67. native-fstat: permit
  68. native-issetugid: permit
  69. native-sigaction: permit
  70. native-pipe: permit
  71. native-sigreturn: permit
  72. native-close: permit
  73. native-exit: permit
  74. native-fswrite: deny[eperm]
  75. # -eof-