From defa02a609d74169c5d8c86cde4004d23ad3d47e Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Fri, 6 Jun 2014 09:28:06 +0200 Subject: [PATCH 01/39] Debug: Remove garbage statement for debug purposes --- modules/monitoring/application/controllers/ListController.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 34854ba32..a5ec02066 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -288,8 +288,6 @@ class Monitoring_ListController extends Controller )->getQuery(); $this->view->contacts = $query->paginate(); - file_put_contents('/tmp/query.txt', (string) $query); - $this->setupSortControl(array( 'contact_name' => 'Name', 'contact_alias' => 'Alias', From a5e9d6cf0d3d48035ddabf8c71e85b448f228c7b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 6 Jun 2014 09:33:29 +0200 Subject: [PATCH 02/39] auth: increase backends tried counter AFTER skipping autologin backends --- application/controllers/AuthenticationController.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/application/controllers/AuthenticationController.php b/application/controllers/AuthenticationController.php index b2e5294e3..f50987de7 100644 --- a/application/controllers/AuthenticationController.php +++ b/application/controllers/AuthenticationController.php @@ -111,12 +111,10 @@ class AuthenticationController extends ActionController $backendsWithError = 0; foreach ($chain as $backend) { - ++$backendsTried; - if ($backend instanceof AutoLoginBackend) { continue; } - + ++$backendsTried; try { $authenticated = $backend->authenticate($user, $password); } catch (AuthenticationException $e) { From e01629fe0b3d09554ca98eef67d6247e66ad6fe1 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 6 Jun 2014 08:31:00 +0000 Subject: [PATCH 03/39] ActionController: fix initial redirect refs #6419 --- library/Icinga/Web/Controller/ActionController.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index c744fe0f8..870078e96 100644 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -370,17 +370,14 @@ class ActionController extends Zend_Controller_Action **/ public function redirectNow($url) { - if (! $url instanceof Url) { - $url = Url::fromPath($url); - } - $url = preg_replace('~&~', '&', $url); + $url = Url::fromPath(preg_replace('~&~', '&', $url)); if ($this->_request->isXmlHttpRequest()) { header('X-Icinga-Redirect: ' . rawurlencode($url)); // $this->getResponse()->sendHeaders() ?? // Session shutdown exit; // Really? } else { - $this->_helper->Redirector->gotoUrlAndExit($url); + $this->_helper->Redirector->gotoUrlAndExit($url->getRelativeUrl()); } $this->isRedirect = true; // pretty useless right now } From 58b509b8eec0efde5016e2441777aaf88195b917 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Fri, 6 Jun 2014 10:48:22 +0200 Subject: [PATCH 04/39] Puppet: Use /vagrant directory to deliver web files Apache uses now /vagrant/public instead of /var/www/html symlinks. fixes #6421 --- .../files/etc/httpd/conf.d/icingaweb.conf | 4 +- .vagrant-puppet/manifests/default.pp | 47 ------------------- 2 files changed, 3 insertions(+), 48 deletions(-) diff --git a/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf b/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf index 462689ce9..0b45bea1f 100644 --- a/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf +++ b/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf @@ -1,4 +1,6 @@ - +Alias /icingaweb /vagrant/public + + Options FollowSymLinks AllowOverride None Order allow,deny diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 040e5574b..dcfbad7a3 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -716,54 +716,7 @@ exec { 'populate-icinga_web-mysql-db': require => [ Exec['create-mysql-icinga_web-db'], Cmmi['icinga-web'] ] } -# -# Development environment (Feature #5554) -# file { '/var/www/html/icingaweb': - ensure => 'directory', - owner => 'apache', - group => 'apache' -} - -file { '/var/www/html/icingaweb/css': - ensure => 'link', - target => '/vagrant/public/css', - owner => 'apache', - group => 'apache', -} - -file { '/var/www/html/icingaweb/svg': - ensure => 'link', - target => '/vagrant/public/svg', - owner => 'apache', - group => 'apache', -} - -file { '/var/www/html/icingaweb/img': - ensure => 'link', - target => '/vagrant/public/img', - owner => 'apache', - group => 'apache', -} - -file { '/var/www/html/icingaweb/js': - ensure => 'link', - target => '/vagrant/public/js', - owner => 'apache', - group => 'apache', -} - -file { '/var/www/html/icingaweb/index.php': - source => 'puppet:////vagrant/.vagrant-puppet/files/var/www/html/icingaweb/index.php', - owner => 'apache', - group => 'apache', -} - -file { '/var/www/html/icingaweb/js.php': - ensure => absent, -} - -file { '/var/www/html/icingaweb/css.php': ensure => absent, } From e3cd50ef16be34fbe7d48ccb14f0df53c61c603c Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Fri, 6 Jun 2014 10:50:58 +0200 Subject: [PATCH 05/39] Puppet: Remove stuff from manifest we do not need again --- .vagrant-puppet/manifests/default.pp | 30 ---------------------------- 1 file changed, 30 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index dcfbad7a3..4358b2898 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -479,36 +479,6 @@ service { 'icinga2': ] } -# cmmi { 'icinga2': -# url => "https://github.com/Icinga/icinga2/releases/download/v${icinga2Version}/icinga2-${icinga2Version}.tar.gz", -# output => "icinga2-${icinga2Version}.tar.gz", -# configure_command => 'mkdir build &> /dev/null || true && cd build && sudo cmake ..', -# creates => '/usr/local/sbin/icinga2', -# make => 'true && cd build/ && make && make install', -# require => Package[ ['cmake', 'boost-devel', 'bison', 'flex'] ], -# make_timeout => 900 -# } - -#configure { 'icingaweb': -# path => '/vagrant', -# flags => '--prefix=/vagrant \ -# --with-icinga-commandpipe="/usr/local/icinga-mysql/var/rw/icinga.cmd" \ -# --with-statusdat-file="/usr/local/icinga-mysql/var/status.dat" \ -# --with-objects-cache-file=/usr/local/icinga-mysql/var/objects.cache \ -# --with-icinga-backend=ido \ -# --with-httpd-config-path="/etc/httpd/conf.d" \ -# --with-ldap-authentication \ -# --with-internal-authentication \ -# --with-livestatus-socket="/usr/local/icinga-mysql/var/rw/live"', -# require => Exec['install php-ZendFramework'] -#} - -#file { 'icingaweb-public': -# ensure => '/vagrant/public', -# path => '/var/www/html/icingaweb', -# require => Class['apache'] -#} - exec { 'install php-ZendFramework-Db-Adapter-Pdo-Mysql': command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework-Db-Adapter-Pdo-Mysql', unless => 'rpm -qa | grep php-ZendFramework-Db-Adapter-Pdo-Mysql', From 89ae3713cd81b57d656b8b49809ad04747d1fa00 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Fri, 6 Jun 2014 11:01:20 +0200 Subject: [PATCH 06/39] Vagrant/finalize: Do not remount /vagrant/var/log If you do multiple provisioning calls mount point /vagrant/var/log is mounted multiple times. --- .vagrant-puppet/manifests/finalize.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.vagrant-puppet/manifests/finalize.sh b/.vagrant-puppet/manifests/finalize.sh index 02bee09a0..3b1418575 100644 --- a/.vagrant-puppet/manifests/finalize.sh +++ b/.vagrant-puppet/manifests/finalize.sh @@ -17,8 +17,13 @@ startServicesWithNonLSBCompliantExitStatusCodes () { } mountIcinga2webVarLog () { - # Remount /vagrant/var/log/ with appropriate permissions since the group apache is missing initially - mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g apache`,dmode=775,fmode=664 /vagrant/var/log/ /vagrant/var/log/ + if ! $(/bin/mount | /bin/grep -q "/vagrant/var/log"); then + # Remount /vagrant/var/log/ with appropriate permissions since the group apache is missing initially + /bin/mount -t vboxsf -o \ + uid=`id -u vagrant`,gid=`id -g apache`,dmode=775,fmode=664 \ + /vagrant/var/log/ \ + /vagrant/var/log/ + fi } installJquery From 140f307e0adf769854c3376f2885a70e0dbea74b Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Fri, 6 Jun 2014 13:48:58 +0200 Subject: [PATCH 07/39] Fix failing configure run due to removed index.php refs #4075 --- configure | 3 +-- configure.ac | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/configure b/configure index d1738226a..a48f71506 100755 --- a/configure +++ b/configure @@ -2950,7 +2950,7 @@ fi # # Create config files # -ac_config_files="$ac_config_files Makefile config/authentication.ini config/config.ini config/resources.ini config/modules/monitoring/backends.ini config/modules/monitoring/instances.ini etc/apache/icingaweb.conf public/index.php" +ac_config_files="$ac_config_files Makefile config/authentication.ini config/config.ini config/resources.ini config/modules/monitoring/backends.ini config/modules/monitoring/instances.ini etc/apache/icingaweb.conf" # @@ -3669,7 +3669,6 @@ do "config/modules/monitoring/backends.ini") CONFIG_FILES="$CONFIG_FILES config/modules/monitoring/backends.ini" ;; "config/modules/monitoring/instances.ini") CONFIG_FILES="$CONFIG_FILES config/modules/monitoring/instances.ini" ;; "etc/apache/icingaweb.conf") CONFIG_FILES="$CONFIG_FILES etc/apache/icingaweb.conf" ;; - "public/index.php") CONFIG_FILES="$CONFIG_FILES public/index.php" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/configure.ac b/configure.ac index 3ae33025d..065c81a8f 100644 --- a/configure.ac +++ b/configure.ac @@ -440,7 +440,6 @@ AC_CONFIG_FILES([ config/modules/monitoring/backends.ini config/modules/monitoring/instances.ini etc/apache/icingaweb.conf - public/index.php ]) # From a75796c64d397d37f1d41ae3d7e6bdf119b340d9 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Fri, 6 Jun 2014 13:52:45 +0200 Subject: [PATCH 08/39] Ui/Sparklines: Remove img src before putting it into DOM SVG chart was fetched although we removed image tags from DOM. This happens when text is converted into browser DOM model to use with javascript. Small regex remove img source attribute to avoid using network bandwidth for unknown resources. fixes #6124 --- public/js/icinga/loader.js | 2 +- public/js/icinga/ui.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index 3b92e5b2f..338629136 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -269,7 +269,7 @@ if (this.processRedirectHeader(req)) return; // div helps getting an XML tree - var $resp = $('
' + req.responseText + '
'); + var $resp = $('
' + icinga.ui.removeImageSourceFromSparklines(req.responseText) + '
'); var active = false; var rendered = false; var classes; diff --git a/public/js/icinga/ui.js b/public/js/icinga/ui.js index e76e2dba8..6902953ca 100644 --- a/public/js/icinga/ui.js +++ b/public/js/icinga/ui.js @@ -657,6 +657,22 @@ ); }, + /** + * Find all svg charts and removes src attributes for sparklines + * + * @param {string} text + * @returns {string} + */ + removeImageSourceFromSparklines: function(text) { + var match, sourceMatch; + var re = new RegExp(/(src=".+chart.php[^"]+")/g); + var reSource = new RegExp(/src="([^"]+)"/); + while ((match = re.exec(text))) { + text = text.replace(match[0], ''); + } + return text; + }, + initializeControls: function (parent) { var self = this; From 856e9fb3981e32128039674b2d025ad5ca72b82c Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Fri, 6 Jun 2014 13:59:56 +0200 Subject: [PATCH 09/39] Do not install removed .htaccess file refs #4075 --- Makefile.in | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 78a97cf74..a8fc908cc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -51,7 +51,6 @@ clean: # Installs/copies all static files (executables, scripts, html, etc) # install-static-files: install-application copy-web-files-public copy-web-files-modules - $(INSTALL) -m 644 $(INSTALL_OPTS) "./public/.htaccess" $(DESTDIR)$(prefix)/public/.htaccess; # # Installs all configuration files From 7c67a2ffffb76f8f0c986792bfbdbb1ef6ae9382 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 6 Jun 2014 14:36:44 +0200 Subject: [PATCH 10/39] body.phtml: Remove out-commented PHP code --- application/layouts/scripts/body.phtml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/application/layouts/scripts/body.phtml b/application/layouts/scripts/body.phtml index fbc266944..222762bb5 100644 --- a/application/layouts/scripts/body.phtml +++ b/application/layouts/scripts/body.phtml @@ -26,21 +26,6 @@ if ($notifications->hasMessages()) { -