blob: a416479b8a1c23d6755cd5354027159af832a4dc [file] [log] [blame]
Casey Schauflere114e472008-02-04 22:29:50 -08001
2
3 "Good for you, you've decided to clean the elevator!"
4 - The Elevator, from Dark Star
5
6Smack is the the Simplified Mandatory Access Control Kernel.
7Smack is a kernel based implementation of mandatory access
8control that includes simplicity in its primary design goals.
9
10Smack is not the only Mandatory Access Control scheme
11available for Linux. Those new to Mandatory Access Control
12are encouraged to compare Smack with the other mechanisms
13available to determine which is best suited to the problem
14at hand.
15
16Smack consists of three major components:
17 - The kernel
Casey Schauflerf7112e62012-05-06 15:22:02 -070018 - Basic utilities, which are helpful but not required
Casey Schauflere114e472008-02-04 22:29:50 -080019 - Configuration data
20
21The kernel component of Smack is implemented as a Linux
22Security Modules (LSM) module. It requires netlabel and
23works best with file systems that support extended attributes,
24although xattr support is not strictly required.
25It is safe to run a Smack kernel under a "vanilla" distribution.
Casey Schauflerf7112e62012-05-06 15:22:02 -070026
Casey Schauflere114e472008-02-04 22:29:50 -080027Smack kernels use the CIPSO IP option. Some network
28configurations are intolerant of IP options and can impede
29access to systems that use them as Smack does.
30
Casey Schauflerf7112e62012-05-06 15:22:02 -070031The current git repositories for Smack user space are:
Casey Schauflere114e472008-02-04 22:29:50 -080032
Casey Schauflerf7112e62012-05-06 15:22:02 -070033 git@gitorious.org:meego-platform-security/smackutil.git
34 git@gitorious.org:meego-platform-security/libsmack.git
Casey Schauflere114e472008-02-04 22:29:50 -080035
Casey Schauflerf7112e62012-05-06 15:22:02 -070036These should make and install on most modern distributions.
37There are three commands included in smackutil:
Casey Schauflere114e472008-02-04 22:29:50 -080038
Casey Schauflerf7112e62012-05-06 15:22:02 -070039smackload - properly formats data for writing to /smack/load
40smackcipso - properly formats data for writing to /smack/cipso
41chsmack - display or set Smack extended attribute values
Casey Schauflere114e472008-02-04 22:29:50 -080042
43In keeping with the intent of Smack, configuration data is
44minimal and not strictly required. The most important
45configuration step is mounting the smackfs pseudo filesystem.
Casey Schauflerf7112e62012-05-06 15:22:02 -070046If smackutil is installed the startup script will take care
47of this, but it can be manually as well.
Casey Schauflere114e472008-02-04 22:29:50 -080048
49Add this line to /etc/fstab:
50
51 smackfs /smack smackfs smackfsdef=* 0 0
52
53and create the /smack directory for mounting.
54
Casey Schauflerf7112e62012-05-06 15:22:02 -070055Smack uses extended attributes (xattrs) to store labels on filesystem
56objects. The attributes are stored in the extended attribute security
57name space. A process must have CAP_MAC_ADMIN to change any of these
58attributes.
59
60The extended attributes that Smack uses are:
61
62SMACK64
63 Used to make access control decisions. In almost all cases
64 the label given to a new filesystem object will be the label
65 of the process that created it.
66SMACK64EXEC
67 The Smack label of a process that execs a program file with
68 this attribute set will run with this attribute's value.
69SMACK64MMAP
70 Don't allow the file to be mmapped by a process whose Smack
71 label does not allow all of the access permitted to a process
72 with the label contained in this attribute. This is a very
73 specific use case for shared libraries.
74SMACK64TRANSMUTE
75 Can only have the value "TRUE". If this attribute is present
76 on a directory when an object is created in the directory and
77 the Smack rule (more below) that permitted the write access
78 to the directory includes the transmute ("t") mode the object
79 gets the label of the directory instead of the label of the
80 creating process. If the object being created is a directory
81 the SMACK64TRANSMUTE attribute is set as well.
82SMACK64IPIN
83 This attribute is only available on file descriptors for sockets.
84 Use the Smack label in this attribute for access control
85 decisions on packets being delivered to this socket.
86SMACK64IPOUT
87 This attribute is only available on file descriptors for sockets.
88 Use the Smack label in this attribute for access control
89 decisions on packets coming from this socket.
90
91There are multiple ways to set a Smack label on a file:
Casey Schauflere114e472008-02-04 22:29:50 -080092
93 # attr -S -s SMACK64 -V "value" path
Casey Schauflerf7112e62012-05-06 15:22:02 -070094 # chsmack -a value path
Casey Schauflere114e472008-02-04 22:29:50 -080095
Casey Schauflerf7112e62012-05-06 15:22:02 -070096A process can see the smack label it is running with by
97reading /proc/self/attr/current. A process with CAP_MAC_ADMIN
98can set the process smack by writing there.
Casey Schauflere114e472008-02-04 22:29:50 -080099
Casey Schauflerf7112e62012-05-06 15:22:02 -0700100Most Smack configuration is accomplished by writing to files
101in the smackfs filesystem. This pseudo-filesystem is usually
102mounted on /smack.
103
104access
105 This interface reports whether a subject with the specified
106 Smack label has a particular access to an object with a
107 specified Smack label. Write a fixed format access rule to
108 this file. The next read will indicate whether the access
109 would be permitted. The text will be either "1" indicating
110 access, or "0" indicating denial.
111access2
112 This interface reports whether a subject with the specified
113 Smack label has a particular access to an object with a
114 specified Smack label. Write a long format access rule to
115 this file. The next read will indicate whether the access
116 would be permitted. The text will be either "1" indicating
117 access, or "0" indicating denial.
118ambient
119 This contains the Smack label applied to unlabeled network
120 packets.
121cipso
122 This interface allows a specific CIPSO header to be assigned
123 to a Smack label. The format accepted on write is:
124 "%24s%4d%4d"["%4d"]...
125 The first string is a fixed Smack label. The first number is
126 the level to use. The second number is the number of categories.
127 The following numbers are the categories.
128 "level-3-cats-5-19 3 2 5 19"
129cipso2
130 This interface allows a specific CIPSO header to be assigned
131 to a Smack label. The format accepted on write is:
132 "%s%4d%4d"["%4d"]...
133 The first string is a long Smack label. The first number is
134 the level to use. The second number is the number of categories.
135 The following numbers are the categories.
136 "level-3-cats-5-19 3 2 5 19"
137direct
138 This contains the CIPSO level used for Smack direct label
139 representation in network packets.
140doi
141 This contains the CIPSO domain of interpretation used in
142 network packets.
143load
144 This interface allows access control rules in addition to
145 the system defined rules to be specified. The format accepted
146 on write is:
147 "%24s%24s%5s"
148 where the first string is the subject label, the second the
149 object label, and the third the requested access. The access
150 string may contain only the characters "rwxat-", and specifies
151 which sort of access is allowed. The "-" is a placeholder for
152 permissions that are not allowed. The string "r-x--" would
153 specify read and execute access. Labels are limited to 23
154 characters in length.
155load2
156 This interface allows access control rules in addition to
157 the system defined rules to be specified. The format accepted
158 on write is:
159 "%s %s %s"
160 where the first string is the subject label, the second the
161 object label, and the third the requested access. The access
162 string may contain only the characters "rwxat-", and specifies
163 which sort of access is allowed. The "-" is a placeholder for
164 permissions that are not allowed. The string "r-x--" would
165 specify read and execute access.
166load-self
167 This interface allows process specific access rules to be
168 defined. These rules are only consulted if access would
169 otherwise be permitted, and are intended to provide additional
170 restrictions on the process. The format is the same as for
171 the load interface.
172load-self2
173 This interface allows process specific access rules to be
174 defined. These rules are only consulted if access would
175 otherwise be permitted, and are intended to provide additional
176 restrictions on the process. The format is the same as for
177 the load2 interface.
178logging
179 This contains the Smack logging state.
180mapped
181 This contains the CIPSO level used for Smack mapped label
182 representation in network packets.
183netlabel
184 This interface allows specific internet addresses to be
185 treated as single label hosts. Packets are sent to single
186 label hosts without CIPSO headers, but only from processes
187 that have Smack write access to the host label. All packets
188 received from single label hosts are given the specified
189 label. The format accepted on write is:
190 "%d.%d.%d.%d label" or "%d.%d.%d.%d/%d label".
191onlycap
192 This contains the label processes must have for CAP_MAC_ADMIN
193 and CAP_MAC_OVERRIDE to be effective. If this file is empty
194 these capabilities are effective at for processes with any
195 label. The value is set by writing the desired label to the
196 file or cleared by writing "-" to the file.
Casey Schauflere114e472008-02-04 22:29:50 -0800197
198You can add access rules in /etc/smack/accesses. They take the form:
199
200 subjectlabel objectlabel access
201
202access is a combination of the letters rwxa which specify the
203kind of access permitted a subject with subjectlabel on an
204object with objectlabel. If there is no rule no access is allowed.
205
Casey Schauflere114e472008-02-04 22:29:50 -0800206Look for additional programs on http://schaufler-ca.com
207
208From the Smack Whitepaper:
209
210The Simplified Mandatory Access Control Kernel
211
212Casey Schaufler
213casey@schaufler-ca.com
214
215Mandatory Access Control
216
217Computer systems employ a variety of schemes to constrain how information is
218shared among the people and services using the machine. Some of these schemes
219allow the program or user to decide what other programs or users are allowed
220access to pieces of data. These schemes are called discretionary access
221control mechanisms because the access control is specified at the discretion
222of the user. Other schemes do not leave the decision regarding what a user or
223program can access up to users or programs. These schemes are called mandatory
224access control mechanisms because you don't have a choice regarding the users
225or programs that have access to pieces of data.
226
227Bell & LaPadula
228
229From the middle of the 1980's until the turn of the century Mandatory Access
230Control (MAC) was very closely associated with the Bell & LaPadula security
231model, a mathematical description of the United States Department of Defense
232policy for marking paper documents. MAC in this form enjoyed a following
233within the Capital Beltway and Scandinavian supercomputer centers but was
234often sited as failing to address general needs.
235
236Domain Type Enforcement
237
238Around the turn of the century Domain Type Enforcement (DTE) became popular.
239This scheme organizes users, programs, and data into domains that are
240protected from each other. This scheme has been widely deployed as a component
241of popular Linux distributions. The administrative overhead required to
242maintain this scheme and the detailed understanding of the whole system
243necessary to provide a secure domain mapping leads to the scheme being
244disabled or used in limited ways in the majority of cases.
245
246Smack
247
248Smack is a Mandatory Access Control mechanism designed to provide useful MAC
249while avoiding the pitfalls of its predecessors. The limitations of Bell &
250LaPadula are addressed by providing a scheme whereby access can be controlled
251according to the requirements of the system and its purpose rather than those
252imposed by an arcane government policy. The complexity of Domain Type
253Enforcement and avoided by defining access controls in terms of the access
254modes already in use.
255
256Smack Terminology
257
258The jargon used to talk about Smack will be familiar to those who have dealt
259with other MAC systems and shouldn't be too difficult for the uninitiated to
260pick up. There are four terms that are used in a specific way and that are
261especially important:
262
263 Subject: A subject is an active entity on the computer system.
264 On Smack a subject is a task, which is in turn the basic unit
265 of execution.
266
267 Object: An object is a passive entity on the computer system.
268 On Smack files of all types, IPC, and tasks can be objects.
269
270 Access: Any attempt by a subject to put information into or get
271 information from an object is an access.
272
273 Label: Data that identifies the Mandatory Access Control
274 characteristics of a subject or an object.
275
276These definitions are consistent with the traditional use in the security
277community. There are also some terms from Linux that are likely to crop up:
278
279 Capability: A task that possesses a capability has permission to
280 violate an aspect of the system security policy, as identified by
281 the specific capability. A task that possesses one or more
282 capabilities is a privileged task, whereas a task with no
283 capabilities is an unprivileged task.
284
285 Privilege: A task that is allowed to violate the system security
286 policy is said to have privilege. As of this writing a task can
287 have privilege either by possessing capabilities or by having an
288 effective user of root.
289
290Smack Basics
291
292Smack is an extension to a Linux system. It enforces additional restrictions
293on what subjects can access which objects, based on the labels attached to
294each of the subject and the object.
295
296Labels
297
298Smack labels are ASCII character strings, one to twenty-three characters in
299length. Single character labels using special characters, that being anything
300other than a letter or digit, are reserved for use by the Smack development
301team. Smack labels are unstructured, case sensitive, and the only operation
302ever performed on them is comparison for equality. Smack labels cannot
Etienne Bassetecfcc532009-04-08 20:40:06 +0200303contain unprintable characters, the "/" (slash), the "\" (backslash), the "'"
304(quote) and '"' (double-quote) characters.
Casey Schauflerf7112e62012-05-06 15:22:02 -0700305Smack labels cannot begin with a '-'. This is reserved for special options.
Casey Schauflere114e472008-02-04 22:29:50 -0800306
307There are some predefined labels:
308
Etienne Basset43031542009-03-27 17:11:01 -0400309 _ Pronounced "floor", a single underscore character.
310 ^ Pronounced "hat", a single circumflex character.
311 * Pronounced "star", a single asterisk character.
312 ? Pronounced "huh", a single question mark character.
Casey Schauflerf7112e62012-05-06 15:22:02 -0700313 @ Pronounced "web", a single at sign character.
Casey Schauflere114e472008-02-04 22:29:50 -0800314
315Every task on a Smack system is assigned a label. System tasks, such as
316init(8) and systems daemons, are run with the floor ("_") label. User tasks
317are assigned labels according to the specification found in the
318/etc/smack/user configuration file.
319
320Access Rules
321
322Smack uses the traditional access modes of Linux. These modes are read,
323execute, write, and occasionally append. There are a few cases where the
324access mode may not be obvious. These include:
325
326 Signals: A signal is a write operation from the subject task to
327 the object task.
328 Internet Domain IPC: Transmission of a packet is considered a
329 write operation from the source task to the destination task.
330
331Smack restricts access based on the label attached to a subject and the label
332attached to the object it is trying to access. The rules enforced are, in
333order:
334
335 1. Any access requested by a task labeled "*" is denied.
336 2. A read or execute access requested by a task labeled "^"
337 is permitted.
338 3. A read or execute access requested on an object labeled "_"
339 is permitted.
340 4. Any access requested on an object labeled "*" is permitted.
341 5. Any access requested by a task on an object with the same
342 label is permitted.
343 6. Any access requested that is explicitly defined in the loaded
344 rule set is permitted.
345 7. Any other access is denied.
346
347Smack Access Rules
348
349With the isolation provided by Smack access separation is simple. There are
350many interesting cases where limited access by subjects to objects with
351different labels is desired. One example is the familiar spy model of
352sensitivity, where a scientist working on a highly classified project would be
353able to read documents of lower classifications and anything she writes will
354be "born" highly classified. To accommodate such schemes Smack includes a
355mechanism for specifying rules allowing access between labels.
356
357Access Rule Format
358
359The format of an access rule is:
360
361 subject-label object-label access
362
363Where subject-label is the Smack label of the task, object-label is the Smack
364label of the thing being accessed, and access is a string specifying the sort
Casey Schauflerf7112e62012-05-06 15:22:02 -0700365of access allowed. The access specification is searched for letters that
366describe access modes:
Casey Schauflere114e472008-02-04 22:29:50 -0800367
368 a: indicates that append access should be granted.
369 r: indicates that read access should be granted.
370 w: indicates that write access should be granted.
371 x: indicates that execute access should be granted.
Casey Schauflerf7112e62012-05-06 15:22:02 -0700372 t: indicates that the rule requests transmutation.
Casey Schauflere114e472008-02-04 22:29:50 -0800373
374Uppercase values for the specification letters are allowed as well.
375Access mode specifications can be in any order. Examples of acceptable rules
376are:
377
378 TopSecret Secret rx
379 Secret Unclass R
380 Manager Game x
381 User HR w
382 New Old rRrRr
383 Closed Off -
384
385Examples of unacceptable rules are:
386
387 Top Secret Secret rx
388 Ace Ace r
389 Odd spells waxbeans
390
391Spaces are not allowed in labels. Since a subject always has access to files
392with the same label specifying a rule for that case is pointless. Only
Casey Schauflerf7112e62012-05-06 15:22:02 -0700393valid letters (rwxatRWXAT) and the dash ('-') character are allowed in
Casey Schauflere114e472008-02-04 22:29:50 -0800394access specifications. The dash is a placeholder, so "a-r" is the same
395as "ar". A lone dash is used to specify that no access should be allowed.
396
397Applying Access Rules
398
399The developers of Linux rarely define new sorts of things, usually importing
400schemes and concepts from other systems. Most often, the other systems are
401variants of Unix. Unix has many endearing properties, but consistency of
402access control models is not one of them. Smack strives to treat accesses as
403uniformly as is sensible while keeping with the spirit of the underlying
404mechanism.
405
406File system objects including files, directories, named pipes, symbolic links,
407and devices require access permissions that closely match those used by mode
408bit access. To open a file for reading read access is required on the file. To
409search a directory requires execute access. Creating a file with write access
410requires both read and write access on the containing directory. Deleting a
411file requires read and write access to the file and to the containing
412directory. It is possible that a user may be able to see that a file exists
413but not any of its attributes by the circumstance of having read access to the
414containing directory but not to the differently labeled file. This is an
415artifact of the file name being data in the directory, not a part of the file.
416
Casey Schauflerf7112e62012-05-06 15:22:02 -0700417If a directory is marked as transmuting (SMACK64TRANSMUTE=TRUE) and the
418access rule that allows a process to create an object in that directory
419includes 't' access the label assigned to the new object will be that
420of the directory, not the creating process. This makes it much easier
421for two processes with different labels to share data without granting
422access to all of their files.
423
Casey Schauflere114e472008-02-04 22:29:50 -0800424IPC objects, message queues, semaphore sets, and memory segments exist in flat
425namespaces and access requests are only required to match the object in
426question.
427
428Process objects reflect tasks on the system and the Smack label used to access
429them is the same Smack label that the task would use for its own access
430attempts. Sending a signal via the kill() system call is a write operation
431from the signaler to the recipient. Debugging a process requires both reading
432and writing. Creating a new task is an internal operation that results in two
433tasks with identical Smack labels and requires no access checks.
434
435Sockets are data structures attached to processes and sending a packet from
436one process to another requires that the sender have write access to the
437receiver. The receiver is not required to have read access to the sender.
438
439Setting Access Rules
440
441The configuration file /etc/smack/accesses contains the rules to be set at
442system startup. The contents are written to the special file /smack/load.
443Rules can be written to /smack/load at any time and take effect immediately.
444For any pair of subject and object labels there can be only one rule, with the
445most recently specified overriding any earlier specification.
446
447The program smackload is provided to ensure data is formatted
448properly when written to /smack/load. This program reads lines
449of the form
450
451 subjectlabel objectlabel mode.
452
453Task Attribute
454
455The Smack label of a process can be read from /proc/<pid>/attr/current. A
456process can read its own Smack label from /proc/self/attr/current. A
457privileged process can change its own Smack label by writing to
458/proc/self/attr/current but not the label of another process.
459
460File Attribute
461
462The Smack label of a filesystem object is stored as an extended attribute
463named SMACK64 on the file. This attribute is in the security namespace. It can
464only be changed by a process with privilege.
465
466Privilege
467
468A process with CAP_MAC_OVERRIDE is privileged.
469
470Smack Networking
471
472As mentioned before, Smack enforces access control on network protocol
473transmissions. Every packet sent by a Smack process is tagged with its Smack
474label. This is done by adding a CIPSO tag to the header of the IP packet. Each
475packet received is expected to have a CIPSO tag that identifies the label and
476if it lacks such a tag the network ambient label is assumed. Before the packet
477is delivered a check is made to determine that a subject with the label on the
478packet has write access to the receiving process and if that is not the case
479the packet is dropped.
480
481CIPSO Configuration
482
483It is normally unnecessary to specify the CIPSO configuration. The default
484values used by the system handle all internal cases. Smack will compose CIPSO
485label values to match the Smack labels being used without administrative
486intervention. Unlabeled packets that come into the system will be given the
487ambient label.
488
489Smack requires configuration in the case where packets from a system that is
490not smack that speaks CIPSO may be encountered. Usually this will be a Trusted
491Solaris system, but there are other, less widely deployed systems out there.
492CIPSO provides 3 important values, a Domain Of Interpretation (DOI), a level,
493and a category set with each packet. The DOI is intended to identify a group
494of systems that use compatible labeling schemes, and the DOI specified on the
495smack system must match that of the remote system or packets will be
496discarded. The DOI is 3 by default. The value can be read from /smack/doi and
497can be changed by writing to /smack/doi.
498
499The label and category set are mapped to a Smack label as defined in
500/etc/smack/cipso.
501
502A Smack/CIPSO mapping has the form:
503
504 smack level [category [category]*]
505
506Smack does not expect the level or category sets to be related in any
507particular way and does not assume or assign accesses based on them. Some
508examples of mappings:
509
510 TopSecret 7
511 TS:A,B 7 1 2
512 SecBDE 5 2 4 6
513 RAFTERS 7 12 26
514
515The ":" and "," characters are permitted in a Smack label but have no special
516meaning.
517
518The mapping of Smack labels to CIPSO values is defined by writing to
519/smack/cipso. Again, the format of data written to this special file
520is highly restrictive, so the program smackcipso is provided to
521ensure the writes are done properly. This program takes mappings
522on the standard input and sends them to /smack/cipso properly.
523
524In addition to explicit mappings Smack supports direct CIPSO mappings. One
525CIPSO level is used to indicate that the category set passed in the packet is
526in fact an encoding of the Smack label. The level used is 250 by default. The
527value can be read from /smack/direct and changed by writing to /smack/direct.
528
529Socket Attributes
530
531There are two attributes that are associated with sockets. These attributes
532can only be set by privileged tasks, but any task can read them for their own
533sockets.
534
535 SMACK64IPIN: The Smack label of the task object. A privileged
536 program that will enforce policy may set this to the star label.
537
538 SMACK64IPOUT: The Smack label transmitted with outgoing packets.
539 A privileged program may set this to match the label of another
540 task with which it hopes to communicate.
541
Etienne Basset43031542009-03-27 17:11:01 -0400542Smack Netlabel Exceptions
543
544You will often find that your labeled application has to talk to the outside,
545unlabeled world. To do this there's a special file /smack/netlabel where you can
546add some exceptions in the form of :
547@IP1 LABEL1 or
548@IP2/MASK LABEL2
549
550It means that your application will have unlabeled access to @IP1 if it has
551write access on LABEL1, and access to the subnet @IP2/MASK if it has write
552access on LABEL2.
553
554Entries in the /smack/netlabel file are matched by longest mask first, like in
555classless IPv4 routing.
556
557A special label '@' and an option '-CIPSO' can be used there :
558@ means Internet, any application with any label has access to it
559-CIPSO means standard CIPSO networking
560
561If you don't know what CIPSO is and don't plan to use it, you can just do :
562echo 127.0.0.1 -CIPSO > /smack/netlabel
563echo 0.0.0.0/0 @ > /smack/netlabel
564
565If you use CIPSO on your 192.168.0.0/16 local network and need also unlabeled
566Internet access, you can have :
567echo 127.0.0.1 -CIPSO > /smack/netlabel
568echo 192.168.0.0/16 -CIPSO > /smack/netlabel
569echo 0.0.0.0/0 @ > /smack/netlabel
570
571
Casey Schauflere114e472008-02-04 22:29:50 -0800572Writing Applications for Smack
573
574There are three sorts of applications that will run on a Smack system. How an
575application interacts with Smack will determine what it will have to do to
576work properly under Smack.
577
578Smack Ignorant Applications
579
580By far the majority of applications have no reason whatever to care about the
581unique properties of Smack. Since invoking a program has no impact on the
582Smack label associated with the process the only concern likely to arise is
583whether the process has execute access to the program.
584
585Smack Relevant Applications
586
587Some programs can be improved by teaching them about Smack, but do not make
588any security decisions themselves. The utility ls(1) is one example of such a
589program.
590
591Smack Enforcing Applications
592
593These are special programs that not only know about Smack, but participate in
594the enforcement of system policy. In most cases these are the programs that
595set up user sessions. There are also network services that provide information
596to processes running with various labels.
597
598File System Interfaces
599
600Smack maintains labels on file system objects using extended attributes. The
601Smack label of a file, directory, or other file system object can be obtained
602using getxattr(2).
603
604 len = getxattr("/", "security.SMACK64", value, sizeof (value));
605
606will put the Smack label of the root directory into value. A privileged
607process can set the Smack label of a file system object with setxattr(2).
608
609 len = strlen("Rubble");
610 rc = setxattr("/foo", "security.SMACK64", "Rubble", len, 0);
611
612will set the Smack label of /foo to "Rubble" if the program has appropriate
613privilege.
614
615Socket Interfaces
616
617The socket attributes can be read using fgetxattr(2).
618
619A privileged process can set the Smack label of outgoing packets with
620fsetxattr(2).
621
622 len = strlen("Rubble");
623 rc = fsetxattr(fd, "security.SMACK64IPOUT", "Rubble", len, 0);
624
625will set the Smack label "Rubble" on packets going out from the socket if the
626program has appropriate privilege.
627
628 rc = fsetxattr(fd, "security.SMACK64IPIN, "*", strlen("*"), 0);
629
630will set the Smack label "*" as the object label against which incoming
631packets will be checked if the program has appropriate privilege.
632
633Administration
634
635Smack supports some mount options:
636
637 smackfsdef=label: specifies the label to give files that lack
638 the Smack label extended attribute.
639
640 smackfsroot=label: specifies the label to assign the root of the
641 file system if it lacks the Smack extended attribute.
642
643 smackfshat=label: specifies a label that must have read access to
644 all labels set on the filesystem. Not yet enforced.
645
646 smackfsfloor=label: specifies a label to which all labels set on the
647 filesystem must have read access. Not yet enforced.
648
649These mount options apply to all file system types.
650
Etienne Bassetecfcc532009-04-08 20:40:06 +0200651Smack auditing
652
653If you want Smack auditing of security events, you need to set CONFIG_AUDIT
654in your kernel configuration.
655By default, all denied events will be audited. You can change this behavior by
656writing a single character to the /smack/logging file :
6570 : no logging
6581 : log denied (default)
6592 : log accepted
6603 : log denied & accepted
661
662Events are logged as 'key=value' pairs, for each event you at least will get
Masanari Iida40e47122012-03-04 23:16:11 +0900663the subject, the object, the rights requested, the action, the kernel function
Etienne Bassetecfcc532009-04-08 20:40:06 +0200664that triggered the event, plus other pairs depending on the type of event
665audited.