2 # Sample systrace policy for ngIRCd on OpenBSD
3 # Author: Benjamin Pineau <ben@zouh.org>
5 # $Id: systrace.policy,v 1.1 2004/04/28 12:16:59 alex Exp $
7 # Tune me, put me in /etc/systrace/usr_local_bin_ngircd and start ngIRCd
8 # (with root privileges) as:
10 # systrace -a /usr/local/bin/ngircd
12 # I didn't tried this on NetBSD, but it should work as is.
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
18 # block out log quick proto tcp from any port $ircport to any \
20 # pass in inet proto tcp from any to any port $ircport user $ircuser \
21 # keep state (max 30) flags S/SA
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
50 native-write: permit, if user != root
53 native-mprotect: permit
60 native-setgid: gid neq "0" then permit
61 native-setuid: uid neq "0" and uname neq "root" then permit
64 native-gettimeofday: permit
69 native-issetugid: permit
70 native-sigaction: permit
72 native-sigreturn: permit
75 native-fswrite: deny[eperm]