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
5a46f283
Unverified
Commit
5a46f283
authored
Sep 02, 2016
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf, confile: add option for PR_SET_NO_NEW_PRIVS
Signed-off-by:
Christian Brauner
<
christian.brauner@canonical.com
>
parent
a47e327c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
conf.h
src/lxc/conf.h
+3
-0
confile.c
src/lxc/confile.c
+18
-0
No files found.
src/lxc/conf.h
View file @
5a46f283
...
@@ -382,6 +382,9 @@ struct lxc_conf {
...
@@ -382,6 +382,9 @@ struct lxc_conf {
/* The facility to pass to syslog. Let's users establish as what type of
/* The facility to pass to syslog. Let's users establish as what type of
* program liblxc is supposed to write to the syslog. */
* program liblxc is supposed to write to the syslog. */
char
*
syslog
;
char
*
syslog
;
/* Whether PR_SET_NO_NEW_PRIVS will be set for the container. */
bool
no_new_privs
;
};
};
#ifdef HAVE_TLS
#ifdef HAVE_TLS
...
...
src/lxc/confile.c
View file @
5a46f283
...
@@ -114,6 +114,7 @@ static int config_init_cmd(const char *, const char *, struct lxc_conf *);
...
@@ -114,6 +114,7 @@ static int config_init_cmd(const char *, const char *, struct lxc_conf *);
static
int
config_init_uid
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_init_uid
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_init_gid
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_init_gid
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_ephemeral
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_ephemeral
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
config_no_new_privs
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
struct
lxc_config_t
config
[]
=
{
static
struct
lxc_config_t
config
[]
=
{
...
@@ -187,6 +188,7 @@ static struct lxc_config_t config[] = {
...
@@ -187,6 +188,7 @@ static struct lxc_config_t config[] = {
{
"lxc.init_gid"
,
config_init_gid
},
{
"lxc.init_gid"
,
config_init_gid
},
{
"lxc.ephemeral"
,
config_ephemeral
},
{
"lxc.ephemeral"
,
config_ephemeral
},
{
"lxc.syslog"
,
config_syslog
},
{
"lxc.syslog"
,
config_syslog
},
{
"lxc.no_new_privs"
,
config_no_new_privs
},
};
};
struct
signame
{
struct
signame
{
...
@@ -2562,6 +2564,8 @@ int lxc_get_config_item(struct lxc_conf *c, const char *key, char *retv,
...
@@ -2562,6 +2564,8 @@ int lxc_get_config_item(struct lxc_conf *c, const char *key, char *retv,
return
lxc_get_conf_int
(
c
,
retv
,
inlen
,
c
->
ephemeral
);
return
lxc_get_conf_int
(
c
,
retv
,
inlen
,
c
->
ephemeral
);
else
if
(
strcmp
(
key
,
"lxc.syslog"
)
==
0
)
else
if
(
strcmp
(
key
,
"lxc.syslog"
)
==
0
)
v
=
c
->
syslog
;
v
=
c
->
syslog
;
else
if
(
strcmp
(
key
,
"lxc.no_new_privs"
)
==
0
)
return
lxc_get_conf_int
(
c
,
retv
,
inlen
,
c
->
no_new_privs
);
else
return
-
1
;
else
return
-
1
;
if
(
!
v
)
if
(
!
v
)
...
@@ -2954,3 +2958,17 @@ static int config_syslog(const char *key, const char *value,
...
@@ -2954,3 +2958,17 @@ static int config_syslog(const char *key, const char *value,
lxc_log_syslog
(
facility
);
lxc_log_syslog
(
facility
);
return
config_string_item
(
&
lxc_conf
->
syslog
,
value
);
return
config_string_item
(
&
lxc_conf
->
syslog
,
value
);
}
}
static
int
config_no_new_privs
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
)
{
int
v
=
atoi
(
value
);
if
(
v
!=
0
&&
v
!=
1
)
{
ERROR
(
"Wrong value for lxc.no_new_privs. Can only be set to 0 or 1"
);
return
-
1
;
}
lxc_conf
->
no_new_privs
=
v
?
true
:
false
;
return
0
;
}
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