2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00
Todd C. Miller 86d2173937 Add support for matching command and args using regular expressions.
Either the command, its arguments or both may be (separate)
regular expressions.
2022-02-10 18:26:24 -07:00

34 lines
985 B
Plaintext

# Test simple command with regex args
user ALL = /bin/ls ^/etc/(hosts|motd|issue)$
# Test wildcard command with regex args
user ALL = /usr/bin/c* ^/etc/(hosts|motd|issue)$
# Test regex command with no args
user ALL = ^/usr/bin/(who|w|id|whoami)$
# Test regex command with empty args
user ALL = ^/usr/bin/(who|w|id|whoami)$ ""
# Test regex command with simple args
user ALL = ^/usr/bin/(who|w|id|whoami)$ root
# Test regex command with wildcard args
user ALL = ^/usr/bin/(who|w|id|whoami)$ -*
# Test regex command with regex args
user ALL = ^/usr/bin/(who|w|id|whoami)$ ^(-[ahi] ?)+$
# Test sudoedit with regex args
user ALL = sudoedit ^/etc/(hosts|motd|issue)$
# Test regex command with escapted '$', no args
user ALL = ^/usr/bin/\$tree$
# Combined entry
user host1 = /bin/ls ^/etc/(hosts|motd|issue)$, \
/usr/bin/c* ^/etc/(hosts|motd|issue)$ : \
host2 = ^/usr/bin/(who|w|id|whoami)$ "", \
^/usr/bin/(who|w|id|whoami)$ root : \
host3 = /bin/echo ^\$foo$