Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
9e4bf8b1
Commit
9e4bf8b1
authored
Oct 15, 2013
by
Dwight Engen
Committed by
Serge Hallyn
Oct 17, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add lsm op for checking if an lsm is present/enabled
Signed-off-by:
Dwight Engen
<
dwight.engen@oracle.com
>
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
fefddf9f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
0 deletions
+18
-0
apparmor.c
src/lxc/lsm/apparmor.c
+1
-0
lsm.c
src/lxc/lsm/lsm.c
+7
-0
lsm.h
src/lxc/lsm/lsm.h
+3
-0
nop.c
src/lxc/lsm/nop.c
+6
-0
selinux.c
src/lxc/lsm/selinux.c
+1
-0
No files found.
src/lxc/lsm/apparmor.c
View file @
9e4bf8b1
...
@@ -167,6 +167,7 @@ static int apparmor_process_label_set(const char *label, int use_default)
...
@@ -167,6 +167,7 @@ static int apparmor_process_label_set(const char *label, int use_default)
static
struct
lsm_drv
apparmor_drv
=
{
static
struct
lsm_drv
apparmor_drv
=
{
.
name
=
"AppArmor"
,
.
name
=
"AppArmor"
,
.
enabled
=
apparmor_enabled
,
.
process_label_get
=
apparmor_process_label_get
,
.
process_label_get
=
apparmor_process_label_get
,
.
process_label_set
=
apparmor_process_label_set
,
.
process_label_set
=
apparmor_process_label_set
,
};
};
...
...
src/lxc/lsm/lsm.c
View file @
9e4bf8b1
...
@@ -62,6 +62,13 @@ void lsm_init(void)
...
@@ -62,6 +62,13 @@ void lsm_init(void)
INFO
(
"Initialized LSM security driver %s"
,
drv
->
name
);
INFO
(
"Initialized LSM security driver %s"
,
drv
->
name
);
}
}
int
lsm_enabled
()
{
if
(
drv
)
return
drv
->
enabled
();
return
0
;
}
char
*
lsm_process_label_get
(
pid_t
pid
)
char
*
lsm_process_label_get
(
pid_t
pid
)
{
{
if
(
!
drv
)
{
if
(
!
drv
)
{
...
...
src/lxc/lsm/lsm.h
View file @
9e4bf8b1
...
@@ -31,18 +31,21 @@ struct lxc_conf;
...
@@ -31,18 +31,21 @@ struct lxc_conf;
struct
lsm_drv
{
struct
lsm_drv
{
const
char
*
name
;
const
char
*
name
;
int
(
*
enabled
)(
void
);
char
*
(
*
process_label_get
)(
pid_t
pid
);
char
*
(
*
process_label_get
)(
pid_t
pid
);
int
(
*
process_label_set
)(
const
char
*
label
,
int
use_default
);
int
(
*
process_label_set
)(
const
char
*
label
,
int
use_default
);
};
};
#if HAVE_APPARMOR || HAVE_SELINUX
#if HAVE_APPARMOR || HAVE_SELINUX
void
lsm_init
(
void
);
void
lsm_init
(
void
);
int
lsm_enabled
(
void
);
char
*
lsm_process_label_get
(
pid_t
pid
);
char
*
lsm_process_label_get
(
pid_t
pid
);
int
lsm_process_label_set
(
const
char
*
label
,
int
use_default
);
int
lsm_process_label_set
(
const
char
*
label
,
int
use_default
);
int
lsm_proc_mount
(
struct
lxc_conf
*
lxc_conf
);
int
lsm_proc_mount
(
struct
lxc_conf
*
lxc_conf
);
void
lsm_proc_unmount
(
struct
lxc_conf
*
lxc_conf
);
void
lsm_proc_unmount
(
struct
lxc_conf
*
lxc_conf
);
#else
#else
static
inline
void
lsm_init
(
void
)
{
}
static
inline
void
lsm_init
(
void
)
{
}
static
inline
int
lsm_enabled
(
void
)
{
return
0
;
}
static
inline
char
*
lsm_process_label_get
(
pid_t
pid
)
{
return
NULL
;
}
static
inline
char
*
lsm_process_label_get
(
pid_t
pid
)
{
return
NULL
;
}
static
inline
int
lsm_process_label_set
(
char
*
label
,
int
use_default
)
{
return
0
;
}
static
inline
int
lsm_process_label_set
(
char
*
label
,
int
use_default
)
{
return
0
;
}
static
inline
int
lsm_proc_mount
(
struct
lxc_conf
*
lxc_conf
)
{
return
0
;
}
static
inline
int
lsm_proc_mount
(
struct
lxc_conf
*
lxc_conf
)
{
return
0
;
}
...
...
src/lxc/lsm/nop.c
View file @
9e4bf8b1
...
@@ -34,8 +34,14 @@ static int nop_process_label_set(const char *label, int use_default)
...
@@ -34,8 +34,14 @@ static int nop_process_label_set(const char *label, int use_default)
return
0
;
return
0
;
}
}
static
int
nop_enabled
(
void
)
{
return
0
;
}
static
struct
lsm_drv
nop_drv
=
{
static
struct
lsm_drv
nop_drv
=
{
.
name
=
"nop"
,
.
name
=
"nop"
,
.
enabled
=
nop_enabled
,
.
process_label_get
=
nop_process_label_get
,
.
process_label_get
=
nop_process_label_get
,
.
process_label_set
=
nop_process_label_set
,
.
process_label_set
=
nop_process_label_set
,
};
};
...
...
src/lxc/lsm/selinux.c
View file @
9e4bf8b1
...
@@ -89,6 +89,7 @@ static int selinux_process_label_set(const char *label, int use_default)
...
@@ -89,6 +89,7 @@ static int selinux_process_label_set(const char *label, int use_default)
static
struct
lsm_drv
selinux_drv
=
{
static
struct
lsm_drv
selinux_drv
=
{
.
name
=
"SELinux"
,
.
name
=
"SELinux"
,
.
enabled
=
is_selinux_enabled
,
.
process_label_get
=
selinux_process_label_get
,
.
process_label_get
=
selinux_process_label_get
,
.
process_label_set
=
selinux_process_label_set
,
.
process_label_set
=
selinux_process_label_set
,
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment