testsudoers: display when a password is required

This commit is contained in:
Todd C. Miller
2023-07-26 11:14:45 -06:00
parent 75256516bd
commit d62d704e55
26 changed files with 109 additions and 0 deletions

View File

@@ -6,4 +6,6 @@ ALL = ALL
host allowed host allowed
runas unmatched runas unmatched
Password required
Command unmatched Command unmatched

View File

@@ -9,6 +9,8 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Testing @include of a double-quoted path with white space Testing @include of a double-quoted path with white space
@@ -22,6 +24,8 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Testing #include of a path with escaped white space Testing #include of a path with escaped white space
@@ -35,6 +39,8 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Testing #include of a double-quoted path with white space Testing #include of a double-quoted path with white space
@@ -48,4 +54,6 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed

View File

@@ -7,6 +7,8 @@ testsudoers: unable to open sudoers.local: No such file or directory
Entries for user root: Entries for user root:
Password required
Parse error Parse error
Testing #include with garbage after the path name Testing #include with garbage after the path name
@@ -18,4 +20,6 @@ testsudoers: unable to open sudoers.local: No such file or directory
Entries for user root: Entries for user root:
Password required
Parse error Parse error

View File

@@ -14,4 +14,6 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed

View File

@@ -7,4 +7,6 @@ ALL = (ALL) ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed

View File

@@ -7,4 +7,6 @@ ALL = (ALL) sha224:fIoq2MAfM/PZKTbkn9RE4VZ8YHjwnwTgE28Hxw== ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed

View File

@@ -7,6 +7,8 @@ ALL = ^/bin/ls$ ^-[lAt]$
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Parses OK Parses OK
@@ -17,6 +19,8 @@ ALL = ^/bin/cat$ /var/log/*
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Parses OK Parses OK
@@ -27,6 +31,8 @@ ALL = /bin/cat ^/var/log/[^/]+$
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Parses OK Parses OK
@@ -37,6 +43,8 @@ ALL = /bin/*at ^/var/log/[^/]+$
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Parses OK Parses OK
@@ -47,6 +55,8 @@ ALL = /usr/bin/grep \^foo$
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Parses OK Parses OK
@@ -57,4 +67,6 @@ ALL = sudoedit ^/etc/(motd|issue|hosts)$
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed

View File

@@ -7,6 +7,8 @@ ALL = /bin/ls ""
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Parses OK Parses OK
@@ -17,4 +19,6 @@ ALL = /bin/ls ""
runas allowed runas allowed
cmnd unmatched cmnd unmatched
Password required
Command unmatched Command unmatched

View File

@@ -9,6 +9,8 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Testing #include Testing #include
@@ -22,4 +24,6 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed

View File

@@ -7,4 +7,6 @@ ALL = CHROOT=/ /bin/ls
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed

View File

@@ -7,4 +7,6 @@ ALL = (USERALIAS : GROUPALIAS) /bin/ls
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed

View File

@@ -6,4 +6,6 @@ ALL = /bin/ls
host allowed host allowed
runas unmatched runas unmatched
Password required
Command unmatched Command unmatched

View File

@@ -6,4 +6,6 @@ ALL = (root) /bin/ls
host allowed host allowed
runas unmatched runas unmatched
Password required
Command unmatched Command unmatched

View File

@@ -8,6 +8,8 @@ ALL = NOTBEFORE=20170214083000Z /bin/ls
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Parses OK Parses OK
@@ -17,6 +19,8 @@ ALL = NOTBEFORE=20170214083001Z /bin/ls
host allowed host allowed
date denied date denied
Password required
Command unmatched Command unmatched
Parses OK Parses OK
@@ -28,6 +32,8 @@ ALL = NOTAFTER=20170214083000Z /bin/ls
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Parses OK Parses OK
@@ -37,4 +43,6 @@ ALL = NOTAFTER=20170214083000Z /bin/ls
host allowed host allowed
date denied date denied
Password required
Command unmatched Command unmatched

View File

@@ -10,6 +10,8 @@ ALL = /bin/ls
User root is not allowed to change directory to / User root is not allowed to change directory to /
Password required
Command denied Command denied
User cannot override the sudoers cwd: User cannot override the sudoers cwd:
@@ -24,6 +26,8 @@ ALL = CWD=/some/where/else /bin/ls
User root is not allowed to change directory to / User root is not allowed to change directory to /
Password required
Command denied Command denied
User can set cwd if sudoers rule sets cwd to '*': User can set cwd if sudoers rule sets cwd to '*':
@@ -36,6 +40,8 @@ ALL = CWD=* /bin/ls
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
User can set cwd runcwd Defaults is '*': User can set cwd runcwd Defaults is '*':
@@ -48,4 +54,6 @@ ALL = /bin/ls
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed

View File

@@ -10,6 +10,8 @@ ALL = /bin/ls
User root is not allowed to change root directory to / User root is not allowed to change root directory to /
Password required
Command denied Command denied
User cannot override the sudoers chroot: User cannot override the sudoers chroot:
@@ -22,6 +24,8 @@ ALL = CHROOT=/some/where/else /bin/ls
runas allowed runas allowed
cmnd unmatched cmnd unmatched
Password required
Command unmatched Command unmatched
User can chroot if sudoers rule sets chroot to '*': User can chroot if sudoers rule sets chroot to '*':
@@ -34,6 +38,8 @@ ALL = CHROOT=* /bin/ls
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
User can chroot if runchroot Defaults is '*': User can chroot if runchroot Defaults is '*':
@@ -46,4 +52,6 @@ ALL = /bin/ls
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed

View File

@@ -9,4 +9,6 @@ ALL = (ALL) /bin/ls
Invalid shell for user fakeshell: /shell/does/not/exist Invalid shell for user fakeshell: /shell/does/not/exist
Password required
Command denied Command denied

View File

@@ -12,6 +12,8 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
This should match the 'ALL=ALL' rule. This should match the 'ALL=ALL' rule.
@@ -24,6 +26,8 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
This should match the 'ALL=(:staff) NOPASSWD: ALL' rule. This should match the 'ALL=(:staff) NOPASSWD: ALL' rule.
@@ -99,6 +103,8 @@ ALL = (admin : staff) NOPASSWD: ALL
host allowed host allowed
runas unmatched runas unmatched
Password required
Command unmatched Command unmatched
This should not match any rules. This should not match any rules.
@@ -114,4 +120,6 @@ ALL = (admin : users) NOPASSWD: ALL
host allowed host allowed
runas unmatched runas unmatched
Password required
Command unmatched Command unmatched

View File

@@ -9,6 +9,8 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Testing @includedir of a double-quoted path Testing @includedir of a double-quoted path
@@ -22,6 +24,8 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Testing #includedir of an unquoted path Testing #includedir of an unquoted path
@@ -35,6 +39,8 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Testing #includedir of a double-quoted path Testing #includedir of a double-quoted path
@@ -48,4 +54,6 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed

View File

@@ -2,4 +2,6 @@ testsudoers: test2.inc should be owned by uid 1
Entries for user root: Entries for user root:
Password required
Parse error Parse error

View File

@@ -2,9 +2,13 @@ testsudoers: test5.inc is world writable
Entries for user root: Entries for user root:
Password required
Parse error Parse error
testsudoers: test5.inc should be owned by gid 4294967294 testsudoers: test5.inc should be owned by gid 4294967294
Entries for user root: Entries for user root:
Password required
Parse error Parse error

View File

@@ -7,4 +7,6 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed

View File

@@ -7,4 +7,6 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed

View File

@@ -9,6 +9,8 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed
Testing #include without a newline Testing #include without a newline
@@ -22,4 +24,6 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed

View File

@@ -7,4 +7,6 @@ ALL = ALL
runas allowed runas allowed
cmnd allowed cmnd allowed
Password required
Command allowed Command allowed

View File

@@ -409,6 +409,9 @@ main(int argc, char *argv[])
SET(validated, VALIDATE_FAILURE); SET(validated, VALIDATE_FAILURE);
} }
} }
if (def_authenticate) {
puts(U_("\nPassword required"));
}
/* /*
* Exit codes: * Exit codes: