Eric Paris | 1dce0bf | 2013-01-11 14:23:09 -0500 | [diff] [blame] | 1 | .TH "sepolicy-generate" "8" "20121005" "" "" |
| 2 | .SH "NAME" |
| 3 | sepolicy-generate \- Generate an initial SELinux policy module template. |
| 4 | |
| 5 | .SH "SYNOPSIS" |
| 6 | |
Dan Walsh | e6a1298 | 2013-10-11 10:16:57 -0400 | [diff] [blame] | 7 | Common options |
| 8 | |
| 9 | .B sepolicy generate [\-h ] [\-p PATH] |
| 10 | |
Eric Paris | 1dce0bf | 2013-01-11 14:23:09 -0500 | [diff] [blame] | 11 | .br |
Dan Walsh | e6a1298 | 2013-10-11 10:16:57 -0400 | [diff] [blame] | 12 | |
| 13 | Confined Applications |
| 14 | |
| 15 | .br |
Dan Walsh | c0ec882 | 2017-05-03 12:30:23 +0200 | [diff] [blame] | 16 | .B sepolicy generate \-\-application [\-n NAME] [\-u USER ]command [\-w WRITE_PATH ] |
Dan Walsh | e6a1298 | 2013-10-11 10:16:57 -0400 | [diff] [blame] | 17 | .br |
| 18 | .B sepolicy generate \-\-cgi [\-n NAME] command [\-w WRITE_PATH ] |
| 19 | .br |
| 20 | .B sepolicy generate \-\-dbus [\-n NAME] command [\-w WRITE_PATH ] |
| 21 | .br |
| 22 | .B sepolicy generate \-\-inetd [\-n NAME] command [\-w WRITE_PATH ] |
| 23 | .br |
| 24 | .B sepolicy generate \-\-init [\-n NAME] command [\-w WRITE_PATH ] |
| 25 | |
| 26 | Confined Users |
| 27 | |
| 28 | .br |
| 29 | .B sepolicy generate \-\-admin_user [\-r TRANSITION_ROLE] \-n NAME |
| 30 | .br |
| 31 | .B sepolicy generate \-\-confined_admin \-n NAME [\-a ADMIN_DOMAIN] [\-u USER] [\-n NAME] [\-w WRITE_PATH] |
| 32 | .br |
| 33 | .B sepolicy generate \-\-desktop_user \-n NAME [\-w WRITE_PATH] |
| 34 | .br |
| 35 | .B sepolicy generate \-\-term_user \-n NAME [\-w WRITE_PATH] |
| 36 | .br |
| 37 | .B sepolicy generate \-\-x_user \-n NAME [\-w WRITE_PATH] |
| 38 | .br |
| 39 | |
| 40 | Miscellaneous Policy |
| 41 | |
| 42 | .br |
| 43 | .B sepolicy generate \-\-customize \-d DOMAIN \-n NAME [\-a ADMIN_DOMAIN] |
| 44 | .br |
| 45 | .B sepolicy generate \-\-newtype \-t type \-n NAME |
| 46 | .br |
| 47 | .B sepolicy generate \-\-sandbox \-n NAME |
Eric Paris | 1dce0bf | 2013-01-11 14:23:09 -0500 | [diff] [blame] | 48 | |
| 49 | .SH "DESCRIPTION" |
Dan Walsh | e6a1298 | 2013-10-11 10:16:57 -0400 | [diff] [blame] | 50 | Use \fBsepolicy generate\fP to generate an SELinux policy Module. |
| 51 | |
| 52 | .br |
| 53 | \fBsepolicy generate\fP will create 5 files. |
| 54 | |
| 55 | When specifying a \fBconfined application\fP you must specify a |
| 56 | path. \fBsepolicy generate\fP will use the rpm payload of the |
Laurent Bigonville | 2e93833 | 2013-11-06 13:24:01 +0100 | [diff] [blame] | 57 | application along with \fBnm \-D APPLICATION\fP to help it generate |
Dan Walsh | e6a1298 | 2013-10-11 10:16:57 -0400 | [diff] [blame] | 58 | types and policy rules for your policy files. |
Eric Paris | 1dce0bf | 2013-01-11 14:23:09 -0500 | [diff] [blame] | 59 | |
| 60 | .B Type Enforcing File NAME.te |
| 61 | .br |
| 62 | This file can be used to define all the types rules for a particular domain. |
| 63 | |
Dan Walsh | e6a1298 | 2013-10-11 10:16:57 -0400 | [diff] [blame] | 64 | .I Note: |
| 65 | Policy generated by \fBsepolicy generate\fP will automatically add a permissive DOMAIN to your te file. When you are satisfied that your policy works, you need to remove the permissive line from the te file to run your domain in enforcing mode. |
| 66 | |
Eric Paris | 1dce0bf | 2013-01-11 14:23:09 -0500 | [diff] [blame] | 67 | .B Interface File NAME.if |
| 68 | .br |
| 69 | This file defines the interfaces for the types generated in the te file, which can be used by other policy domains. |
| 70 | |
| 71 | .B File Context NAME.fc |
| 72 | .br |
| 73 | This file defines the default file context for the system, it takes the file types created in the te file and associates |
| 74 | file paths to the types. Tools like restorecon and RPM will use these paths to put down labels. |
| 75 | |
| 76 | .B RPM Spec File NAME_selinux.spec |
| 77 | .br |
Laurent Bigonville | 2e93833 | 2013-11-06 13:24:01 +0100 | [diff] [blame] | 78 | 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 \fBsepolicy manpage \-d NAME\fP to generate the man page. |
Eric Paris | 1dce0bf | 2013-01-11 14:23:09 -0500 | [diff] [blame] | 79 | |
| 80 | .B Shell File NAME.sh |
| 81 | .br |
| 82 | 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 |
| 83 | compile and build an RPM suitable to be installed on other machines |
| 84 | |
| 85 | If a generate is possible, this tool will print out all generate paths from the source domain to the target domain |
| 86 | |
| 87 | .SH "OPTIONS" |
| 88 | .TP |
| 89 | .I \-h, \-\-help |
| 90 | Display help message |
| 91 | .TP |
Dan Walsh | e6a1298 | 2013-10-11 10:16:57 -0400 | [diff] [blame] | 92 | .I \-d, \-\-domain |
| 93 | Enter domain type(s) which you will be extending |
| 94 | .TP |
Eric Paris | 1dce0bf | 2013-01-11 14:23:09 -0500 | [diff] [blame] | 95 | .I \-n, \-\-name |
Dan Walsh | e6a1298 | 2013-10-11 10:16:57 -0400 | [diff] [blame] | 96 | Specify alternate name of policy. The policy will default to the executable or name specified |
Eric Paris | 1dce0bf | 2013-01-11 14:23:09 -0500 | [diff] [blame] | 97 | .TP |
| 98 | .I \-p, \-\-path |
| 99 | Specify the directory to store the created policy files. (Default to current working directory ) |
| 100 | optional arguments: |
| 101 | .TP |
Dan Walsh | e6a1298 | 2013-10-11 10:16:57 -0400 | [diff] [blame] | 102 | .I \-r, \-\-role |
| 103 | Enter role(s) to which this admin user will transition. |
| 104 | .TP |
| 105 | .I \-t, \-\-type |
| 106 | Enter type(s) for which you will generate new definition and rule(s) |
| 107 | .TP |
Eric Paris | 1dce0bf | 2013-01-11 14:23:09 -0500 | [diff] [blame] | 108 | .I \-u, \-\-user |
| 109 | SELinux user(s) which will transition to this domain |
| 110 | .TP |
| 111 | .I \-w, \-\-writepath |
| 112 | Path(s) which the confined processes need to write |
| 113 | .TP |
| 114 | .I \-a, \-\-admin |
Dan Walsh | e6a1298 | 2013-10-11 10:16:57 -0400 | [diff] [blame] | 115 | Domain(s) which the confined admin will administrate |
Eric Paris | 1dce0bf | 2013-01-11 14:23:09 -0500 | [diff] [blame] | 116 | .TP |
| 117 | .I \-\-admin_user |
| 118 | Generate Policy for Administrator Login User Role |
| 119 | .TP |
| 120 | .I \-\-application |
| 121 | Generate Policy for User Application |
| 122 | .TP |
| 123 | .I \-\-cgi |
| 124 | Generate Policy for Web Application/Script (CGI) |
| 125 | .TP |
| 126 | .I \-\-confined_admin |
| 127 | Generate Policy for Confined Root Administrator Role |
| 128 | .TP |
| 129 | .I \-\-customize |
| 130 | Generate Policy for Existing Domain Type |
| 131 | .TP |
| 132 | .I \-\-dbus |
| 133 | Generate Policy for DBUS System Daemon |
| 134 | .TP |
| 135 | .I \-\-desktop_user |
| 136 | Generate Policy for Desktop Login User Role |
| 137 | .TP |
| 138 | .I \-\-inetd |
| 139 | Generate Policy for Internet Services Daemon |
| 140 | .TP |
| 141 | .I \-\-init |
| 142 | Generate Policy for Standard Init Daemon (Default) |
| 143 | .TP |
| 144 | .I \-\-newtype |
| 145 | Generate new policy for new types to add to an existing policy. |
| 146 | .TP |
| 147 | .I \-\-sandbox |
| 148 | Generate Policy for Sandbox |
| 149 | .TP |
| 150 | .I \-\-term_user |
| 151 | Generate Policy for Minimal Terminal Login User Role |
| 152 | .TP |
| 153 | .I \-\-x_user |
| 154 | Generate Policy for Minimal X Windows Login User Role |
| 155 | |
| 156 | .SH "EXAMPLE" |
Dan Walsh | e6a1298 | 2013-10-11 10:16:57 -0400 | [diff] [blame] | 157 | .B > sepolicy generate --init /usr/sbin/rwhod |
Eric Paris | 1dce0bf | 2013-01-11 14:23:09 -0500 | [diff] [blame] | 158 | .br |
| 159 | Generating Policy for /usr/sbin/rwhod named rwhod |
| 160 | .br |
Laurent Bigonville | 2e93833 | 2013-11-06 13:24:01 +0100 | [diff] [blame] | 161 | Created the following files: |
Eric Paris | 1dce0bf | 2013-01-11 14:23:09 -0500 | [diff] [blame] | 162 | .br |
| 163 | rwhod.te # Type Enforcement file |
| 164 | .br |
| 165 | rwhod.if # Interface file |
| 166 | .br |
| 167 | rwhod.fc # File Contexts file |
| 168 | .br |
| 169 | rwhod_selinux.spec # Spec file |
| 170 | .br |
| 171 | rwhod.sh # Setup Script |
| 172 | |
| 173 | .SH "AUTHOR" |
| 174 | This man page was written by Daniel Walsh <dwalsh@redhat.com> |
| 175 | |
| 176 | .SH "SEE ALSO" |
| 177 | sepolicy(8), selinux(8) |