Vagrant: Add authentication.ini and resources.ini to /etc/icingaweb
refs #5638
This commit is contained in:
parent
af342d6b3a
commit
25665dec24
|
@ -0,0 +1,11 @@
|
||||||
|
[internal_ldap_authentication]
|
||||||
|
backend = ldap
|
||||||
|
resource = internal_ldap
|
||||||
|
; Object class of the user
|
||||||
|
user_class = inetOrgPerson
|
||||||
|
; ; Attribute name for username
|
||||||
|
user_name_attribute = uid
|
||||||
|
|
||||||
|
[internal_db_authentication]
|
||||||
|
backend = db
|
||||||
|
resource = "internal_db"
|
|
@ -0,0 +1,34 @@
|
||||||
|
[internal_db]
|
||||||
|
type = db
|
||||||
|
db = mysql
|
||||||
|
host = localhost
|
||||||
|
port = 3306
|
||||||
|
password = icingaweb
|
||||||
|
username = icingaweb
|
||||||
|
dbname = icingaweb
|
||||||
|
|
||||||
|
[ido]
|
||||||
|
type = db
|
||||||
|
db = mysql
|
||||||
|
host = localhost
|
||||||
|
port = 3306
|
||||||
|
password = icinga
|
||||||
|
username = icinga
|
||||||
|
dbname = icinga
|
||||||
|
|
||||||
|
[statusdat]
|
||||||
|
type = statusdat
|
||||||
|
status_file = /usr/local/icinga-mysql/var/status.dat
|
||||||
|
object_file = /usr/local/icinga-mysql/var/objects.cache
|
||||||
|
|
||||||
|
[livestatus]
|
||||||
|
type = livestatus
|
||||||
|
socket = /usr/local/icinga-mysql/var/rw/live
|
||||||
|
|
||||||
|
[internal_ldap]
|
||||||
|
type = ldap
|
||||||
|
hostname = localhost
|
||||||
|
port = 389
|
||||||
|
root_dn = "ou=people, dc=icinga, dc=org"
|
||||||
|
bind_dn = "cn=admin,cn=config"
|
||||||
|
bind_pw = admin
|
|
@ -617,3 +617,23 @@ file { '/etc/httpd/conf.d/icingaweb.conf':
|
||||||
require => Package['apache'],
|
require => Package['apache'],
|
||||||
notify => Service['apache']
|
notify => Service['apache']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file { '/etc/icingaweb':
|
||||||
|
ensure => 'directory',
|
||||||
|
owner => 'apache',
|
||||||
|
group => 'apache'
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/etc/icingaweb/authentication.ini':
|
||||||
|
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/authentication.ini',
|
||||||
|
owner => 'apache',
|
||||||
|
group => 'apache',
|
||||||
|
require => File['/etc/icingaweb']
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/etc/icingaweb/resources.ini':
|
||||||
|
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/resources.ini',
|
||||||
|
owner => 'apache',
|
||||||
|
group => 'apache',
|
||||||
|
require => File['/etc/icingaweb']
|
||||||
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ use Icinga\Data\ResourceFactory;
|
||||||
use Icinga\Application\Logger;
|
use Icinga\Application\Logger;
|
||||||
use Icinga\Exception\ConfigurationError;
|
use Icinga\Exception\ConfigurationError;
|
||||||
use Icinga\Exception\NotReadableError;
|
use Icinga\Exception\NotReadableError;
|
||||||
|
use Icinga\Exception\ProgrammingError;
|
||||||
use Icinga\Application\Config as IcingaConfig;
|
use Icinga\Application\Config as IcingaConfig;
|
||||||
use Icinga\Authentication\Backend\DbUserBackend;
|
use Icinga\Authentication\Backend\DbUserBackend;
|
||||||
use Icinga\Authentication\Backend\LdapUserBackend;
|
use Icinga\Authentication\Backend\LdapUserBackend;
|
||||||
|
@ -149,7 +150,21 @@ class Manager
|
||||||
}
|
}
|
||||||
return new $backendConfig->class($backendConfig);
|
return new $backendConfig->class($backendConfig);
|
||||||
}
|
}
|
||||||
if (($type = ResourceFactory::getResourceConfig($backendConfig->resource)->type) === null) {
|
if ($backendConfig->resource === null) {
|
||||||
|
throw new ConfigurationError(
|
||||||
|
'Authentication configuration for backend "' . $backendConfig->name
|
||||||
|
. '" is missing the resource directive'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$type = ResourceFactory::getResourceConfig($backendConfig->resource)->type;
|
||||||
|
} catch (ProgrammingError $e) {
|
||||||
|
throw new ConfigurationError(
|
||||||
|
'No authentication methods available. It seems that none resources have been set up. '
|
||||||
|
. ' Please contact your Icinga Web administrator'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if ($type === null) {
|
||||||
throw new ConfigurationError(
|
throw new ConfigurationError(
|
||||||
'Authentication configuration for backend "%s" is missing the type directive',
|
'Authentication configuration for backend "%s" is missing the type directive',
|
||||||
$backendConfig->name,
|
$backendConfig->name,
|
||||||
|
|
|
@ -53,7 +53,7 @@ class ResourceFactory implements ConfigAwareFactory
|
||||||
/**
|
/**
|
||||||
* Get the configuration for a specific resource
|
* Get the configuration for a specific resource
|
||||||
*
|
*
|
||||||
* @param $resourceName String The resources name
|
* @param $resourceName String The resource's name
|
||||||
*
|
*
|
||||||
* @return Zend_Config The configuration of the resource
|
* @return Zend_Config The configuration of the resource
|
||||||
* @throws \Icinga\Exception\ConfigurationError
|
* @throws \Icinga\Exception\ConfigurationError
|
||||||
|
@ -62,7 +62,9 @@ class ResourceFactory implements ConfigAwareFactory
|
||||||
{
|
{
|
||||||
self::assertResourcesExist();
|
self::assertResourcesExist();
|
||||||
if (($resourceConfig = self::$resources->get($resourceName)) === null) {
|
if (($resourceConfig = self::$resources->get($resourceName)) === null) {
|
||||||
throw new ConfigurationError('Resource "' . $resourceName . '" couldn\'t be retrieved');
|
throw new ConfigurationError(
|
||||||
|
'Cannot load resource config "' . $resourceName . '". Resource does not exist'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return $resourceConfig;
|
return $resourceConfig;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue