summaryrefslogtreecommitdiff
path: root/regress/allow-deny-users.sh
diff options
context:
space:
mode:
Diffstat (limited to 'regress/allow-deny-users.sh')
-rw-r--r--regress/allow-deny-users.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/regress/allow-deny-users.sh b/regress/allow-deny-users.sh
new file mode 100644
index 000000000..217b15940
--- /dev/null
+++ b/regress/allow-deny-users.sh
@@ -0,0 +1,37 @@
1# Public Domain
2# Zev Weiss, 2016
3
4tid="AllowUsers/DenyUsers"
5
6me=`whoami`
7other="nobody"
8
9test_auth()
10{
11 deny="$1"
12 allow="$2"
13 should_succeed="$3"
14 failmsg="$4"
15
16 start_sshd -oDenyUsers="$deny" -oAllowUsers="$allow"
17
18 ${SSH} -F $OBJ/ssh_config "$me@somehost" true
19 status=$?
20
21 if (test $status -eq 0 && ! $should_succeed) \
22 || (test $status -ne 0 && $should_succeed); then
23 fail "$failmsg"
24 fi
25
26 stop_sshd
27}
28
29# DenyUsers AllowUsers should_succeed failure_message
30test_auth "" "" true "user in neither DenyUsers nor AllowUsers denied"
31test_auth "$other $me" "" false "user in DenyUsers allowed"
32test_auth "$me $other" "" false "user in DenyUsers allowed"
33test_auth "" "$other" false "user not in AllowUsers allowed"
34test_auth "" "$other $me" true "user in AllowUsers denied"
35test_auth "" "$me $other" true "user in AllowUsers denied"
36test_auth "$me $other" "$me $other" false "user in both DenyUsers and AllowUsers allowed"
37test_auth "$other $me" "$other $me" false "user in both DenyUsers and AllowUsers allowed"