Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Webslice
ISPConfig 3
Commits
7bf3c540
Commit
7bf3c540
authored
Aug 26, 2019
by
Marius Burkard
Browse files
- moved splitting for programs and sections (jailkit) to lib
- fixed warning in chmod
parent
9387f022
Changes
3
Show whitespace changes
Inline
Side-by-side
server/lib/classes/system.inc.php
View file @
7bf3c540
...
...
@@ -2136,6 +2136,8 @@ class system{
public
function
create_jailkit_programs
(
$home_dir
,
$programs
=
array
())
{
if
(
empty
(
$programs
))
{
return
true
;
}
elseif
(
is_string
(
$programs
))
{
$programs
=
preg_split
(
'/[\s,]+/'
,
$programs
);
}
$program_args
=
''
;
foreach
(
$programs
as
$prog
)
{
...
...
@@ -2151,6 +2153,8 @@ class system{
public
function
create_jailkit_chroot
(
$home_dir
,
$app_sections
=
array
())
{
if
(
empty
(
$app_sections
))
{
return
true
;
}
elseif
(
is_string
(
$app_sections
))
{
$app_sections
=
preg_split
(
'/[\s,]+/'
,
$app_sections
);
}
// Change ownership of the chroot directory to root
...
...
@@ -2170,11 +2174,11 @@ class system{
if
(
!
is_dir
(
$home_dir
.
'/tmp'
))
{
$this
->
mkdirpath
(
$home_dir
.
'/tmp'
,
0777
);
}
else
{
$this
->
chmod
(
$home_dir
.
'/tmp'
,
0777
);
$this
->
chmod
(
$home_dir
.
'/tmp'
,
0777
,
true
);
}
// Fix permissions of the root firectory
$this
->
chmod
(
$home_dir
.
'/bin'
,
0755
);
// was chmod g-w $CHROOT_HOMEDIR/bin
$this
->
chmod
(
$home_dir
.
'/bin'
,
0755
,
true
);
// was chmod g-w $CHROOT_HOMEDIR/bin
// mysql needs the socket in the chrooted environment
$this
->
mkdirpath
(
$home_dir
.
'/var/run/mysqld'
);
...
...
server/plugins-available/cron_jailkit_plugin.inc.php
View file @
7bf3c540
...
...
@@ -216,7 +216,7 @@ class cron_jailkit_plugin {
//check if the chroot environment is created yet if not create it with a list of program sections from the config
if
(
!
is_dir
(
$this
->
parent_domain
[
'document_root'
]
.
'/etc/jailkit'
))
{
$app
->
system
->
create_jailkit_chroot
(
$this
->
parent_domain
[
'document_root'
],
preg_split
(
'/[\s,]+/'
,
$this
->
jailkit_config
[
'jailkit_chroot_app_sections'
])
)
;
$app
->
system
->
create_jailkit_chroot
(
$this
->
parent_domain
[
'document_root'
],
$this
->
jailkit_config
[
'jailkit_chroot_app_sections'
]);
$this
->
app
->
log
(
"Added jailkit chroot"
,
LOGLEVEL_DEBUG
);
...
...
@@ -256,10 +256,10 @@ class cron_jailkit_plugin {
global
$app
;
//copy over further programs and its libraries
$app
->
system
->
create_jailkit_programs
(
$this
->
parent_domain
[
'document_root'
],
preg_split
(
'/[\s,]+/'
,
$this
->
jailkit_config
[
'jailkit_chroot_app_programs'
])
)
;
$app
->
system
->
create_jailkit_programs
(
$this
->
parent_domain
[
'document_root'
],
$this
->
jailkit_config
[
'jailkit_chroot_app_programs'
]);
$this
->
app
->
log
(
"Added app programs to jailkit chroot"
,
LOGLEVEL_DEBUG
);
$app
->
system
->
create_jailkit_programs
(
$this
->
parent_domain
[
'document_root'
],
preg_split
(
'/[\s,]+/'
,
$this
->
jailkit_config
[
'jailkit_chroot_cron_programs'
])
)
;
$app
->
system
->
create_jailkit_programs
(
$this
->
parent_domain
[
'document_root'
],
$this
->
jailkit_config
[
'jailkit_chroot_cron_programs'
]);
$this
->
app
->
log
(
"Added cron programs to jailkit chroot"
,
LOGLEVEL_DEBUG
);
}
...
...
server/plugins-available/shelluser_jailkit_plugin.inc.php
View file @
7bf3c540
...
...
@@ -273,7 +273,7 @@ class shelluser_jailkit_plugin {
//check if the chroot environment is created yet if not create it with a list of program sections from the config
if
(
!
is_dir
(
$this
->
data
[
'new'
][
'dir'
]
.
'/etc/jailkit'
))
{
$app
->
system
->
create_jailkit_chroot
(
$this
->
data
[
'new'
][
'dir'
],
preg_split
(
'/[\s,]+/'
,
$this
->
jailkit_config
[
'jailkit_chroot_app_sections'
])
)
;
$app
->
system
->
create_jailkit_chroot
(
$this
->
data
[
'new'
][
'dir'
],
$this
->
jailkit_config
[
'jailkit_chroot_app_sections'
]);
$this
->
app
->
log
(
"Added jailkit chroot"
,
LOGLEVEL_DEBUG
);
$this
->
_add_jailkit_programs
();
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment