File: findcon.1

package info (click to toggle)
setools 3.3.7-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 9,840 kB
  • sloc: ansic: 82,247; tcl: 13,145; cpp: 4,885; makefile: 1,603; yacc: 779; lex: 296; python: 57; sh: 50
file content (119 lines) | stat: -rw-r--r-- 3,644 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
.TH findcon 1
.SH NAME
findcon \- SELinux file context search tool
.SH SYNOPSIS
.B findcon
FCLIST [OPTIONS] [EXPRESSION]
.SH DESCRIPTION
.PP
.B findcon
allows the user to search for files with a specified context.
Results can be filtered by object class as described below.
.SH FCLIST
The
.B findcon
tool operates upon a file context list source.  There are three valid
file context lists.
.IP directory
If
.B FCLIST
is a name of a directory then begin the search at that directory and
recurse within it.  Be sure there are no circular mounts within it.
.IP file_contexts
If
.B FCLIST
is the name of a file_contexts file (e.g.,
/etc/selinux/strict/contexts/files/file_contexts) then open that file
and find matching entries.
.IP database
If
.B FCLIST
is the name of a database as created by a previous run of
.B indexcon
or
.B apol
then open the database and execute queries into it.
.SH EXPRESSION
.P
The following options allow the user to specify which files to print.
A file must meet all specified criteria.
If no expression is provided, all files are printed.
.IP "-t TYPE, --type=TYPE"
Search for files with a context containing the type TYPE.
.IP "-u USER, --user=USER"
Search for files with a context containing the user USER.
.IP "-r ROLE, --role=ROLE"
Search for files with a context containing the role ROLE.
.IP "-m RANGE, --mls-range=RANGE"
Search for files with a context with the MLS range of RANGE.  Note
that
.B findcon
ignores the SELinux translation library, if present.  In addition,
this flag is ignored if the
.B FCLIST
has no MLS information.
.IP "--context=CONTEXT"
Search for files matching this partial context.  This flag overrides
-t, -u, -r, and -m.
.IP "-p PATH, --path=PATH"
Search for files which include PATH.
.IP "-c CLASS, --class=CLASS"
Search only files of object class CLASS.
.SH OPTIONS
The following additional options are available.
.IP "-R, --regex"
Search using regular expressions instead of exact string matching.
This option does not affect the --class flag.
.IP "-h, --help"
Print help information and exit.
.IP "-V, --version"
Print version information and exit.
.SH PARTIAL CONTEXT
The
.B --context
flag specifies a partial context, which is a a colon separated list of
user, role, and type.  If the system supports MLS, the context may
have a fourth field that gives the range.  If a field is not specified
or is the literal asterisk, then the query will always match the field.
.SH OBJECT CLASSES
Valid object class strings are
.PP
block,
char,
dir,
fifo,
file,
link, or
sock.
.SH NOTE
The findcon utility always operates on "raw" SELinux file contexts.
If the system has an installed translation library (i.e., libsetrans),
those translations are ignored in favor of reading the original
contexts from the filesystem (if FCFILE is a directory).
.SH EXAMPLES
.TP
.B findcon .
Find every context in the current directory and all of its
subdirectories.
.TP
.B findcon -u user_u .
Find every context whose user is user_u in the current directory and
all subdirectories.
.TP
.B findcon -u system_u -t bin_t file_contexts
Find entries user system_u and type bin_t within a file_contexts file,
assuming that file_contexts is a file contexts file.
.TP
.B findcon --context=system_u::bin_t file_contexts
This is equivalent to the previous example.
.TP
.B findcon --context=system_u:*:bin_t:* file_contexts
This is also equivalent to the above example.
.SH AUTHOR
This manual page was written by Jeremy A. Mowery <jmowery@tresys.com>.
.SH COPYRIGHT
Copyright(C) 2003-2007 Tresys Technology, LLC
.SH BUGS
Please report bugs via an email to setools-bugs@tresys.com.
.SH SEE ALSO
replcon(1), indexcon(1)