2013-01-11 19:23:09 +00:00
.TH "sepolicy-generate" "8" "20121005" "" ""
.SH "NAME"
sepolicy-generate \- Generate an initial SELinux policy module template.
.SH "SYNOPSIS"
2013-10-11 14:16:57 +00:00
Common options
.B sepolicy generate [\-h ] [\-p PATH]
2013-01-11 19:23:09 +00:00
.br
2013-10-11 14:16:57 +00:00
Confined Applications
.br
2017-05-03 10:30:23 +00:00
.B sepolicy generate \- \- application [\-n NAME] [\-u USER ]command [\-w WRITE_PATH ]
2013-10-11 14:16:57 +00:00
.br
.B sepolicy generate \- \- cgi [\-n NAME] command [\-w WRITE_PATH ]
.br
.B sepolicy generate \- \- dbus [\-n NAME] command [\-w WRITE_PATH ]
.br
.B sepolicy generate \- \- inetd [\-n NAME] command [\-w WRITE_PATH ]
.br
.B sepolicy generate \- \- init [\-n NAME] command [\-w WRITE_PATH ]
Confined Users
.br
.B sepolicy generate \- \- admin_user [\-r TRANSITION_ROLE] \- n NAME
.br
.B sepolicy generate \- \- confined_admin \- n NAME [\-a ADMIN_DOMAIN] [\-u USER] [\-n NAME] [\-w WRITE_PATH]
.br
.B sepolicy generate \- \- desktop_user \- n NAME [\-w WRITE_PATH]
.br
.B sepolicy generate \- \- term_user \- n NAME [\-w WRITE_PATH]
.br
.B sepolicy generate \- \- x_user \- n NAME [\-w WRITE_PATH]
.br
Miscellaneous Policy
.br
.B sepolicy generate \- \- customize \- d DOMAIN \- n NAME [\-a ADMIN_DOMAIN]
.br
.B sepolicy generate \- \- newtype \- t type \- n NAME
.br
.B sepolicy generate \- \- sandbox \- n NAME
2013-01-11 19:23:09 +00:00
.SH "DESCRIPTION"
2013-10-11 14:16:57 +00:00
Use \fB sepolicy generate\fP to generate an SELinux policy Module.
.br
\fB sepolicy generate\fP will create 5 files.
When specifying a \fB confined application\fP you must specify a
path. \fB sepolicy generate\fP will use the rpm payload of the
2013-11-06 12:24:01 +00:00
application along with \fB nm \- D APPLICATION\fP to help it generate
2013-10-11 14:16:57 +00:00
types and policy rules for your policy files.
2013-01-11 19:23:09 +00:00
2023-06-01 14:39:12 +00:00
.B NAME.te
2013-01-11 19:23:09 +00:00
.br
2023-06-01 14:39:12 +00:00
This file can be used to define all the types enforcement rules for a particular domain.
2013-01-11 19:23:09 +00:00
2013-10-11 14:16:57 +00:00
.I Note:
2023-06-01 14:39:12 +00:00
Policy generated by \fB sepolicy generate\fP will automatically add a \fI permissive DOMAIN\fP to your \fB .te\fP file. When you are satisfied that your policy works, you need to remove the permissive line from the \fB .te\fP file to run your domain in enforcing mode.
2013-10-11 14:16:57 +00:00
2023-06-01 14:39:12 +00:00
.B NAME.if
2013-01-11 19:23:09 +00:00
.br
2023-06-01 14:39:12 +00:00
This file defines the interfaces for the types generated in the \fB .te\fP file, which can be used by other policy domains.
2013-01-11 19:23:09 +00:00
2023-06-01 14:39:12 +00:00
.B NAME.fc
2013-01-11 19:23:09 +00:00
.br
2023-06-01 14:39:12 +00:00
This file defines the default file context for the system, it takes the file types created in the \fB .te\fP file and associates
2013-01-11 19:23:09 +00:00
file paths to the types. Tools like restorecon and RPM will use these paths to put down labels.
2023-06-01 14:39:12 +00:00
.B NAME_selinux.spec
2013-01-11 19:23:09 +00:00
.br
2023-06-01 14:39:12 +00:00
This file is an RPM SPEC file that can be used to install the SELinux policy on to machines and setup the labeling. The spec file also installs the interface file and a man page describing the policy. You can use \fB sepolicy manpage \- d NAME\fP to generate the man page.
2013-01-11 19:23:09 +00:00
2023-06-01 14:39:12 +00:00
.B NAME.sh
2013-01-11 19:23:09 +00:00
.br
2023-06-01 14:39:12 +00:00
This is a helper shell script to compile, install and fix the labeling on your test system. It will also generate a man page based on the installed policy, and compile and build an RPM suitable to be installed on other machines.
2013-01-11 19:23:09 +00:00
.SH "OPTIONS"
.TP
.I \- h, \- \- help
Display help message
.TP
2013-10-11 14:16:57 +00:00
.I \- d, \- \- domain
Enter domain type(s) which you will be extending
.TP
2013-01-11 19:23:09 +00:00
.I \- n, \- \- name
2013-10-11 14:16:57 +00:00
Specify alternate name of policy. The policy will default to the executable or name specified
2013-01-11 19:23:09 +00:00
.TP
.I \- p, \- \- path
Specify the directory to store the created policy files. (Default to current working directory )
2023-06-01 14:39:12 +00:00
.TP
2013-01-11 19:23:09 +00:00
optional arguments:
.TP
2013-10-11 14:16:57 +00:00
.I \- r, \- \- role
2023-06-01 14:39:12 +00:00
Enter role(s) to which this admin user will transition
2013-10-11 14:16:57 +00:00
.TP
.I \- t, \- \- type
Enter type(s) for which you will generate new definition and rule(s)
.TP
2013-01-11 19:23:09 +00:00
.I \- u, \- \- user
SELinux user(s) which will transition to this domain
.TP
.I \- w, \- \- writepath
2023-06-01 14:39:12 +00:00
Path(s) which the confined processes need to write to
2013-01-11 19:23:09 +00:00
.TP
.I \- a, \- \- admin
2013-10-11 14:16:57 +00:00
Domain(s) which the confined admin will administrate
2013-01-11 19:23:09 +00:00
.TP
2023-06-01 14:39:12 +00:00
.I \- \- admin_user
2013-01-11 19:23:09 +00:00
Generate Policy for Administrator Login User Role
.TP
.I \- \- application
Generate Policy for User Application
.TP
.I \- \- cgi
Generate Policy for Web Application/Script (CGI)
.TP
.I \- \- confined_admin
Generate Policy for Confined Root Administrator Role
.TP
.I \- \- customize
Generate Policy for Existing Domain Type
.TP
.I \- \- dbus
Generate Policy for DBUS System Daemon
.TP
.I \- \- desktop_user
Generate Policy for Desktop Login User Role
.TP
.I \- \- inetd
Generate Policy for Internet Services Daemon
.TP
.I \- \- init
Generate Policy for Standard Init Daemon (Default)
.TP
.I \- \- newtype
2023-06-01 14:39:12 +00:00
Generate new policy for new types to add to an existing policy
2013-01-11 19:23:09 +00:00
.TP
.I \- \- sandbox
Generate Policy for Sandbox
.TP
.I \- \- term_user
Generate Policy for Minimal Terminal Login User Role
.TP
.I \- \- x_user
Generate Policy for Minimal X Windows Login User Role
.SH "EXAMPLE"
2013-10-11 14:16:57 +00:00
.B > sepolicy generate --init /usr/sbin/rwhod
2013-01-11 19:23:09 +00:00
.br
Generating Policy for /usr/sbin/rwhod named rwhod
.br
2013-11-06 12:24:01 +00:00
Created the following files:
2013-01-11 19:23:09 +00:00
.br
rwhod.te # Type Enforcement file
.br
rwhod.if # Interface file
.br
rwhod.fc # File Contexts file
.br
rwhod_selinux.spec # Spec file
.br
rwhod.sh # Setup Script
.SH "AUTHOR"
This man page was written by Daniel Walsh <dwalsh@redhat.com>
.SH "SEE ALSO"
sepolicy(8), selinux(8)