Add if use ssl cert and path of this cert. #5

This commit is contained in:
m-lopez-f 2016-08-26 12:41:34 +02:00
parent e2bc2002f4
commit be3a520488
2 changed files with 31 additions and 1 deletions

View File

@ -20,6 +20,7 @@ check_login ();
$table = new StdClass();
$table->class = 'databox filters';
$table->id = 'setup_general';
$table->width = '100%';
$table->data = array ();
$table->size = array();
@ -74,6 +75,14 @@ $table->data[11][0] = __('Enforce https');
$table->data[11][1] = __('Yes').'   '.html_print_radio_button_extended ('https', 1, '', $config["https"], false, "if (! confirm ('" . __('If SSL is not properly configured you will lose access to Pandora FMS Console. Do you want to continue?') . "')) return false", '', true) .'  ';
$table->data[11][1] .= __('No').'   '.html_print_radio_button ('https', 0, '', $config["https"], true);
$table->data[12][0] = __('Use cert of SSL');
$table->data[12][1] = __('Yes').'   '.html_print_radio_button_extended ('use_cert', 1, '', $config["use_cert"], false, '', '', true) .'  ';
$table->data[12][1] .= __('No').'   '.html_print_radio_button ('use_cert', 0, '', $config["use_cert"], true);
$table->rowstyle[13] = 'display: none;';
$table->data[13][0] = __('Path of SSL Cert.') . ui_print_help_tip (__("Path where you put your cert and name of this cert. Remember your cert only in .pem extension."), true);
$table->data[13][1] = html_print_input_text ('cert_path', io_safe_output($config["cert_path"]), '', 50, 255, true);
$table->data[14][0] = __('Attachment store') . ui_print_help_tip (__("Directory where temporary data is stored."), true);
$table->data[14][1] = html_print_input_text ('attachment_store', io_safe_output($config["attachment_store"]), '', 50, 255, true);
@ -285,7 +294,6 @@ $table->data[36][0] = __('audit log directory') .
ui_print_help_tip (__("Directory where audit log is stored."), true);
$table->data[36][1] = html_print_input_text ('auditdir', io_safe_output($config["auditdir"]), '', 30, 100, true);
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';
echo "<fieldset>";
@ -358,6 +366,16 @@ $(document).ready (function () {
$("#zone").attr("hidden", false);
$("#timezone").attr("hidden", false);
});
$("input[name=use_cert]").change(function () {
if( $(this).is(":checked") ){
var val = $(this).val();
if (val == 1) {
$('#setup_general-13').show();
}
else
$('#setup_general-13').hide();
}
});
});
</script>
<?php

View File

@ -141,8 +141,12 @@ function config_update_config () {
$error_update[] = __('Time source');
if (!config_update_value ('autoupdate', (bool) get_parameter ('autoupdate')))
$error_update[] = __('Automatic check for updates');
if (!config_update_value ('cert_path', (bool) get_parameter ('cert_path')))
$error_update[] = __('SSL cert path');
if (!config_update_value ('https', (bool) get_parameter ('https')))
$error_update[] = __('Enforce https');
if (!config_update_value ('use_cert', (bool) get_parameter ('use_cert')))
$error_update[] = __('Use cert.');
if (!config_update_value ('attachment_store', (string) get_parameter ('attachment_store')))
$error_update[] = __('Attachment store');
if (!config_update_value ('list_ACL_IPs_for_API', (string) get_parameter('list_ACL_IPs_for_API')))
@ -769,6 +773,14 @@ function config_process_config () {
// potentially unexisting config by default
config_update_value ('https', false);
}
if (!isset ($config["use_cert"])) {
config_update_value ('use_cert', false);
}
if (!isset ($config['cert_path'])) {
// Sets name and path of ssl path for use in application
config_update_value ('cert_path', '/etc/ssl/certs/pandorafms.pem');
}
if (!isset ($config["num_files_attachment"])) {
config_update_value ('num_files_attachment', 100);