2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

Add tests for round-tripping cvtsudoers, sudoers -> LDIF -> sudoers

and LDIF -> sudoers -> LDIF.
This commit is contained in:
Todd C. Miller 2018-04-21 06:23:02 -06:00
parent 48f74db604
commit c64e57dad5
5 changed files with 129 additions and 0 deletions

View File

@ -424,6 +424,10 @@ plugins/sudoers/regress/cvtsudoers/test21.out.ok
plugins/sudoers/regress/cvtsudoers/test21.sh plugins/sudoers/regress/cvtsudoers/test21.sh
plugins/sudoers/regress/cvtsudoers/test22.out.ok plugins/sudoers/regress/cvtsudoers/test22.out.ok
plugins/sudoers/regress/cvtsudoers/test22.sh plugins/sudoers/regress/cvtsudoers/test22.sh
plugins/sudoers/regress/cvtsudoers/test23.out.ok
plugins/sudoers/regress/cvtsudoers/test23.sh
plugins/sudoers/regress/cvtsudoers/test24.out.ok
plugins/sudoers/regress/cvtsudoers/test24.sh
plugins/sudoers/regress/cvtsudoers/test3.out.ok plugins/sudoers/regress/cvtsudoers/test3.out.ok
plugins/sudoers/regress/cvtsudoers/test3.sh plugins/sudoers/regress/cvtsudoers/test3.sh
plugins/sudoers/regress/cvtsudoers/test4.out.ok plugins/sudoers/regress/cvtsudoers/test4.out.ok

View File

@ -0,0 +1,20 @@
Defaults logfile=/var/log/sudo
root ALL = (ALL) ALL
%wheel ALL = (ALL) ALL
+admins ALL = NOPASSWD: ALL
jack 128.138.204.0/24, 128.138.242.0, 128.138.243.0 = ALL
lisa 128.138.0.0/255.255.0.0 = ALL
operator ALL = /usr/sbin/dump, /usr/sbin/rdump, /usr/sbin/restore,\
/usr/sbin/rrestore, /usr/bin/mt,\
sha224:0GomF8mNN3wlDt1HD9XldjJ3SNgpFdbjO1+NsQ==\
/home/operator/bin/start_backups, /usr/bin/kill, /usr/bin/top,\
/usr/sbin/shutdown, /usr/sbin/halt, /usr/sbin/reboot, /usr/sbin/lpc,\
/usr/bin/lprm, sudoedit /etc/printcap, /usr/oper/bin/
joe ALL = /usr/bin/su operator

View File

@ -0,0 +1,8 @@
#!/bin/sh
#
# Test round-tripping of sudoers -> LDIF -> sudoers
#
exec 2>&1
./cvtsudoers -c "" -b "ou=SUDOers,dc=sudo,dc=ws" $TESTDIR/test23.out.ok | \
./cvtsudoers -c "" -i LDIF -f sudoers | grep -v '^#'

View File

@ -0,0 +1,89 @@
dn: cn=defaults,ou=SUDOers,dc=sudo,dc=ws
objectClass: top
objectClass: sudoRole
cn: defaults
description: Default sudoOption's go here
sudoOption: logfile=/var/log/sudo
dn: cn=root,ou=SUDOers,dc=sudo,dc=ws
objectClass: top
objectClass: sudoRole
cn: root
sudoUser: root
sudoHost: ALL
sudoRunAsUser: ALL
sudoCommand: ALL
sudoOrder: 1
dn: cn=%wheel,ou=SUDOers,dc=sudo,dc=ws
objectClass: top
objectClass: sudoRole
cn: %wheel
sudoUser: %wheel
sudoHost: ALL
sudoRunAsUser: ALL
sudoCommand: ALL
sudoOrder: 2
dn: cn=\+admins,ou=SUDOers,dc=sudo,dc=ws
objectClass: top
objectClass: sudoRole
cn: \+admins
sudoUser: +admins
sudoHost: ALL
sudoOption: !authenticate
sudoCommand: ALL
sudoOrder: 3
dn: cn=jack,ou=SUDOers,dc=sudo,dc=ws
objectClass: top
objectClass: sudoRole
cn: jack
sudoUser: jack
sudoHost: 128.138.204.0/24
sudoHost: 128.138.242.0
sudoHost: 128.138.243.0
sudoCommand: ALL
sudoOrder: 4
dn: cn=lisa,ou=SUDOers,dc=sudo,dc=ws
objectClass: top
objectClass: sudoRole
cn: lisa
sudoUser: lisa
sudoHost: 128.138.0.0/255.255.0.0
sudoCommand: ALL
sudoOrder: 5
dn: cn=operator,ou=SUDOers,dc=sudo,dc=ws
objectClass: top
objectClass: sudoRole
cn: operator
sudoUser: operator
sudoHost: ALL
sudoCommand: /usr/sbin/dump
sudoCommand: /usr/sbin/rdump
sudoCommand: /usr/sbin/restore
sudoCommand: /usr/sbin/rrestore
sudoCommand: /usr/bin/mt
sudoCommand: sha224:0GomF8mNN3wlDt1HD9XldjJ3SNgpFdbjO1+NsQ== /home/operator/bin/start_backups
sudoCommand: /usr/bin/kill
sudoCommand: /usr/bin/top
sudoCommand: /usr/sbin/shutdown
sudoCommand: /usr/sbin/halt
sudoCommand: /usr/sbin/reboot
sudoCommand: /usr/sbin/lpc
sudoCommand: /usr/bin/lprm
sudoCommand: sudoedit /etc/printcap
sudoCommand: /usr/oper/bin/
sudoOrder: 6
dn: cn=joe,ou=SUDOers,dc=sudo,dc=ws
objectClass: top
objectClass: sudoRole
cn: joe
sudoUser: joe
sudoHost: ALL
sudoCommand: /usr/bin/su operator
sudoOrder: 7

View File

@ -0,0 +1,8 @@
#!/bin/sh
#
# Test round-tripping of LDIF -> sudoers -> LDIF
#
exec 2>&1
./cvtsudoers -c "" -i LDIF -f sudoers $TESTDIR/test24.out.ok | \
./cvtsudoers -c "" -b "ou=SUDOers,dc=sudo,dc=ws"