Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sepolicy
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test
platform
system
sepolicy
Commits
b8b4f43c
Commit
b8b4f43c
authored
10 years ago
by
dcashman
Committed by
Gerrit Code Review
10 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Add permissive domains check to sepolicy-analyze."
parents
65feafce
9793ea7a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app.te
+2
-0
2 additions, 0 deletions
app.te
tools/sepolicy-analyze.c
+28
-4
28 additions, 4 deletions
tools/sepolicy-analyze.c
with
30 additions
and
4 deletions
app.te
+
2
−
0
View file @
b8b4f43c
...
...
@@ -169,6 +169,8 @@ allow appdomain runas_exec:file getattr;
# Check SELinux policy and contexts.
selinux_check_access(appdomain)
selinux_check_context(appdomain)
# Enable reading of current selinux policy file
allow appdomain kernel:security read_policy;
# Validate that each process is running in the correct security context.
allow appdomain domain:process getattr;
...
...
This diff is collapsed.
Click to expand it.
tools/sepolicy-analyze.c
+
28
−
4
View file @
b8b4f43c
...
...
@@ -15,7 +15,7 @@
void
usage
(
char
*
arg0
)
{
fprintf
(
stderr
,
"%s [-e|--equiv] [-d|--diff] [-D|--dups] -P <policy file>
\n
"
,
arg0
);
fprintf
(
stderr
,
"%s [-e|--equiv] [-d|--diff] [-D|--dups]
[-p|--permissive]
-P <policy file>
\n
"
,
arg0
);
exit
(
1
);
}
...
...
@@ -408,23 +408,41 @@ static int find_dups(policydb_t * policydb)
return
0
;
}
static
int
list_permissive
(
policydb_t
*
policydb
)
{
struct
ebitmap_node
*
n
;
unsigned
int
bit
;
/*
* iterate over all domains and check if domain is in permissive
*/
ebitmap_for_each_bit
(
&
policydb
->
permissive_map
,
n
,
bit
)
{
if
(
ebitmap_node_get_bit
(
n
,
bit
))
{
printf
(
"%s
\n
"
,
policydb
->
p_type_val_to_name
[
bit
-
1
]);
}
}
return
0
;
}
int
main
(
int
argc
,
char
**
argv
)
{
char
*
policy
=
NULL
;
struct
policy_file
pf
;
policydb_t
policydb
;
char
ch
;
char
equiv
=
0
,
diff
=
0
,
dups
=
0
;
char
equiv
=
0
,
diff
=
0
,
dups
=
0
,
permissive
=
0
;
struct
option
long_options
[]
=
{
{
"equiv"
,
no_argument
,
NULL
,
'e'
},
{
"diff"
,
no_argument
,
NULL
,
'd'
},
{
"dups"
,
no_argument
,
NULL
,
'D'
},
{
"permissive"
,
no_argument
,
NULL
,
'p'
},
{
"policy"
,
required_argument
,
NULL
,
'P'
},
{
NULL
,
0
,
NULL
,
0
}
};
while
((
ch
=
getopt_long
(
argc
,
argv
,
"edDP:"
,
long_options
,
NULL
))
!=
-
1
)
{
while
((
ch
=
getopt_long
(
argc
,
argv
,
"edD
p
P:"
,
long_options
,
NULL
))
!=
-
1
)
{
switch
(
ch
)
{
case
'e'
:
equiv
=
1
;
...
...
@@ -435,6 +453,9 @@ int main(int argc, char **argv)
case
'D'
:
dups
=
1
;
break
;
case
'p'
:
permissive
=
1
;
break
;
case
'P'
:
policy
=
optarg
;
break
;
...
...
@@ -443,7 +464,7 @@ int main(int argc, char **argv)
}
}
if
(
!
policy
||
(
!
equiv
&&
!
diff
&&
!
dups
))
if
(
!
policy
||
(
!
equiv
&&
!
diff
&&
!
dups
&&
!
permissive
))
usage
(
argv
[
0
]);
if
(
load_policy
(
policy
,
&
policydb
,
&
pf
))
...
...
@@ -455,6 +476,9 @@ int main(int argc, char **argv)
if
(
dups
)
find_dups
(
&
policydb
);
if
(
permissive
)
list_permissive
(
&
policydb
);
policydb_destroy
(
&
policydb
);
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment