Commit acf3c470 authored by Marius Burkard's avatar Marius Burkard

- improved jailkit program listing (textarea instead of input field)

parent 89e31e52
......@@ -137,7 +137,7 @@ fastcgi_bin=/usr/bin/php-cgi
[jailkit]
jailkit_chroot_home=/home/[username]
jailkit_chroot_app_sections=basicshell editors extendedshell netutils ssh sftp scp groups jk_lsh
jailkit_chroot_app_programs=/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico /usr/bin/mysql /usr/bin/mysqldump /usr/bin/git /usr/bin/git-receive-pack /usr/bin/git-upload-pack /usr/bin/unzip /usr/bin/zip /bin/tar /bin/rm /usr/bin/patch /usr/bin/which /usr/lib/x86_64-linux-gnu/libmemcached.so.11 /usr/lib/x86_64-linux-gnu/libmemcachedutil.so.2 /usr/lib/x86_64-linux-gnu/libMagickWand-6.Q16.so.2 /opt/php-5.6.8/bin/php /opt/php-5.6.8/include /opt/php-5.6.8/lib
jailkit_chroot_app_programs=/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico /usr/bin/mysql /usr/bin/mysqldump /usr/bin/git /usr/bin/git-receive-pack /usr/bin/git-upload-pack /usr/bin/unzip /usr/bin/zip /bin/tar /bin/rm /usr/bin/patch /usr/bin/which /usr/lib/x86_64-linux-gnu/libmemcached.so.11 /usr/lib/x86_64-linux-gnu/libmemcachedutil.so.2 /usr/lib/x86_64-linux-gnu/libMagickWand-6.Q16.so.2
jailkit_chroot_cron_programs=/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php
[vlogger]
......
......@@ -1691,13 +1691,13 @@ $form["tabs"]['jailkit'] = array(
'maxlength' => '1000'
),
'jailkit_chroot_app_programs' => array(
'datatype' => 'VARCHAR',
'datatype' => 'TEXT',
'formtype' => 'TEXT',
'default' => '',
'validators' => array( 0 => array('type' => 'NOTEMPTY',
'errmsg' => 'jailkit_chroot_app_programs_error_empty'),
1 => array ( 'type' => 'REGEX',
'regex' => '/^[a-zA-Z0-9\*\.\-\_\/\ ]{1,}$/',
'regex' => '/^[a-zA-Z0-9\*\.\-\_\/\ \r\n]{1,}$/',
'errmsg'=> 'jailkit_chroot_app_programs_error_regex'),
),
'value' => '',
......
......@@ -80,6 +80,8 @@ class page_action extends tform_actions {
$this->dataRecord = $app->getconf->get_server_config($server_id, $section);
$this->dataRecord['jailkit_chroot_app_programs'] = str_replace(' ', "\r\n", $this->dataRecord['jailkit_chroot_app_programs']);
if($section == 'mail'){
$server_config = $app->getconf->get_server_config($server_id, 'server');
$rspamd_url = 'https://'.$server_config['hostname'].':8081/rspamd/';
......@@ -122,6 +124,17 @@ class page_action extends tform_actions {
}
}
if(isset($this->dataRecord['jailkit_chroot_app_programs'])) {
$jailkit_chroot_app_programs = explode("\r\n", $this->dataRecord['jailkit_chroot_app_programs']);
$jailkit_chroot_app_programs = array_unique($jailkit_chroot_app_programs);
foreach ($jailkit_chroot_app_programs as $key => $value) {
if (trim($value)=='') {
unset($jailkit_chroot_app_programs[$key]);
}
}
$this->dataRecord['jailkit_chroot_app_programs'] = implode(' ', $jailkit_chroot_app_programs);
}
if($app->tform->errorMessage == '') {
$server_config_array[$section] = $app->tform->encode($this->dataRecord, $section);
$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
......
......@@ -13,7 +13,7 @@
<div class="col-sm-9"><input type="text" name="jailkit_chroot_app_sections" id="jailkit_chroot_app_sections" value="{tmpl_var name='jailkit_chroot_app_sections'}" class="form-control" /></div></div>
<div class="form-group">
<label for="jailkit_chroot_app_programs" class="col-sm-3 control-label">{tmpl_var name='jailkit_chroot_app_programs_txt'}</label>
<div class="col-sm-9"><input type="text" name="jailkit_chroot_app_programs" id="jailkit_chroot_app_programs" value="{tmpl_var name='jailkit_chroot_app_programs'}" class="form-control" /></div></div>
<div class="col-sm-9"><textarea name="jailkit_chroot_app_programs" id="jailkit_chroot_app_programs" class="form-control" rows='15' cols='50'>{tmpl_var name='jailkit_chroot_app_programs'}</textarea></div></div>
<div class="form-group">
<label for="jailkit_chroot_cron_programs" class="col-sm-3 control-label">{tmpl_var name='jailkit_chroot_cron_programs_txt'}</label>
<div class="col-sm-9"><input type="text" name="jailkit_chroot_cron_programs" id="jailkit_chroot_cron_programs" value="{tmpl_var name='jailkit_chroot_cron_programs'}" class="form-control" /></div></div>
......@@ -24,4 +24,4 @@
<div class="clear"><div class="right">
<button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" data-submit-form="pageForm" data-form-action="admin/server_config_edit.php">{tmpl_var name='btn_save_txt'}</button>
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="admin/server_config_list.php">{tmpl_var name='btn_cancel_txt'}</button>
</div></div>
</div></div>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment