doc/sudo_plugin_python: indent code examples for easier readability
This commit is contained in:

committed by
Todd C. Miller

parent
9871f7e37b
commit
3f890e4db8
@@ -136,7 +136,7 @@ Example usage in
|
|||||||
sudo.conf(@mansectform@):
|
sudo.conf(@mansectform@):
|
||||||
.nf
|
.nf
|
||||||
.sp
|
.sp
|
||||||
.RS 0n
|
.RS 6n
|
||||||
Plugin python_policy python_plugin.so ModulePath=<path> ClassName=<class>
|
Plugin python_policy python_plugin.so ModulePath=<path> ClassName=<class>
|
||||||
Plugin python_io python_plugin.so ModulePath=<path> ClassName=<class>
|
Plugin python_io python_plugin.so ModulePath=<path> ClassName=<class>
|
||||||
.RE
|
.RE
|
||||||
@@ -147,7 +147,7 @@ Example group provider plugin usage in the
|
|||||||
file:
|
file:
|
||||||
.nf
|
.nf
|
||||||
.sp
|
.sp
|
||||||
.RS 0n
|
.RS 6n
|
||||||
Defaults group_plugin="python_plugin.so ModulePath=<path> ClassName=<class>"
|
Defaults group_plugin="python_plugin.so ModulePath=<path> ClassName=<class>"
|
||||||
.RE
|
.RE
|
||||||
.fi
|
.fi
|
||||||
@@ -165,7 +165,7 @@ sudo.conf(@mansectform@).
|
|||||||
For example:
|
For example:
|
||||||
.nf
|
.nf
|
||||||
.sp
|
.sp
|
||||||
.RS 0n
|
.RS 6n
|
||||||
Plugin python_policy python_plugin.so ModulePath=<path> ClassName=<class>
|
Plugin python_policy python_plugin.so ModulePath=<path> ClassName=<class>
|
||||||
.RE
|
.RE
|
||||||
.fi
|
.fi
|
||||||
@@ -267,7 +267,7 @@ convenience function can be used to convert them to a dictionary.
|
|||||||
This function should return a result code or a tuple in the following format:
|
This function should return a result code or a tuple in the following format:
|
||||||
.nf
|
.nf
|
||||||
.sp
|
.sp
|
||||||
.RS 10n
|
.RS 12n
|
||||||
return (rc, command_info_out, argv_out, user_env_out)
|
return (rc, command_info_out, argv_out, user_env_out)
|
||||||
.RE
|
.RE
|
||||||
.fi
|
.fi
|
||||||
@@ -349,7 +349,7 @@ if the user is not present in the password database.
|
|||||||
.sp
|
.sp
|
||||||
Example conversion:
|
Example conversion:
|
||||||
.nf
|
.nf
|
||||||
.RS 6n
|
.RS 12n
|
||||||
user_pwd = pwd.struct_passwd(user_pwd) if user_pwd else None
|
user_pwd = pwd.struct_passwd(user_pwd) if user_pwd else None
|
||||||
.RE
|
.RE
|
||||||
.fi
|
.fi
|
||||||
@@ -534,7 +534,7 @@ sudo.conf(@mansectform@).
|
|||||||
For example:
|
For example:
|
||||||
.nf
|
.nf
|
||||||
.sp
|
.sp
|
||||||
.RS 0n
|
.RS 6n
|
||||||
Plugin python_io python_plugin.so ModulePath=<path> ClassName=<class>
|
Plugin python_io python_plugin.so ModulePath=<path> ClassName=<class>
|
||||||
.RE
|
.RE
|
||||||
.fi
|
.fi
|
||||||
@@ -810,7 +810,7 @@ To try it, register it by adding the following lines to
|
|||||||
\fI@sysconfdir@/sudo.conf\fR:
|
\fI@sysconfdir@/sudo.conf\fR:
|
||||||
.nf
|
.nf
|
||||||
.sp
|
.sp
|
||||||
.RS 0n
|
.RS 6n
|
||||||
Plugin python_io python_plugin.so \e
|
Plugin python_io python_plugin.so \e
|
||||||
ModulePath=@prefix@/share/doc/sudo/examples/example_io_plugin.py \e
|
ModulePath=@prefix@/share/doc/sudo/examples/example_io_plugin.py \e
|
||||||
ClassName=SudoIOPlugin
|
ClassName=SudoIOPlugin
|
||||||
@@ -823,7 +823,7 @@ file.
|
|||||||
For example:
|
For example:
|
||||||
.nf
|
.nf
|
||||||
.sp
|
.sp
|
||||||
.RS 0n
|
.RS 6n
|
||||||
Defaults group_plugin="python_plugin.so ModulePath=<path> ClassName=<class>"
|
Defaults group_plugin="python_plugin.so ModulePath=<path> ClassName=<class>"
|
||||||
.RE
|
.RE
|
||||||
.fi
|
.fi
|
||||||
@@ -904,7 +904,7 @@ To try it, register it in the
|
|||||||
file by adding the following lines:
|
file by adding the following lines:
|
||||||
.nf
|
.nf
|
||||||
.sp
|
.sp
|
||||||
.RS 0n
|
.RS 6n
|
||||||
Defaults group_plugin="python_plugin.so \e
|
Defaults group_plugin="python_plugin.so \e
|
||||||
ModulePath=@prefix@/share/doc/sudo/examples/example_group_plugin.py \e
|
ModulePath=@prefix@/share/doc/sudo/examples/example_group_plugin.py \e
|
||||||
ClassName=SudoGroupPlugin"
|
ClassName=SudoGroupPlugin"
|
||||||
@@ -923,7 +923,7 @@ user.
|
|||||||
For example:
|
For example:
|
||||||
.nf
|
.nf
|
||||||
.sp
|
.sp
|
||||||
.RS 0n
|
.RS 6n
|
||||||
%:mygroup ALL=(ALL) NOPASSWD: ALL
|
%:mygroup ALL=(ALL) NOPASSWD: ALL
|
||||||
.RE
|
.RE
|
||||||
.fi
|
.fi
|
||||||
@@ -1063,7 +1063,7 @@ To try it, register it by adding the following lines to
|
|||||||
\fI@sysconfdir@/sudo.conf\fR:
|
\fI@sysconfdir@/sudo.conf\fR:
|
||||||
.nf
|
.nf
|
||||||
.sp
|
.sp
|
||||||
.RS 0n
|
.RS 6n
|
||||||
Plugin python_io python_plugin.so \e
|
Plugin python_io python_plugin.so \e
|
||||||
ModulePath=@prefix@/share/doc/sudo/examples/example_conversation.py \e
|
ModulePath=@prefix@/share/doc/sudo/examples/example_conversation.py \e
|
||||||
ClassName=ReasonLoggerIOPlugin
|
ClassName=ReasonLoggerIOPlugin
|
||||||
@@ -1124,7 +1124,7 @@ For example, to store debug output in
|
|||||||
use a line like the following:
|
use a line like the following:
|
||||||
.nf
|
.nf
|
||||||
.sp
|
.sp
|
||||||
.RS 0n
|
.RS 6n
|
||||||
Debug python_plugin.so /var/log/sudo_python_debug \e
|
Debug python_plugin.so /var/log/sudo_python_debug \e
|
||||||
plugin@trace,c_calls@trace
|
plugin@trace,c_calls@trace
|
||||||
.RE
|
.RE
|
||||||
@@ -1139,7 +1139,7 @@ For example to just see the debug output of
|
|||||||
calls, use:
|
calls, use:
|
||||||
.nf
|
.nf
|
||||||
.sp
|
.sp
|
||||||
.RS 0n
|
.RS 6n
|
||||||
Debug python_plugin.so /var/log/sudo_python_debug plugin@trace
|
Debug python_plugin.so /var/log/sudo_python_debug plugin@trace
|
||||||
.RE
|
.RE
|
||||||
.fi
|
.fi
|
||||||
@@ -1228,7 +1228,7 @@ To try it, register it by adding the following lines to
|
|||||||
\fI@sysconfdir@/sudo.conf\fR:
|
\fI@sysconfdir@/sudo.conf\fR:
|
||||||
.nf
|
.nf
|
||||||
.sp
|
.sp
|
||||||
.RS 0n
|
.RS 6n
|
||||||
Plugin python_io python_plugin.so \e
|
Plugin python_io python_plugin.so \e
|
||||||
ModulePath=@prefix@/share/doc/sudo/examples/example_debugging.py \e
|
ModulePath=@prefix@/share/doc/sudo/examples/example_debugging.py \e
|
||||||
ClassName=DebugDemoPlugin
|
ClassName=DebugDemoPlugin
|
||||||
|
@@ -116,7 +116,7 @@ plugin it is loading as arguments.
|
|||||||
.Pp
|
.Pp
|
||||||
Example usage in
|
Example usage in
|
||||||
.Xr sudo.conf @mansectform@ :
|
.Xr sudo.conf @mansectform@ :
|
||||||
.Bd -literal
|
.Bd -literal -offset indent
|
||||||
Plugin python_policy python_plugin.so ModulePath=<path> ClassName=<class>
|
Plugin python_policy python_plugin.so ModulePath=<path> ClassName=<class>
|
||||||
Plugin python_io python_plugin.so ModulePath=<path> ClassName=<class>
|
Plugin python_io python_plugin.so ModulePath=<path> ClassName=<class>
|
||||||
.Ed
|
.Ed
|
||||||
@@ -124,7 +124,7 @@ Plugin python_io python_plugin.so ModulePath=<path> ClassName=<class>
|
|||||||
Example group provider plugin usage in the
|
Example group provider plugin usage in the
|
||||||
.Em sudoers
|
.Em sudoers
|
||||||
file:
|
file:
|
||||||
.Bd -literal
|
.Bd -literal -offset indent
|
||||||
Defaults group_plugin="python_plugin.so ModulePath=<path> ClassName=<class>"
|
Defaults group_plugin="python_plugin.so ModulePath=<path> ClassName=<class>"
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
@@ -139,7 +139,7 @@ The name of the class implementing the sudo Python plugin.
|
|||||||
Policy plugins must be registered in
|
Policy plugins must be registered in
|
||||||
.Xr sudo.conf @mansectform@ .
|
.Xr sudo.conf @mansectform@ .
|
||||||
For example:
|
For example:
|
||||||
.Bd -literal
|
.Bd -literal -offset indent
|
||||||
Plugin python_policy python_plugin.so ModulePath=<path> ClassName=<class>
|
Plugin python_policy python_plugin.so ModulePath=<path> ClassName=<class>
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
@@ -227,7 +227,7 @@ convenience function can be used to convert them to a dictionary.
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
This function should return a result code or a tuple in the following format:
|
This function should return a result code or a tuple in the following format:
|
||||||
.Bd -literal -offset 4n
|
.Bd -literal -offset indent
|
||||||
return (rc, command_info_out, argv_out, user_env_out)
|
return (rc, command_info_out, argv_out, user_env_out)
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
@@ -297,7 +297,7 @@ Convertible to pwd.struct_passwd or
|
|||||||
if the user is not present in the password database.
|
if the user is not present in the password database.
|
||||||
.Pp
|
.Pp
|
||||||
Example conversion:
|
Example conversion:
|
||||||
.Bd -literal -compact
|
.Bd -literal -compact -offset indent
|
||||||
user_pwd = pwd.struct_passwd(user_pwd) if user_pwd else None
|
user_pwd = pwd.struct_passwd(user_pwd) if user_pwd else None
|
||||||
.Ed
|
.Ed
|
||||||
.It Fa user_env
|
.It Fa user_env
|
||||||
@@ -432,7 +432,7 @@ in addition to another policy plugin, such as
|
|||||||
I/O plugins must be registered in
|
I/O plugins must be registered in
|
||||||
.Xr sudo.conf @mansectform@ .
|
.Xr sudo.conf @mansectform@ .
|
||||||
For example:
|
For example:
|
||||||
.Bd -literal
|
.Bd -literal -offset indent
|
||||||
Plugin python_io python_plugin.so ModulePath=<path> ClassName=<class>
|
Plugin python_io python_plugin.so ModulePath=<path> ClassName=<class>
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
@@ -653,7 +653,7 @@ system call, otherwise 0.
|
|||||||
Sudo ships a Python I/O plugin example.
|
Sudo ships a Python I/O plugin example.
|
||||||
To try it, register it by adding the following lines to
|
To try it, register it by adding the following lines to
|
||||||
.Pa @sysconfdir@/sudo.conf :
|
.Pa @sysconfdir@/sudo.conf :
|
||||||
.Bd -literal
|
.Bd -literal -offset indent
|
||||||
Plugin python_io python_plugin.so \e
|
Plugin python_io python_plugin.so \e
|
||||||
ModulePath=@prefix@/share/doc/sudo/examples/example_io_plugin.py \e
|
ModulePath=@prefix@/share/doc/sudo/examples/example_io_plugin.py \e
|
||||||
ClassName=SudoIOPlugin
|
ClassName=SudoIOPlugin
|
||||||
@@ -663,7 +663,7 @@ A group provider plugin is registered in the
|
|||||||
.Xr sudoers @mansectform@
|
.Xr sudoers @mansectform@
|
||||||
file.
|
file.
|
||||||
For example:
|
For example:
|
||||||
.Bd -literal
|
.Bd -literal -offset indent
|
||||||
Defaults group_plugin="python_plugin.so ModulePath=<path> ClassName=<class>"
|
Defaults group_plugin="python_plugin.so ModulePath=<path> ClassName=<class>"
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
@@ -727,7 +727,7 @@ Sudo ships a Python group plugin example.
|
|||||||
To try it, register it in the
|
To try it, register it in the
|
||||||
.Em sudoers
|
.Em sudoers
|
||||||
file by adding the following lines:
|
file by adding the following lines:
|
||||||
.Bd -literal
|
.Bd -literal -offset indent
|
||||||
Defaults group_plugin="python_plugin.so \e
|
Defaults group_plugin="python_plugin.so \e
|
||||||
ModulePath=@prefix@/share/doc/sudo/examples/example_group_plugin.py \e
|
ModulePath=@prefix@/share/doc/sudo/examples/example_group_plugin.py \e
|
||||||
ClassName=SudoGroupPlugin"
|
ClassName=SudoGroupPlugin"
|
||||||
@@ -743,7 +743,7 @@ If you add a rule that uses this group, it will affect the
|
|||||||
.Em test
|
.Em test
|
||||||
user.
|
user.
|
||||||
For example:
|
For example:
|
||||||
.Bd -literal
|
.Bd -literal -offset indent
|
||||||
%:mygroup ALL=(ALL) NOPASSWD: ALL
|
%:mygroup ALL=(ALL) NOPASSWD: ALL
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
@@ -863,7 +863,7 @@ or the user interrupted the conversation by pressing control-C.
|
|||||||
Sudo ships with an example plugin demonstrating the Python conversation API.
|
Sudo ships with an example plugin demonstrating the Python conversation API.
|
||||||
To try it, register it by adding the following lines to
|
To try it, register it by adding the following lines to
|
||||||
.Pa @sysconfdir@/sudo.conf :
|
.Pa @sysconfdir@/sudo.conf :
|
||||||
.Bd -literal
|
.Bd -literal -offset indent
|
||||||
Plugin python_io python_plugin.so \e
|
Plugin python_io python_plugin.so \e
|
||||||
ModulePath=@prefix@/share/doc/sudo/examples/example_conversation.py \e
|
ModulePath=@prefix@/share/doc/sudo/examples/example_conversation.py \e
|
||||||
ClassName=ReasonLoggerIOPlugin
|
ClassName=ReasonLoggerIOPlugin
|
||||||
@@ -918,7 +918,7 @@ with the program set to
|
|||||||
For example, to store debug output in
|
For example, to store debug output in
|
||||||
.Pa /var/log/sudo_python_debug ,
|
.Pa /var/log/sudo_python_debug ,
|
||||||
use a line like the following:
|
use a line like the following:
|
||||||
.Bd -literal
|
.Bd -literal -offset indent
|
||||||
Debug python_plugin.so /var/log/sudo_python_debug \e
|
Debug python_plugin.so /var/log/sudo_python_debug \e
|
||||||
plugin@trace,c_calls@trace
|
plugin@trace,c_calls@trace
|
||||||
.Ed
|
.Ed
|
||||||
@@ -930,7 +930,7 @@ strings, separated by commas
|
|||||||
For example to just see the debug output of
|
For example to just see the debug output of
|
||||||
.Fn sudo.debug
|
.Fn sudo.debug
|
||||||
calls, use:
|
calls, use:
|
||||||
.Bd -literal
|
.Bd -literal -offset indent
|
||||||
Debug python_plugin.so /var/log/sudo_python_debug plugin@trace
|
Debug python_plugin.so /var/log/sudo_python_debug plugin@trace
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
@@ -1000,7 +1000,7 @@ one or more messages to log
|
|||||||
Sudo ships an example debug plugin by default.
|
Sudo ships an example debug plugin by default.
|
||||||
To try it, register it by adding the following lines to
|
To try it, register it by adding the following lines to
|
||||||
.Pa @sysconfdir@/sudo.conf :
|
.Pa @sysconfdir@/sudo.conf :
|
||||||
.Bd -literal
|
.Bd -literal -offset indent
|
||||||
Plugin python_io python_plugin.so \e
|
Plugin python_io python_plugin.so \e
|
||||||
ModulePath=@prefix@/share/doc/sudo/examples/example_debugging.py \e
|
ModulePath=@prefix@/share/doc/sudo/examples/example_debugging.py \e
|
||||||
ClassName=DebugDemoPlugin
|
ClassName=DebugDemoPlugin
|
||||||
|
Reference in New Issue
Block a user