1 <?xml version='1.0' encoding='UTF-8'?><chapter xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en-US" xml:id="managingsecurity">
2 <title xml:id="managingsecurity.title">Managing Security in a Lustre File System</title>
3 <para>This chapter describes security features of the Lustre file system and
4 includes the following sections:</para>
7 <para><xref linkend="managingSecurity.acl"/></para>
10 <para><xref linkend="managingSecurity.root_squash"/></para>
13 <section xml:id="managingSecurity.acl">
14 <title><indexterm><primary>Access Control List (ACL)</primary></indexterm>
16 <para>An access control list (ACL), is a set of data that informs an
17 operating system about permissions or access rights that each user or
18 group has to specific system objects, such as directories or files. Each
19 object has a unique security attribute that identifies users who have
20 access to it. The ACL lists each object and user access privileges such as
21 read, write or execute.</para>
22 <section xml:id="managingSecurity.acl.howItWorks" remap="h3">
23 <title><indexterm><primary>Access Control List (ACL)</primary><secondary>
24 how they work</secondary></indexterm>How ACLs Work</title>
25 <para>Implementing ACLs varies between operating systems. Systems that
26 support the Portable Operating System Interface (POSIX) family of
27 standards share a simple yet powerful file system permission model,
28 which should be well-known to the Linux/UNIX administrator. ACLs add
29 finer-grained permissions to this model, allowing for more complicated
30 permission schemes. For a detailed explanation of ACLs on a Linux
31 operating system, refer to the SUSE Labs article
32 <link xl:href="http://wiki.lustre.org/images/5/57/PosixAccessControlInLinux.pdf">
33 Posix Access Control Lists on Linux</link>.</para>
34 <para>We have implemented ACLs according to this model. The Lustre
35 software works with the standard Linux ACL tools, setfacl, getfacl, and
36 the historical chacl, normally installed with the ACL package.</para>
38 <para>ACL support is a system-range feature, meaning that all clients
39 have ACL enabled or not. You cannot specify which clients should
43 <section xml:id="managingSecurity.acl.using" remap="h3">
45 <primary>Access Control List (ACL)</primary>
46 <secondary>using</secondary>
47 </indexterm>Using ACLs with the Lustre Software</title>
48 <para>POSIX Access Control Lists (ACLs) can be used with the Lustre
49 software. An ACL consists of file entries representing permissions based
50 on standard POSIX file system object permissions that define three
51 classes of user (owner, group and other). Each class is associated with
52 a set of permissions [read (r), write (w) and execute (x)].</para>
55 <para>Owner class permissions define access privileges of the file
59 <para>Group class permissions define access privileges of the owning
63 <para>Other class permissions define access privileges of all users
64 not in the owner or group class.</para>
67 <para>The <literal>ls -l</literal> command displays the owner, group, and
68 other class permissions in the first column of its output (for example,
69 <literal>-rw-r- --</literal> for a regular file with read and write
70 access for the owner class, read access for the group class, and no
71 access for others).</para>
72 <para>Minimal ACLs have three entries. Extended ACLs have more than the
73 three entries. Extended ACLs also contain a mask entry and may contain
74 any number of named user and named group entries.</para>
75 <para>The MDS needs to be configured to enable ACLs. Use
76 <literal>--mountfsoptions</literal> to enable ACLs when creating your
78 <screen>$ mkfs.lustre --fsname spfs --mountfsoptions=acl --mdt -mgs /dev/sda</screen>
79 <para>Alternately, you can enable ACLs at run time by using the
80 <literal>--acl</literal> option with <literal>mkfs.lustre</literal>:
82 <screen>$ mount -t lustre -o acl /dev/sda /mnt/mdt</screen>
83 <para>To check ACLs on the MDS:</para>
84 <screen>$ lctl get_param -n mdc.home-MDT0000-mdc-*.connect_flags | grep acl acl</screen>
85 <para>To mount the client with no ACLs:</para>
86 <screen>$ mount -t lustre -o noacl ibmds2@o2ib:/home /home</screen>
87 <para>ACLs are enabled in a Lustre file system on a system-wide basis;
88 either all clients enable ACLs or none do. Activating ACLs is controlled
89 by MDS mount options <literal>acl</literal> / <literal>noacl</literal>
90 (enable/disable ACLs). Client-side mount options acl/noacl are ignored.
91 You do not need to change the client configuration, and the
92 'acl' string will not appear in the client /etc/mtab. The
93 client acl mount option is no longer needed. If a client is mounted with
94 that option, then this message appears in the MDS syslog:</para>
95 <screen>...MDS requires ACL support but client does not</screen>
96 <para>The message is harmless but indicates a configuration issue, which
97 should be corrected.</para>
98 <para>If ACLs are not enabled on the MDS, then any attempts to reference
99 an ACL on a client return an Operation not supported error.</para>
101 <section xml:id="managingSecurity.acl.examples" remap="h3">
103 <primary>Access Control List (ACL)</primary>
104 <secondary>examples</secondary>
105 </indexterm>Examples</title>
106 <para>These examples are taken directly from the POSIX paper referenced
107 above. ACLs on a Lustre file system work exactly like ACLs on any Linux
108 file system. They are manipulated with the standard tools in the
109 standard manner. Below, we create a directory and allow a specific user
111 <screen>[root@client lustre]# umask 027
112 [root@client lustre]# mkdir rain
113 [root@client lustre]# ls -ld rain
114 drwxr-x--- 2 root root 4096 Feb 20 06:50 rain
115 [root@client lustre]# getfacl rain
123 [root@client lustre]# setfacl -m user:chirag:rwx rain
124 [root@client lustre]# ls -ld rain
125 drwxrwx---+ 2 root root 4096 Feb 20 06:50 rain
126 [root@client lustre]# getfacl --omit-header rain
134 <section xml:id="managingSecurity.root_squash">
136 <primary>root squash</primary>
137 </indexterm>Using Root Squash</title>
138 <para>Root squash is a security feature which restricts super-user access
139 rights to a Lustre file system. Without the root squash feature enabled,
140 Lustre file system users on untrusted clients could access or modify files
141 owned by root on the file system, including deleting them. Using the root
142 squash feature restricts file access/modifications as the root user to
143 only the specified clients. Note, however, that this does
144 <emphasis>not</emphasis> prevent users on insecure clients from accessing
145 files owned by <emphasis>other</emphasis> users.</para>
146 <para>The root squash feature works by re-mapping the user ID (UID) and
147 group ID (GID) of the root user to a UID and GID specified by the system
148 administrator, via the Lustre configuration management server (MGS). The
149 root squash feature also enables the Lustre file system administrator to
150 specify a set of client for which UID/GID re-mapping does not apply.
152 <section xml:id="managingSecurity.root_squash.config" remap="h3">
154 <primary>root squash</primary>
155 <secondary>configuring</secondary>
156 </indexterm>Configuring Root Squash</title>
157 <para>Root squash functionality is managed by two configuration
158 parameters, <literal>root_squash</literal> and
159 <literal>nosquash_nids</literal>.</para>
162 <para>The <literal>root_squash</literal> parameter specifies the UID
163 and GID with which the root user accesses the Lustre file system.
167 <para>The <literal>nosquash_nids</literal> parameter specifies the set
168 of clients to which root squash does not apply. LNet NID range
169 syntax is used for this parameter (see the NID range syntax rules
170 described in <xref linkend="managingSecurity.root_squash"/>). For
174 <screen>nosquash_nids=172.16.245.[0-255/2]@tcp</screen>
175 <para>In this example, root squash does not apply to TCP clients on subnet
176 172.16.245.0 that have an even number as the last component of their IP
179 <section xml:id="managingSecurity.root_squash.tuning">
181 <primary>root squash</primary><secondary>enabling</secondary>
182 </indexterm>Enabling and Tuning Root Squash</title>
183 <para>The default value for <literal>nosquash_nids</literal> is NULL,
184 which means that root squashing applies to all clients. Setting the root
185 squash UID and GID to 0 turns root squash off.</para>
186 <para>Root squash parameters can be set when the MDT is created
187 (<literal>mkfs.lustre --mdt</literal>). For example:</para>
188 <screen>mds# mkfs.lustre --reformat --fsname=testfs --mdt --mgs \
189 --param "mdt.root_squash=500:501" \
190 --param "mdt.nosquash_nids='0@elan1 192.168.1.[10,11]'" /dev/sda1</screen>
191 <para>Root squash parameters can also be changed on an unmounted device
192 with <literal>tunefs.lustre</literal>. For example:</para>
193 <screen>tunefs.lustre --param "mdt.root_squash=65534:65534" \
194 --param "mdt.nosquash_nids=192.168.0.13@tcp0" /dev/sda1
196 <para>Root squash parameters can also be changed with the
197 <literal>lctl conf_param</literal> command. For example:</para>
198 <screen>mgs# lctl conf_param testfs.mdt.root_squash="1000:101"
199 mgs# lctl conf_param testfs.mdt.nosquash_nids="*@tcp"</screen>
201 <para>When using the lctl conf_param command, keep in mind:</para>
204 <para><literal>lctl conf_param</literal> must be run on a live MGS
208 <para><literal>lctl conf_param</literal> causes the parameter to
209 change on all MDSs</para>
212 <para><literal>lctl conf_param</literal> is to be used once per a
217 <para>The <literal>nosquash_nids</literal> list can be cleared with:
219 <screen>mgs# lctl conf_param testfs.mdt.nosquash_nids="NONE"</screen>
221 <screen>mgs# lctl conf_param testfs.mdt.nosquash_nids="clear"</screen>
222 <para>If the <literal>nosquash_nids</literal> value consists of several
223 NID ranges (e.g. <literal>0@elan</literal>, <literal>1@elan1</literal>),
224 the list of NID ranges must be quoted with single (') or double
225 ('') quotation marks. List elements must be separated with a
226 space. For example:</para>
227 <screen>mds# mkfs.lustre ... --param "mdt.nosquash_nids='0@elan1 1@elan2'" /dev/sda1
228 lctl conf_param testfs.mdt.nosquash_nids="24@elan 15@elan1"</screen>
229 <para>These are examples of incorrect syntax:</para>
230 <screen>mds# mkfs.lustre ... --param "mdt.nosquash_nids=0@elan1 1@elan2" /dev/sda1
231 lctl conf_param testfs.mdt.nosquash_nids=24@elan 15@elan1</screen>
232 <para>To check root squash parameters, use the lctl get_param command:
234 <screen>mds# lctl get_param mdt.testfs-MDT0000.root_squash
235 lctl get_param mdt.*.nosquash_nids</screen>
237 <para>An empty nosquash_nids list is reported as NONE.</para>
240 <section xml:id="managingSecurity.root_squash.tips" remap="h3">
242 <primary>root squash</primary>
243 <secondary>tips</secondary>
244 </indexterm>Tips on Using Root Squash</title>
245 <para>Lustre configuration management limits root squash in several ways.
249 <para>The <literal>lctl conf_param</literal> value overwrites the
250 parameter's previous value. If the new value uses an incorrect
251 syntax, then the system continues with the old parameters and the
252 previously-correct value is lost on remount. That is, be careful
253 doing root squash tuning.</para>
256 <para><literal>mkfs.lustre</literal> and
257 <literal>tunefs.lustre</literal> do not perform parameter syntax
258 checking. If the root squash parameters are incorrect, they are
259 ignored on mount and the default values are used instead.</para>
262 <para>Root squash parameters are parsed with rigorous syntax checking.
263 The root_squash parameter should be specified as
264 <literal><decnum>:<decnum></literal>. The
265 <literal>nosquash_nids</literal> parameter should follow LNet NID
266 range list syntax.</para>
269 <para>LNet NID range syntax:</para>
270 <screen><nidlist> :== <nidrange> [ ' ' <nidrange> ]
271 <nidrange> :== <addrrange> '@' <net>
272 <addrrange> :== '*' |
273 <ipaddr_range> |
274 <numaddr_range>
275 <ipaddr_range> :==
276 <numaddr_range>.<numaddr_range>.<numaddr_range>.<numaddr_range>
277 <numaddr_range> :== <number> |
279 <expr_list> :== '[' <range_expr> [ ',' <range_expr>] ']'
280 <range_expr> :== <number> |
281 <number> '-' <number> |
282 <number> '-' <number> '/' <number>
283 <net> :== <netname> | <netname><number>
284 <netname> :== "lo" | "tcp" | "o2ib"
285 | "ra" | "elan"
286 <number> :== <nonnegative decimal> | <hexadecimal></screen>
288 <para>For networks using numeric addresses (e.g. elan), the address
289 range must be specified in the
290 <literal><numaddr_range></literal> syntax. For networks using
291 IP addresses, the address range must be in the
292 <literal><ipaddr_range></literal>. For example, if elan is using
293 numeric addresses, <literal>1.2.3.4@elan</literal> is incorrect.