]> andersk Git - openssh.git/blame - regress/addrmatch.sh
- djm@cvs.openbsd.org 2009/08/20 18:43:07
[openssh.git] / regress / addrmatch.sh
CommitLineData
1aeac41e 1# $OpenBSD: addrmatch.sh,v 1.2 2008/12/07 22:17:48 djm Exp $
16d46c30 2# Placed in the Public Domain.
3
4tid="address match"
5
6mv $OBJ/sshd_proxy $OBJ/sshd_proxy_orig
7
8run_trial()
9{
10 user="$1"; addr="$2"; host="$3"; expected="$4"; descr="$5"
11
12 verbose "test $descr for $user $addr $host"
13 result=`${SSHD} -f $OBJ/sshd_proxy -T \
14 -C user=${user},addr=${addr},host=${host} | \
1aeac41e 15 awk '/^passwordauthentication/ {print $2}'`
16d46c30 16 if [ "$result" != "$expected" ]; then
17 fail "failed for $user $addr $host: expected $expected, got $result"
18 fi
19}
20
21cp $OBJ/sshd_proxy_orig $OBJ/sshd_proxy
22cat >>$OBJ/sshd_proxy <<EOD
23PasswordAuthentication no
24Match Address 192.168.0.0/16,!192.168.30.0/24,10.0.0.0/8,host.example.com
25 PasswordAuthentication yes
26Match Address 1.1.1.1,::1,!::3,2000::/16
27 PasswordAuthentication yes
28EOD
29
30run_trial user 192.168.0.1 somehost yes "permit, first entry"
31run_trial user 192.168.30.1 somehost no "deny, negative match"
32run_trial user 19.0.0.1 somehost no "deny, no match"
33run_trial user 10.255.255.254 somehost yes "permit, list middle"
34run_trial user 192.168.30.1 192.168.0.1 no "deny, faked IP in hostname"
35run_trial user 1.1.1.1 somehost.example.com yes "permit, bare IP4 address"
edee47f5 36test "$TEST_SSH_IPV6" = "no" && exit
16d46c30 37run_trial user ::1 somehost.example.com yes "permit, bare IP6 address"
38run_trial user ::2 somehost.exaple.com no "deny IPv6"
39run_trial user ::3 somehost no "deny IP6 negated"
40run_trial user ::4 somehost no "deny, IP6 no match"
41run_trial user 2000::1 somehost yes "permit, IP6 network"
42run_trial user 2001::1 somehost no "deny, IP6 network"
This page took 0.172952 seconds and 5 git commands to generate.