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
f58236fd
Commit
f58236fd
authored
Feb 21, 2016
by
Serge Hallyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update tests to recognize cgns profile
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
7a126ae1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
4 deletions
+23
-4
attach.c
src/tests/attach.c
+12
-1
lxc-test-apparmor-mount
src/tests/lxc-test-apparmor-mount
+8
-2
lxc-test-ubuntu
src/tests/lxc-test-ubuntu
+3
-1
No files found.
src/tests/attach.c
View file @
f58236fd
...
...
@@ -23,6 +23,7 @@
#include "lxc/utils.h"
#include "lxc/lsm/lsm.h"
#include <sys/types.h>
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
...
...
@@ -39,6 +40,13 @@
static
const
char
*
lsm_config_key
=
NULL
;
static
const
char
*
lsm_label
=
NULL
;
bool
file_exists
(
const
char
*
f
)
{
struct
stat
statbuf
;
return
stat
(
f
,
&
statbuf
)
==
0
;
}
static
void
test_lsm_detect
(
void
)
{
if
(
lsm_enabled
())
{
...
...
@@ -48,7 +56,10 @@ static void test_lsm_detect(void)
}
else
if
(
!
strcmp
(
lsm_name
(),
"AppArmor"
))
{
lsm_config_key
=
"lxc.aa_profile"
;
lsm_label
=
"lxc-container-default"
;
if
(
file_exists
(
"/proc/self/ns/cgroup"
))
lsm_label
=
"lxc-container-default-cgns"
;
else
lsm_label
=
"lxc-container-default"
;
}
else
{
TSTERR
(
"unknown lsm %s enabled, add test code here"
,
lsm_name
());
...
...
src/tests/lxc-test-apparmor-mount
View file @
f58236fd
...
...
@@ -23,6 +23,12 @@
set
-e
if
[
-f
/proc/self/ns/cgroup
]
;
then
default_profile
=
"lxc-container-default-cgns (enforce)"
else
default_profile
=
"lxc-container-default (enforce)"
fi
FAIL
()
{
echo
-n
"Failed "
>
&2
echo
"
$*
"
>
&2
...
...
@@ -144,7 +150,7 @@ run_cmd lxc-start -n $cname -d
run_cmd lxc-wait
-n
$cname
-s
RUNNING
pid
=
`
run_cmd lxc-info
-p
-H
-n
$cname
`
profile
=
`
cat
/proc/
$pid
/attr/current
`
if
[
"x
$profile
"
!=
"x
lxc-container-default (enforce)
"
]
;
then
if
[
"x
$profile
"
!=
"x
${
default_profile
}
"
]
;
then
echo
"FAIL: confined container was in profile
$profile
"
exit
1
fi
...
...
@@ -203,7 +209,7 @@ if [ "$pid" = "-1" ]; then
exit
1
fi
profile
=
`
cat
/proc/
$pid
/attr/current
`
if
[
"x
$profile
"
!=
"x
lxc-container-default (enforce)
"
]
;
then
if
[
"x
$profile
"
!=
"x
${
default_profile
}
"
]
;
then
echo
"FAIL: confined container was in profile
$profile
"
exit
1
fi
...
...
src/tests/lxc-test-ubuntu
View file @
f58236fd
...
...
@@ -65,7 +65,9 @@ for template in ubuntu ubuntu-cloud; do
# Check apparmor
lxcpid
=
`
lxc-info
-n
$name
-p
-H
`
aa
=
`
cat
/proc/
$lxcpid
/attr/current
`
if
[
"
$aa
"
!=
"lxc-container-default-with-nesting (enforce)"
-a
"
$aa
"
!=
"lxc-container-default (enforce)"
]
;
then
if
[
"
$aa
"
!=
"lxc-container-default-with-nesting (enforce)"
-a
\
"
$aa
"
!=
"lxc-container-default-cgns (enforce)"
-a
\
"
$aa
"
!=
"lxc-container-default (enforce)"
]
;
then
FAIL
" to correctly set apparmor profile (profile is
\"
$aa
\"
)"
fi
lxc-stop
-n
$name
-k
...
...
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