summaryrefslogtreecommitdiffstats
path: root/plugins/sudoers/regress/testsudoers/test17.sh
blob: b98b9076f11108e55c5cacba77f8653f591e6a67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
#
# Test that digest matching works with LDAP sudoCommand: ALL
#

: ${TESTSUDOERS=testsudoers}

# Create test command with known digest
TESTDIR="`pwd`/regress/testsudoers"
cat >"$TESTDIR/hello" <<EOF
#!/bin/sh
echo Hello World
EOF
chmod 755 "$TESTDIR/hello"
SHA224_DIGEST="fIoq2MAfM/PZKTbkn9RE4VZ8YHjwnwTgE28Hxw=="

$TESTSUDOERS -i ldif root "${TESTDIR}/hello" <<-EOF
dn: dc=sudo,dc=ws
objectClass: dcObject
objectClass: organization
dc: bigwheel
o: Big Wheel
description: Big Wheel

# Organizational Role for Directory Manager
dn: cn=Manager,dc=sudo,dc=ws
objectClass: organizationalRole
cn: Manager
description: Directory Manager

# SUDOers, sudo.ws
dn: ou=SUDOers,dc=sudo,dc=ws
objectClass: top
objectClass: organizationalUnit
description: SUDO Configuration Subtree
ou: SUDOers

# root, SUDOers, sudo.ws
dn: cn=root,ou=SUDOers,dc=sudo,dc=ws
objectClass: top
objectClass: sudoRole
cn: root
sudoUser: root
sudoRunAs: ALL
sudoHost: ALL
sudoCommand: sha224:$SHA224_DIGEST ALL
sudoOrder: 10
EOF

rm -f "$TESTDIR/hello"
exit 0