@@ -226,30 +226,30 @@ function _add_jailkit_user()
226226 $ jailkit_chroot_userhome = $ this ->_get_home_dir ($ this ->data ['new ' ]['username ' ]);
227227 $ jailkit_chroot_puserhome = $ this ->_get_home_dir ($ this ->data ['new ' ]['puser ' ]);
228228
229- if (!is_dir ($ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_userhome ))
230- {
231- $ command = '/usr/local/ispconfig/server/scripts/create_jailkit_user.sh ' ;
232- $ command .= ' ' .escapeshellcmd ($ this ->data ['new ' ]['username ' ]);
233- $ command .= ' ' .escapeshellcmd ($ this ->data ['new ' ]['dir ' ]);
234- $ command .= ' ' .$ jailkit_chroot_userhome ;
235- $ command .= ' ' .escapeshellcmd ($ this ->data ['new ' ]['shell ' ]);
236- $ command .= ' ' .$ this ->data ['new ' ]['puser ' ];
237- $ command .= ' ' .$ jailkit_chroot_puserhome ;
238- exec ($ command );
229+ // IMPORTANT!
230+ // ALWAYS create the user. Even if the user was created before
231+ // if we check if the user exists, then a update (no shell -> jailkit) will not work
232+ // and the user has FULL ACCESS to the root of the server!
233+ $ command = '/usr/local/ispconfig/server/scripts/create_jailkit_user.sh ' ;
234+ $ command .= ' ' .escapeshellcmd ($ this ->data ['new ' ]['username ' ]);
235+ $ command .= ' ' .escapeshellcmd ($ this ->data ['new ' ]['dir ' ]);
236+ $ command .= ' ' .$ jailkit_chroot_userhome ;
237+ $ command .= ' ' .escapeshellcmd ($ this ->data ['new ' ]['shell ' ]);
238+ $ command .= ' ' .$ this ->data ['new ' ]['puser ' ];
239+ $ command .= ' ' .$ jailkit_chroot_puserhome ;
240+ exec ($ command );
239241
240- $ this ->app ->log ("Added jailkit user to chroot with command: " .$ command ,LOGLEVEL_DEBUG );
242+ $ this ->app ->log ("Added jailkit user to chroot with command: " .$ command ,LOGLEVEL_DEBUG );
241243
242- exec ("mkdir -p " .escapeshellcmd ($ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_userhome ));
243- exec ("chown " .$ this ->data ['new ' ]['username ' ].": " .$ this ->data ['new ' ]['pgroup ' ]." " .escapeshellcmd ($ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_userhome ));
244+ exec ("mkdir -p " .escapeshellcmd ($ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_userhome ));
245+ exec ("chown " .$ this ->data ['new ' ]['username ' ].": " .$ this ->data ['new ' ]['pgroup ' ]." " .escapeshellcmd ($ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_userhome ));
244246
245- $ this ->app ->log ("Added created jailkit user home in : " .$ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_userhome ,LOGLEVEL_DEBUG );
246-
247- exec ("mkdir -p " .escapeshellcmd ($ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_puserhome ));
248- exec ("chown " .$ this ->data ['new ' ]['puser ' ].": " .$ this ->data ['new ' ]['pgroup ' ]." " .escapeshellcmd ($ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_puserhome ));
249-
250- $ this ->app ->log ("Added created jailkit parent user home in : " .$ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_puserhome ,LOGLEVEL_DEBUG );
247+ $ this ->app ->log ("Added created jailkit user home in : " .$ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_userhome ,LOGLEVEL_DEBUG );
248+
249+ exec ("mkdir -p " .escapeshellcmd ($ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_puserhome ));
250+ exec ("chown " .$ this ->data ['new ' ]['puser ' ].": " .$ this ->data ['new ' ]['pgroup ' ]." " .escapeshellcmd ($ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_puserhome ));
251251
252- }
252+ $ this -> app -> log ( " Added created jailkit parent user home in : " . $ this -> data [ ' new ' ][ ' dir ' ]. $ jailkit_chroot_puserhome , LOGLEVEL_DEBUG );
253253 }
254254
255255
0 commit comments