Blob


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 #
24 Policy: /usr/local/bin/ngircd, Emulation: native
25 native-__sysctl: permit
26 native-fsread: filename eq "/etc/malloc.conf" then permit
27 native-fsread: filename sub "/usr/share/zoneinfo/" then permit
28 native-fsread: filename eq "/usr/local/etc/ngircd.conf" then permit
29 native-fsread: filename eq "/usr/local/etc/ngircd.motd" then permit
30 native-fsread: filename eq "/etc/ngircd.conf" then permit
31 native-fsread: filename eq "/etc/ngircd.motd" then permit
32 native-fsread: filename eq "/etc/spwd.db" then deny[eperm]
33 native-fsread: filename eq "/etc/group" then permit
34 native-fsread: filename eq "/etc/resolv.conf" then permit
35 native-fsread: filename eq "/etc/localtime" then permit
36 native-fsread: filename eq "/etc/hosts" then permit
37 native-fsread: filename sub "<non-existent filename>" then deny[enoent]
38 native-socket: sockdom eq "AF_UNIX" and socktype eq "SOCK_DGRAM" then permit
39 native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_STREAM" then permit
40 native-bind: sockaddr match "inet-*:6667" then permit, if user != root
41 native-connect: sockaddr eq "/dev/log" then permit, if user != root
42 native-connect: sockaddr match "inet-*:53" then permit, if user != root
43 native-setsockopt: permit, if user != root
44 native-listen: permit, if user != root
45 native-accept: permit, if user != root
46 native-sendto: true then permit, if user != root
47 native-recvfrom: permit, if user != root
48 native-read: permit
49 native-pread: permit
50 native-write: permit, if user != root
51 native-mmap: permit
52 native-munmap: permit
53 native-mprotect: permit
54 native-break: permit
55 native-umask: permit
56 native-fork: permit
57 native-setsid: permit
58 native-chdir: permit
59 native-chroot: permit
60 native-setgid: gid neq "0" then permit
61 native-setuid: uid neq "0" and uname neq "root" then permit
62 native-getuid: permit
63 native-getgid: permit
64 native-gettimeofday: permit
65 native-getpid: permit
66 native-select: permit
67 native-fcntl: permit
68 native-fstat: permit
69 native-issetugid: permit
70 native-sigaction: permit
71 native-pipe: permit
72 native-sigreturn: permit
73 native-close: permit
74 native-exit: permit
75 native-fswrite: deny[eperm]
77 # -eof-