~moody/rc

ref: f396e3ee1b1a183cd6b755d1b0a20d2abebc2985 rc/firewall -rwxr-xr-x 393 bytes
f396e3eeMoody Initial commit 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/rc
# Designed to be used with aux/listen1
# EX: aux/listen1 firewall /lib/blacklist aux/trampoline ...

while(~ $1 -*){
	switch($1){
	case -l
		shift
		sed 's/!.*//' $net/remote >> $1
	}

	shift
}

if(test $#* -lt 2){
	echo 'usage: firewall [-l logfile] blacklist command args...' >> /fd/2
	exit
}

if(grep -s `{sed 's/!.*//' $net/remote} $1)
	exit 'blocked by firewall'

shift
exec $*