mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-04-08 17:15:08 +02:00
Merge branch 'master' into bugfix/rebuild-form-builder-5525
Conflicts: modules/monitoring/application/controllers/ConfigController.php
This commit is contained in:
commit
11063495b2
@ -1,35 +0,0 @@
|
||||
[Incidents]
|
||||
title = "Current incidents"
|
||||
|
||||
[Incidents.Service Problems]
|
||||
url = "monitoring/list/services"
|
||||
service_problem = 1
|
||||
limit = 10
|
||||
sort = service_severity
|
||||
|
||||
[Incidents.Recently Recovered Services]
|
||||
url = "monitoring/list/services"
|
||||
sort = "service_last_state_change"
|
||||
service_state = 0
|
||||
limit = 10
|
||||
dir = "desc"
|
||||
|
||||
[Incidents.Host Problems]
|
||||
url = "monitoring/list/hosts"
|
||||
host_problem = 1
|
||||
sort = host_severity
|
||||
|
||||
[Landing]
|
||||
title = "Landing page"
|
||||
|
||||
[Landing.Hostgroups]
|
||||
url = "monitoring/chart/hostgroup?height=400&width=500"
|
||||
|
||||
[Landing.Servicegroups]
|
||||
url = "monitoring/chart/servicegroup?height=360&width=450"
|
||||
|
||||
[Landing.Unhandled Problem Services]
|
||||
url = "monitoring/list/services?service_handled=0&service_problem=1"
|
||||
|
||||
[Landing.Unhandled Problem Hosts]
|
||||
url = "monitoring/list/hosts?host_handled=0&host_problem=1"
|
@ -1,35 +0,0 @@
|
||||
[Dashboard]
|
||||
title = "Dashboard"
|
||||
url = "dashboard"
|
||||
icon = "img/icons/dashboard.png"
|
||||
priority = 10
|
||||
|
||||
[System]
|
||||
icon = img/icons/configuration.png
|
||||
priority = 200
|
||||
|
||||
[System.Preferences]
|
||||
title = "Preferences"
|
||||
url = "preference"
|
||||
priority = 200
|
||||
|
||||
[System.Configuration]
|
||||
title = "Configuration"
|
||||
url = "config"
|
||||
priority = 300
|
||||
|
||||
[System.Modules]
|
||||
title = "Modules"
|
||||
url = "config/modules"
|
||||
priority = 400
|
||||
|
||||
[System.ApplicationLog]
|
||||
title = "Application log"
|
||||
url = "list/applicationlog"
|
||||
priority = 500
|
||||
|
||||
[Logout]
|
||||
url = "authentication/logout"
|
||||
icon = img/icons/logout.png
|
||||
priority = 300
|
||||
|
@ -1,5 +0,0 @@
|
||||
[Documentation]
|
||||
title = "Documentation"
|
||||
icon = "img/icons/comment.png"
|
||||
url = "doc"
|
||||
priority = 80
|
@ -1,109 +0,0 @@
|
||||
|
||||
[Problems]
|
||||
priority = 20
|
||||
icon = "img/icons/error.png"
|
||||
|
||||
[Problems.Unhandled Hosts]
|
||||
priority = 40
|
||||
url = "monitoring/list/hosts?host_problem=1&host_handled=0"
|
||||
|
||||
[Problems.Unhandled Services]
|
||||
priority = 40
|
||||
url = "monitoring/list/services?service_problem=1&service_handled=0&sort=service_severity"
|
||||
|
||||
[Problems.Host Problems]
|
||||
priority = 50
|
||||
url = "monitoring/list/hosts?host_problem=1&sort=host_severity"
|
||||
|
||||
[Problems.Service Problems]
|
||||
priority = 50
|
||||
url = "monitoring/list/services?service_problem=1&sort=service_severity&dir=desc"
|
||||
|
||||
[Problems.Current Downtimes]
|
||||
url = "monitoring/list/downtimes?downtime_is_in_effect=1"
|
||||
|
||||
[Overview]
|
||||
priority = 30
|
||||
icon = "img/icons/hostgroup.png"
|
||||
|
||||
[Overview.Tactical Overview]
|
||||
title = "Tactical Overview"
|
||||
url = "monitoring/tactical"
|
||||
priority = 40
|
||||
|
||||
[Overview.Hosts]
|
||||
title = "Hosts"
|
||||
url = "monitoring/list/hosts"
|
||||
priority = 50
|
||||
|
||||
[Overview.Services]
|
||||
title = "Services"
|
||||
url = "monitoring/list/services"
|
||||
priority = 50
|
||||
|
||||
[Overview.Servicematrix]
|
||||
title = "Servicematrix"
|
||||
url = "monitoring/list/servicematrix?service_problem=1"
|
||||
priority = 51
|
||||
|
||||
[Overview.Servicegroups]
|
||||
title = "Servicegroups"
|
||||
url = "monitoring/list/servicegroups"
|
||||
priority = 60
|
||||
|
||||
[Overview.Hostgroups]
|
||||
title = "Hostgroups"
|
||||
url = "monitoring/list/hostgroups"
|
||||
priority = 60
|
||||
|
||||
[Overview.Contactgroups]
|
||||
title = "Contactgroups"
|
||||
url = "monitoring/list/contactgroups"
|
||||
priority = 61
|
||||
|
||||
[Overview.Downtimes]
|
||||
title = "Downtimes"
|
||||
url = "monitoring/list/downtimes"
|
||||
priority = 70
|
||||
|
||||
[Overview.Comments]
|
||||
title = "Comments"
|
||||
url = "monitoring/list/comments?comment_type=(comment|ack)"
|
||||
priority = 70
|
||||
|
||||
[Overview.Contacts]
|
||||
title = "Contacts"
|
||||
url = "monitoring/list/contacts"
|
||||
priority = 70
|
||||
|
||||
[History]
|
||||
icon = "img/icons/history.png"
|
||||
|
||||
[History.Critical Events]
|
||||
title = "Critical Events"
|
||||
url = "monitoring/list/statehistorysummary"
|
||||
priority = 50
|
||||
|
||||
[History.Notifications]
|
||||
title = "Notifications"
|
||||
url = "monitoring/list/notifications"
|
||||
|
||||
[History.Events]
|
||||
title = "All Events"
|
||||
url = "monitoring/list/eventhistory?timestamp>=-7%20days"
|
||||
|
||||
[History.Timeline]
|
||||
title = "Timeline"
|
||||
url = "monitoring/timeline"
|
||||
|
||||
[System.Process Info]
|
||||
title = "Process Info"
|
||||
url = "monitoring/process/info"
|
||||
priority = 120
|
||||
|
||||
[System.Performance Info]
|
||||
title = "Performance Info"
|
||||
url = "monitoring/process/performance"
|
||||
priority = 130
|
||||
|
||||
|
@ -710,7 +710,7 @@ file { '/etc/icingaweb/config.ini':
|
||||
}
|
||||
|
||||
file { '/etc/icingaweb/menu.ini':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/menu.ini',
|
||||
source => 'puppet:////vagrant/config/menu.ini',
|
||||
owner => 'apache',
|
||||
group => 'apache',
|
||||
# replace => false,
|
||||
@ -735,6 +735,12 @@ file { '/etc/icingaweb/modules/monitoring/backends.ini':
|
||||
group => 'apache',
|
||||
}
|
||||
|
||||
file { '/etc/icingaweb/modules/monitoring/config.ini':
|
||||
source => 'puppet:////vagrant/config/modules/monitoring/config.ini',
|
||||
owner => 'apache',
|
||||
group => 'apache',
|
||||
}
|
||||
|
||||
file { '/etc/icingaweb/modules/monitoring/instances.ini':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/instances.ini',
|
||||
owner => 'apache',
|
||||
@ -742,7 +748,7 @@ file { '/etc/icingaweb/modules/monitoring/instances.ini':
|
||||
}
|
||||
|
||||
file { '/etc/icingaweb/modules/monitoring/menu.ini':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/menu.ini',
|
||||
source => 'puppet:////vagrant/config/modules/monitoring/menu.ini',
|
||||
owner => 'apache',
|
||||
group => 'apache',
|
||||
}
|
||||
@ -754,7 +760,7 @@ file { '/etc/icingaweb/dashboard':
|
||||
}
|
||||
|
||||
file { '/etc/icingaweb/dashboard/dashboard.ini':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/dashboard/dashboard.ini',
|
||||
source => 'puppet:////vagrant/config/dashboard/dashboard.ini',
|
||||
owner => 'apache',
|
||||
group => 'apache',
|
||||
}
|
||||
@ -793,7 +799,7 @@ file { '/etc/icingaweb/modules/doc/':
|
||||
}
|
||||
|
||||
file { '/etc/icingaweb/modules/doc/menu.ini':
|
||||
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/modules/doc/menu.ini',
|
||||
source => 'puppet:////vagrant/config/modules/doc/menu.ini',
|
||||
owner => 'apache',
|
||||
group => 'apache',
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class casperjs(
|
||||
require => Class['wget']
|
||||
}
|
||||
|
||||
$tld = inline_template('<%= File.basename(output, ".tar.bz2") %>')
|
||||
$tld = inline_template('<%= File.basename(@output, ".tar.bz2") %>')
|
||||
$src = "${cwd}/casperjs"
|
||||
|
||||
exec { 'extract-casperjs':
|
||||
|
@ -51,7 +51,7 @@ define cmmi(
|
||||
require => Class['wget']
|
||||
}
|
||||
|
||||
$tld = inline_template('<%= File.basename(output, ".tar.gz") %>')
|
||||
$tld = inline_template('<%= File.basename(@output, ".tar.gz") %>')
|
||||
$src = "${cwd}/${name}/${tld}"
|
||||
|
||||
exec { "extract-${name}":
|
||||
|
2
config/modules/monitoring/config.ini
Normal file
2
config/modules/monitoring/config.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[security]
|
||||
protected_customvars = "*pw*,*pass*,community"
|
@ -1,69 +0,0 @@
|
||||
[menu]
|
||||
;Remove component as of #4583 since it's not working
|
||||
;Issues.title = "Issues" ; Extended version
|
||||
;Issues.route = "/monitoring/list/services?problems=1&sort=severity" ; Explicit route
|
||||
;Issues.key = "issues" ; When this key is set in the controller, the item is active
|
||||
|
||||
;Remove component as of #4583 since it's not working
|
||||
;Changes.title = "Recent Changes"
|
||||
;Changes.route = "/monitoring/list/services?sort=service_last_state_change"
|
||||
;_1 = 1 ;Spacer after this section
|
||||
|
||||
Hosts.title = "Hosts"
|
||||
Hosts.route = "/monitoring/list/hosts"
|
||||
Hosts.iconClass = "icinga-icon-host-petrol"
|
||||
|
||||
Services.title = "Services"
|
||||
Services.route = "/monitoring/list/services"
|
||||
Services.iconClass = "icinga-icon-service-petrol"
|
||||
|
||||
Downtimes.title = "Downtimes"
|
||||
Downtimes.route = "/monitoring/list/downtimes"
|
||||
Downtimes.iconClass = "icinga-icon-down-petrol"
|
||||
|
||||
Notifications.title = "Notifications"
|
||||
Notifications.route = "/monitoring/list/notifications"
|
||||
Notifications.iconClass = "icinga-icon-notification-petrol"
|
||||
|
||||
Comments.title = "Comments"
|
||||
Comments.route = "/monitoring/list/comments"
|
||||
Comments.iconClass = "icinga-icon-comment-petrol"
|
||||
|
||||
;Contacts = "/monitoring/list/contacts"
|
||||
|
||||
;Contact Groups = "/monitoring/list/contactgroups"
|
||||
|
||||
Servicegroups.title = "Servicegroups"
|
||||
Servicegroups.route = "/monitoring/list/servicegroups"
|
||||
Servicegroups.iconClass = "icinga-icon-servicegroup-petrol"
|
||||
|
||||
Hostgroups.title = "Hostgroups"
|
||||
Hostgroups.route = "/monitoring/list/hostgroups"
|
||||
Hostgroups.iconClass = "icinga-icon-hostgroup-petrol"
|
||||
|
||||
History.title = "History"
|
||||
History.route = "/monitoring/list/eventhistory"
|
||||
History.iconClass = "icinga-icon-history-petrol"
|
||||
|
||||
Performance.title = "Performance"
|
||||
Performance.route ="/monitoring/process/performance"
|
||||
|
||||
|
||||
[Hosts]
|
||||
; New section
|
||||
; Title property unset means title is "Hosts"
|
||||
url="#"
|
||||
iconClass="icon-hosts"
|
||||
priority=1
|
||||
|
||||
[Hosts.Problems]
|
||||
; New section beneath section hosts
|
||||
title="Problem Hosts"
|
||||
url="/monitoring/list/hosts?problem=1"
|
||||
priority=2
|
||||
|
||||
[Hosts.A Link]
|
||||
title="Wiki"
|
||||
url="https://wiki.somewhere.com"
|
||||
priority=1
|
||||
icon="https://wiki.somewhere.com/icon.png"
|
@ -10,6 +10,7 @@ use Icinga\Web\Notification;
|
||||
use Icinga\Form\Config\ConfirmRemovalForm;
|
||||
use Icinga\Module\Monitoring\Form\Config\BackendForm;
|
||||
use Icinga\Module\Monitoring\Form\Config\InstanceForm;
|
||||
use Icinga\Module\Monitoring\Form\Config\SecurityForm;
|
||||
use Icinga\Exception\NotReadableError;
|
||||
|
||||
/**
|
||||
@ -230,7 +231,7 @@ class Monitoring_ConfigController extends ModuleActionController
|
||||
*
|
||||
* @return bool Whether the configuration was written or not
|
||||
*/
|
||||
protected function writeConfiguration($config, $file)
|
||||
protected function writeConfiguration($config, $file = null)
|
||||
{
|
||||
if (is_array($config)) {
|
||||
$config = new Zend_Config($config);
|
||||
@ -249,4 +250,25 @@ class Monitoring_ConfigController extends ModuleActionController
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function securityAction()
|
||||
{
|
||||
$this->view->tabs = $this->Module()->getConfigTabs()->activate('security');
|
||||
|
||||
$form = new SecurityForm();
|
||||
$form->setConfiguration($this->Config()->get('security'));
|
||||
$form->setRequest($this->getRequest());
|
||||
if ($form->isSubmittedAndValid()) {
|
||||
$config = $this->Config()->toArray();
|
||||
$config['security'] = $form->getConfig();
|
||||
if ($this->writeConfiguration(new Zend_Config($config))) {
|
||||
Notification::success('Configuration modified successfully');
|
||||
$this->redirectNow('monitoring/config/security');
|
||||
} else {
|
||||
$this->render('show-configuration');
|
||||
return;
|
||||
}
|
||||
}
|
||||
$this->view->form = $form;
|
||||
}
|
||||
}
|
||||
|
59
modules/monitoring/application/forms/Config/SecurityForm.php
Normal file
59
modules/monitoring/application/forms/Config/SecurityForm.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Module\Monitoring\Form\Config;
|
||||
|
||||
use Zend_Config;
|
||||
use Icinga\Web\Form;
|
||||
|
||||
class SecurityForm extends Form
|
||||
{
|
||||
/**
|
||||
* The configuration to use for populating the form
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Create this form
|
||||
*
|
||||
* @see Icinga\Web\Form::create
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$this->addElement(
|
||||
'text',
|
||||
'protected_customvars',
|
||||
array(
|
||||
'label' => 'Protected Custom Variables',
|
||||
'required' => true,
|
||||
'value' => $this->config->protected_customvars,
|
||||
'helptext' => 'Comma separated case insensitive list of protected custom variables.'
|
||||
. ' Use * as a placeholder for zero or more wildcard characters.'
|
||||
. ' Existance of those custom variables will be shown, but their values will be masked.'
|
||||
)
|
||||
);
|
||||
$this->setSubmitLabel('Save');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the configuration to be used for initial population of the form
|
||||
*/
|
||||
public function setConfiguration($config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the configuration set by this form
|
||||
*
|
||||
* @return Zend_Config The configuration set in this form
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
$values = $this->getValues();
|
||||
return new Zend_Config(array(
|
||||
'protected_customvars' => $values['protected_customvars']
|
||||
));
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<div class="controls">
|
||||
<?= $this->tabs ?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?= $this->form ?>
|
||||
</div>
|
@ -1,16 +1,8 @@
|
||||
<?php
|
||||
|
||||
if (! $object->customvars) { return; }
|
||||
|
||||
foreach ($object->customvars as $name => $value) {
|
||||
$name = ucwords(str_replace('_', ' ', strtolower($name)));
|
||||
if (preg_match('~(?:pw|pass|community)~', strtolower($name))) {
|
||||
$value = '***';
|
||||
}
|
||||
printf(
|
||||
"<tr><th>%s</th><td>%s</td></tr>\n",
|
||||
$this->escape($name),
|
||||
$this->escape($value)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -12,4 +12,7 @@ $this->provideConfigTab('backends', array(
|
||||
'title' => 'Backends',
|
||||
'url' => 'config'
|
||||
));
|
||||
|
||||
$this->provideConfigTab('security', array(
|
||||
'title' => 'Security',
|
||||
'url' => 'config/security'
|
||||
));
|
||||
|
@ -20,6 +20,7 @@ use Icinga\Module\Monitoring\DataView\Comment;
|
||||
use Icinga\Module\Monitoring\DataView\Servicegroup;
|
||||
use Icinga\Module\Monitoring\DataView\Customvar;
|
||||
use Icinga\Web\UrlParams;
|
||||
use Icinga\Application\Config;
|
||||
|
||||
|
||||
abstract class AbstractObject
|
||||
@ -120,6 +121,23 @@ abstract class AbstractObject
|
||||
|
||||
public function fetchCustomvars()
|
||||
{
|
||||
$blacklist = array();
|
||||
$blacklistPattern = '/^(.*pw.*|.*pass.*|community)$/';
|
||||
|
||||
if ($security = Config::module('monitoring')->get('security')) {
|
||||
|
||||
$blacklistConfig = $security->get('protected_customvars', '');
|
||||
|
||||
foreach (explode(',', $blacklistConfig) as $customvar) {
|
||||
$nonWildcards = array();
|
||||
foreach (explode('*', $customvar) as $nonWildcard) {
|
||||
$nonWildcards[] = preg_quote($nonWildcard, '/');
|
||||
}
|
||||
$blacklist[] = implode('.*', $nonWildcards);
|
||||
}
|
||||
$blacklistPattern = '/^(' . implode('|', $blacklist) . ')$/i';
|
||||
}
|
||||
|
||||
$query = Customvar::fromParams(array('backend' => null), array(
|
||||
'varname',
|
||||
'varvalue'
|
||||
@ -135,7 +153,15 @@ abstract class AbstractObject
|
||||
->where('service_description', $this->service_description);
|
||||
}
|
||||
|
||||
$this->customvars = $query->getQuery()->fetchPairs();
|
||||
$customvars = $query->getQuery()->fetchPairs();
|
||||
foreach ($customvars as $name => &$value) {
|
||||
$name = ucwords(str_replace('_', ' ', strtolower($name)));
|
||||
if ($blacklistPattern && preg_match($blacklistPattern, $name)) {
|
||||
$value = '***';
|
||||
}
|
||||
$this->customvars[$name] = $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -23,12 +23,8 @@ class TranslationCommand extends Command
|
||||
*/
|
||||
public function validateLocaleCode($code)
|
||||
{
|
||||
$current = setlocale(LC_ALL, '0');
|
||||
$result = setlocale(LC_ALL, $code);
|
||||
setlocale(LC_ALL, $current);
|
||||
|
||||
if ($result === false) {
|
||||
throw new Exception("Locale code '$code' is not valid");
|
||||
if (! preg_match('@[a-z]{2}_[A-Z]{2}@', $code)) {
|
||||
throw new Exception("Locale code '$code' is not valid. Expected format is: ll_CC");
|
||||
}
|
||||
|
||||
return $code;
|
||||
|
@ -37,12 +37,19 @@ class GettextTranslationHelper
|
||||
private $moduleMgr;
|
||||
|
||||
/**
|
||||
* The current version of IcingaWeb2
|
||||
* The current version of Icingaweb 2 or of the module the catalog is being created for
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* The name of the module if any
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $moduleName;
|
||||
|
||||
/**
|
||||
* The locale used by this helper
|
||||
*
|
||||
@ -93,8 +100,7 @@ class GettextTranslationHelper
|
||||
*/
|
||||
public function __construct(ApplicationBootstrap $bootstrap, $locale)
|
||||
{
|
||||
$this->version = $bootstrap->getConfig()->app()->global->get('version', '0.1');
|
||||
$this->moduleMgr = $bootstrap->getModuleManager();
|
||||
$this->moduleMgr = $bootstrap->getModuleManager()->loadEnabledModules();
|
||||
$this->appDir = $bootstrap->getApplicationDir();
|
||||
$this->locale = $locale;
|
||||
}
|
||||
@ -106,6 +112,7 @@ class GettextTranslationHelper
|
||||
{
|
||||
$this->catalogPath = tempnam(sys_get_temp_dir(), 'IcingaTranslation_');
|
||||
$this->templatePath = tempnam(sys_get_temp_dir(), 'IcingaPot_');
|
||||
$this->version = 'None'; // TODO: Access icinga version from a file or property
|
||||
|
||||
$this->moduleDir = null;
|
||||
$this->tablePath = implode(
|
||||
@ -133,6 +140,8 @@ class GettextTranslationHelper
|
||||
{
|
||||
$this->catalogPath = tempnam(sys_get_temp_dir(), 'IcingaTranslation_');
|
||||
$this->templatePath = tempnam(sys_get_temp_dir(), 'IcingaPot_');
|
||||
$this->version = $this->moduleMgr->getModule($module)->getVersion();
|
||||
$this->moduleName = $this->moduleMgr->getModule($module)->getName();
|
||||
|
||||
$this->moduleDir = $this->moduleMgr->getModuleDir($module);
|
||||
$this->tablePath = implode(
|
||||
@ -251,7 +260,7 @@ class GettextTranslationHelper
|
||||
'author_name' => 'FIRST AUTHOR',
|
||||
'author_mail' => 'EMAIL@ADDRESS',
|
||||
'author_year' => 'YEAR',
|
||||
'project_name' => 'Icinga Web 2',
|
||||
'project_name' => $this->moduleName ? ucfirst($this->moduleName) . ' Module' : 'Icinga Web 2',
|
||||
'project_version' => $this->version,
|
||||
'project_bug_mail' => 'dev@icinga.org',
|
||||
'pot_creation_date' => date('Y-m-d H:iO'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user