#9143 Added license_encryption_key
This commit is contained in:
parent
9ae4c7ca67
commit
737f27f782
|
@ -59,6 +59,8 @@ if (is_metaconsole()) {
|
||||||
enterprise_include_once('include/functions_license.php');
|
enterprise_include_once('include/functions_license.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enterprise_include_once('include/functions_crypto.php');
|
||||||
|
|
||||||
if ($renew_license_result !== null) {
|
if ($renew_license_result !== null) {
|
||||||
echo $renew_license_result;
|
echo $renew_license_result;
|
||||||
}
|
}
|
||||||
|
@ -74,8 +76,32 @@ if ($update_settings) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$customer_key = $_POST['keys']['customer_key'];
|
||||||
|
|
||||||
|
$license_encryption_key = get_parameter('license_encryption_key', false);
|
||||||
|
if ($license_encryption_key !== false) {
|
||||||
|
$check = db_get_value_sql('SELECT `key` FROM tupdate_settings WHERE `key` LIKE "license_encryption_key"');
|
||||||
|
if ($check === false) {
|
||||||
|
db_process_sql_insert(
|
||||||
|
'tupdate_settings',
|
||||||
|
[
|
||||||
|
db_escape_key_identifier('value') => $license_encryption_key,
|
||||||
|
db_escape_key_identifier('key') => 'license_encryption_key',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
db_process_sql_update(
|
||||||
|
'tupdate_settings',
|
||||||
|
[db_escape_key_identifier('value') => $license_encryption_key],
|
||||||
|
[db_escape_key_identifier('key') => 'license_encryption_key']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$customer_key = openssl_blowfish_encrypt_hex($customer_key, io_safe_output($license_encryption_key));
|
||||||
|
}
|
||||||
|
|
||||||
// Update the license file.
|
// Update the license file.
|
||||||
$result = file_put_contents($config['remote_config'].'/'.LICENSE_FILE, $_POST['keys']['customer_key']);
|
$result = file_put_contents($config['remote_config'].'/'.LICENSE_FILE, $customer_key);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
ui_print_error_message(__('Failed to Update license file'));
|
ui_print_error_message(__('Failed to Update license file'));
|
||||||
}
|
}
|
||||||
|
@ -153,8 +179,21 @@ $table->data[7][1] = html_print_input_text('expires', ($license['nms'] == 1 ? __
|
||||||
$table->data[8][0] = '<strong>'.__('Satellite').'</strong>';
|
$table->data[8][0] = '<strong>'.__('Satellite').'</strong>';
|
||||||
$table->data[8][1] = html_print_input_text('expires', ($license['dhpm'] == 1 ? __('enabled') : __('disabled')), '', 10, 255, true, true);
|
$table->data[8][1] = html_print_input_text('expires', ($license['dhpm'] == 1 ? __('enabled') : __('disabled')), '', 10, 255, true, true);
|
||||||
|
|
||||||
$table->data[9][0] = '<strong>'.__('Licensed to').'</strong>';
|
if ($license['dhpm'] == 1) {
|
||||||
$table->data[9][1] = html_print_input_text('licensed_to', $license['licensed_to'], '', 64, 255, true, true);
|
$table->data[9][0] = '<strong>'.__('License encryption key').'</strong>';
|
||||||
|
$table->data[9][1] = html_print_input_password(
|
||||||
|
'license_encryption_key',
|
||||||
|
io_safe_output($settings->license_encryption_key),
|
||||||
|
'',
|
||||||
|
10,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->data[10][0] = '<strong>'.__('Licensed to').'</strong>';
|
||||||
|
$table->data[10][1] = html_print_input_text('licensed_to', $license['licensed_to'], '', 64, 255, true, true);
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
|
|
|
@ -14751,6 +14751,11 @@ function api_set_metaconsole_license_file($key)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$license_encryption_key = db_get_value('value', 'tupdate_settings', '`key`', 'license_encryption_key');
|
||||||
|
if ($license_encryption_key !== false) {
|
||||||
|
$key = openssl_blowfish_encrypt_hex($key, io_safe_output($license_encryption_key));
|
||||||
|
}
|
||||||
|
|
||||||
// Update the license file.
|
// Update the license file.
|
||||||
$result = file_put_contents($config['remote_config'].'/'.LICENSE_FILE, $key);
|
$result = file_put_contents($config['remote_config'].'/'.LICENSE_FILE, $key);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
|
|
Loading…
Reference in New Issue