plugins/python/regress/testdata: generated data for the pyplugin tests

This commit is contained in:
Robert Manner
2020-01-07 16:08:15 +01:00
committed by Todd C. Miller
parent 5da7bd562c
commit 383ca80333
53 changed files with 142 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
Question count: 2
Question 0: <<Reason: >> (timeout: 120, msg_type=2)
Question 1: <<Secret reason: >> (timeout: 120, msg_type=5)

View File

@@ -0,0 +1,3 @@
Please provide your reason for executing ('/bin/whoami',)
conversation suspend: signal SIGTSTP (20)
conversation resume: signal was SIGCONT (18)

View File

@@ -0,0 +1,3 @@
Executed /bin/whoami
Reason: my fake reason
Hidden reason: my real secret reason

View File

@@ -0,0 +1,3 @@
Question count: 2
Question 0: <<Reason: >> (timeout: 120, msg_type=2)
Question 1: <<Secret reason: >> (timeout: 120, msg_type=5)

View File

@@ -0,0 +1 @@
Please provide your reason for executing ('/bin/whoami',)

View File

@@ -0,0 +1,3 @@
Executed /bin/whoami
Reason: my fake reason
Hidden reason: my real secret reason

View File

@@ -0,0 +1,2 @@
Question count: 2
Question 0: <<Reason: >> (timeout: 120, msg_type=2)

View File

@@ -0,0 +1,2 @@
Question count: 2
Question 0: <<Reason: >> (timeout: 120, msg_type=2)

View File

@@ -0,0 +1 @@
You did not answer in time

View File

@@ -0,0 +1 @@
Please provide your reason for executing ('/bin/whoami',)

View File

@@ -0,0 +1,4 @@
sudo.debug was called with arguments: (2, 'My demo purpose plugin shows this ERROR level debug message')
sudo.debug was called with arguments: (6, 'My demo purpose plugin shows this INFO level debug message')
sudo.options_as_dict was called with arguments: (('ModulePath=SRC_DIR/example_debugging.py', 'ClassName=DebugDemoPlugin'),)
sudo.options_as_dict returned result: {'ModulePath': 'SRC_DIR/example_debugging.py', 'ClassName': 'DebugDemoPlugin'}

View File

@@ -0,0 +1,7 @@
__init__ @ SRC_DIR/example_debugging.py:45 calls C function:
sudo.debug was called with arguments: (2, 'My demo purpose plugin shows this ERROR level debug message')
__init__ @ SRC_DIR/example_debugging.py:48 calls C function:
sudo.debug was called with arguments: (6, 'My demo purpose plugin shows this INFO level debug message')
__init__ @ SRC_DIR/example_debugging.py:58 calls C function:
sudo.options_as_dict was called with arguments: (('ModulePath=SRC_DIR/example_debugging.py', 'ClassName=DebugDemoPlugin'),)
sudo.options_as_dict returned result: {'ModulePath': 'SRC_DIR/example_debugging.py', 'ClassName': 'DebugDemoPlugin'}

View File

@@ -0,0 +1,4 @@
importing module: SRC_DIR/example_debugging.py
Extending python 'path' with 'SRC_DIR'
Closing: 0 python plugins left open
Closing: deinit python interpreter

View File

@@ -0,0 +1 @@
My demo purpose plugin shows this ERROR level debug message

View File

@@ -0,0 +1,4 @@
__init__ @ SRC_DIR/example_debugging.py:45 debugs:
My demo purpose plugin shows this ERROR level debug message
__init__ @ SRC_DIR/example_debugging.py:48 debugs:
My demo purpose plugin shows this INFO level debug message

View File

@@ -0,0 +1,2 @@
DebugDemoPlugin.__init__ was called with arguments: () {'version': '1.0', 'settings': ('debug_flags=/tmp/sudo_check_python_exampleXXXXXX/debug.log py_calls@diag', 'plugin_path=python_plugin.so'), 'user_env': (), 'user_info': (), 'plugin_options': ('ModulePath=SRC_DIR/example_debugging.py', 'ClassName=DebugDemoPlugin')}
DebugDemoPlugin.__init__ returned result: <example_debugging.DebugDemoPlugin object>

View File

@@ -0,0 +1,10 @@
DebugDemoPlugin.__init__ was called with arguments: () {'version': '1.0', 'settings': ('debug_flags=/tmp/sudo_check_python_exampleXXXXXX/debug.log py_calls@info', 'plugin_path=python_plugin.so'), 'user_env': (), 'user_info': (), 'plugin_options': ('ModulePath=SRC_DIR/example_debugging.py', 'ClassName=DebugDemoPlugin')}
DebugDemoPlugin.__init__ returned result: <example_debugging.DebugDemoPlugin object>
DebugDemoPlugin function 'show_version' is not implemented
DebugDemoPlugin function 'log_ttyin' is not implemented
DebugDemoPlugin function 'log_ttyout' is not implemented
DebugDemoPlugin function 'log_stdin' is not implemented
DebugDemoPlugin function 'log_stdout' is not implemented
DebugDemoPlugin function 'log_stderr' is not implemented
DebugDemoPlugin function 'change_winsize' is not implemented
DebugDemoPlugin function 'log_suspend' is not implemented

View File

@@ -0,0 +1 @@
Skipping close call, because there was no command run

View File

@@ -0,0 +1,4 @@
SudoGroupPlugin.__init__ was called with arguments: () {'args': ('ModulePath=SRC_DIR/example_group_plugin.py', 'ClassName=SudoGroupPlugin'), 'version': '1.0'}
SudoGroupPlugin.__init__ returned result: <example_group_plugin.SudoGroupPlugin object>
SudoGroupPlugin.query was called with arguments: ('user', 'group', ('pw_name', 'pw_passwd', 1001, 101, 'pw_gecos', 'pw_dir', 'pw_shell'))
SudoGroupPlugin.query returned result: 0

View File

@@ -0,0 +1 @@
Example sudo python plugin will log to /tmp/sudo_check_python_exampleXXXXXX/sudo.log

View File

@@ -0,0 +1,16 @@
-- Plugin STARTED --
EXEC id --help
EXEC info [
"command=/bin/id",
"runas_uid=0"
]
STD IN some standard input
STD OUT some standard output
STD ERR some standard error
SUSPEND SIGTSTP (20)
SUSPEND SIGCONT (18)
WINSIZE 200x100
TTY IN some tty input
TTY OUT some tty output
CLOSE Command returned 1
-- Plugin DESTROYED --

View File

@@ -0,0 +1 @@
Example sudo python plugin will log to /tmp/sudo_check_python_exampleXXXXXX/sudo.log

View File

@@ -0,0 +1,8 @@
-- Plugin STARTED --
EXEC cmd
EXEC info [
"command=/usr/share/cmd",
"runas_uid=0"
]
CLOSE Failed to execute, execve returned 1 (EPERM)
-- Plugin DESTROYED --

View File

@@ -0,0 +1 @@
Failed to construct plugin instance: (FileNotFoundError) [Errno 2] No such file or directory: '/some/not/writable/directory/sudo.log'

View File

@@ -0,0 +1,7 @@
Example sudo python plugin will log to /some/not/writable/directory/sudo.log
Traceback:
File "SRC_DIR/example_io_plugin.py", line 60, in __init__
self._open_log_file(path.join(log_path, "sudo.log"))
File "SRC_DIR/example_io_plugin.py", line 132, in _open_log_file
self._log_file = open(log_path, "a")

View File

@@ -0,0 +1,2 @@
Example sudo python plugin will log to /tmp/sudo_check_python_exampleXXXXXX/sudo.log
Python Example IO Plugin version: 1.0

View File

@@ -0,0 +1,2 @@
-- Plugin STARTED --
-- Plugin DESTROYED --

View File

@@ -0,0 +1 @@
The command returned with exit_status 3

View File

@@ -0,0 +1 @@
You are not allowed to run this command!

View File

@@ -0,0 +1 @@
Failed to execute command, execve syscall returned 2 (ENOENT)

View File

@@ -0,0 +1,25 @@
-- minimal --
Only the following commands are allowed: id, whoami
-- minimal (verbose) --
Only the following commands are allowed: id, whoami
-- with user --
Only the following commands are allowed: id, whoami as user 'testuser'
-- with user (verbose) --
Only the following commands are allowed: id, whoami as user 'testuser'
-- with allowed program --
You are allowed to execute command '/bin/id'
-- with allowed program (verbose) --
You are allowed to execute command '/bin/id'
Only the following commands are allowed: id, whoami
-- with denied program --
You are NOT allowed to execute command '/bin/passwd'
-- with denied program (verbose) --
You are NOT allowed to execute command '/bin/passwd'
Only the following commands are allowed: id, whoami

View File

@@ -0,0 +1,8 @@
SudoPolicyPlugin.__init__ was called with arguments: () {'version': '1.0', 'settings': (), 'user_env': (), 'user_info': (), 'plugin_options': ('ModulePath=SRC_DIR/example_policy_plugin.py', 'ClassName=SudoPolicyPlugin')}
SudoPolicyPlugin.__init__ returned result: <example_policy_plugin.SudoPolicyPlugin object>
SudoPolicyPlugin.validate was called with arguments: ()
SudoPolicyPlugin.validate returned result: None
SudoPolicyPlugin.invalidate was called with arguments: (1,)
SudoPolicyPlugin.invalidate returned result: None
SudoPolicyPlugin.invalidate was called with arguments: (0,)
SudoPolicyPlugin.invalidate returned result: None

View File

@@ -0,0 +1 @@
Python Example Policy Plugin version: 1.0

View File

@@ -0,0 +1,2 @@
No plugin class is specified for python module 'SRC_DIR/example_debugging.py'. Use 'ClassName' configuration option in 'sudo.conf'
Failed during loading plugin class

View File

@@ -0,0 +1,2 @@
No python module path is specified. Use 'ModulePath' plugin config option in 'sudo.conf'
Failed during loading plugin class

View File

@@ -0,0 +1 @@
Failed during loading plugin class: (ImportError) File 'SRC_DIR/example_debugging.py' must be owned by uid 0

View File

@@ -0,0 +1,2 @@
Failed to find plugin class 'MispelledPluginName'
Failed during loading plugin class: (AttributeError) module 'example_debugging' has no attribute 'MispelledPluginName'

View File

@@ -0,0 +1 @@
Failed during loading plugin class: (ModuleNotFoundError) No module named 'wrong_path'