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
e778f973
Unverified
Commit
e778f973
authored
Oct 30, 2020
by
Ruben Jenster
Committed by
Christian Brauner
Feb 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile: add lxc.init.groups to keep additional groups
Signed-off-by:
Ruben Jenster
<
r.jenster@drachenfels.de
>
parent
7e9d3f20
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
3 deletions
+25
-3
conf.c
src/lxc/conf.c
+1
-0
conf.h
src/lxc/conf.h
+4
-0
confile.c
src/lxc/confile.c
+8
-0
start.c
src/lxc/start.c
+12
-3
No files found.
src/lxc/conf.c
View file @
e778f973
...
...
@@ -3918,6 +3918,7 @@ void lxc_conf_free(struct lxc_conf *conf)
free
(
conf
->
rcfile
);
free
(
conf
->
execute_cmd
);
free
(
conf
->
init_cmd
);
free
(
conf
->
init_groups
.
list
);
free
(
conf
->
init_cwd
);
free
(
conf
->
unexpanded_config
);
free
(
conf
->
syslog
);
...
...
src/lxc/conf.h
View file @
e778f973
...
...
@@ -406,6 +406,10 @@ struct lxc_conf {
* should run under when using lxc-execute */
uid_t
init_uid
;
gid_t
init_gid
;
struct
{
int
size
;
gid_t
*
list
;
}
init_groups
;
/* indicator if the container will be destroyed on shutdown */
unsigned
int
ephemeral
;
...
...
src/lxc/confile.c
View file @
e778f973
...
...
@@ -4618,6 +4618,14 @@ static inline int clr_config_init_gid(const char *key, struct lxc_conf *c,
return
0
;
}
static
inline
int
clr_config_init_groups
(
const
char
*
key
,
struct
lxc_conf
*
c
,
void
*
data
)
{
free_disarm
(
c
->
init_groups
.
list
);
c
->
init_groups
.
size
=
0
;
return
0
;
}
static
inline
int
clr_config_ephemeral
(
const
char
*
key
,
struct
lxc_conf
*
c
,
void
*
data
)
{
...
...
src/lxc/start.c
View file @
e778f973
...
...
@@ -1357,12 +1357,21 @@ static int do_start(void *data)
* we switched to root in the new user namespace further above. Only
* drop groups if we can, so ensure that we have necessary privilege.
*/
if
(
lxc_list_empty
(
&
handler
->
conf
->
id_map
))
if
(
lxc_list_empty
(
&
handler
->
conf
->
id_map
))
{
#if HAVE_LIBCAP
if
(
lxc_proc_cap_is_set
(
CAP_SETGID
,
CAP_EFFECTIVE
))
#endif
if
(
!
lxc_drop_groups
())
goto
out_warn_father
;
{
if
(
handler
->
conf
->
init_groups
.
size
>
0
)
{
if
(
!
lxc_setgroups
(
handler
->
conf
->
init_groups
.
list
,
handler
->
conf
->
init_groups
.
size
))
goto
out_warn_father
;
}
else
{
if
(
!
lxc_drop_groups
())
goto
out_warn_father
;
}
}
}
if
(
!
lxc_switch_uid_gid
(
new_uid
,
new_gid
))
goto
out_warn_father
;
...
...
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