diff --git a/doc/en/administration_guide/poller/enable_remote.rst b/doc/en/administration_guide/poller/enable_remote.rst index 0f44a0e1a05..a9785c51d88 100644 --- a/doc/en/administration_guide/poller/enable_remote.rst +++ b/doc/en/administration_guide/poller/enable_remote.rst @@ -4,11 +4,31 @@ Enabling the Remote Server option Connect to your **Remoter Server** and execute following command:: - # /usr/share/centreon/bin/centreon -u admin -p centreon -a enableRemote -o CentreonRemoteServer -v @IP_CENTREON_CENTRAL + # /usr/share/centreon/bin/centreon -u admin -p centreon -a enableRemote -o CentreonRemoteServer -v '@IP_CENTREON_CENTRAL;;;;;' + +Replace **@IP_CENTREON_CENTRAL** by the IP of the Centreon server seen by the +poller. You can define multiple IP address using a coma as separator. .. note:: - Replace **@IP_CENTREON_CENTRAL** by the IP of the Centreon server seen by the poller. - You can define multiple IP address using a coma as separator. + * To use HTTPS, replace **@IP_CENTREON_CENTRAL** by + **https://@IP_CENTREON_CENTRAL**. + * To use non default port, replace **@IP_CENTREON_CENTRAL** by + **@IP_CENTREON_CENTRAL:**. + +For the **** option you can put **1** to do not +check the SS CA on the Centreon Central Server if HTTPS is enabled, or put **0**. + +The **** is to define how the Centreon Central server can contact +the Remote server: HTTP or HTTPS. + +The **** is to define on wich TCP port the entreon Central server can +contact the Remote server. + +For the **** option you can put **1** to do not +check the SS CA on the Remote server if HTTPS is enabled, or put **0**. + +For the **** option you can put **1** to do not +use HTTP(S) proxy to contact the Centreon Central server. This command will enable **Remote Server** mode:: diff --git a/doc/en/administration_guide/poller/install_remote_server_iso.rst b/doc/en/administration_guide/poller/install_remote_server_iso.rst index 82a9f17679e..1d6e7c2ff95 100644 --- a/doc/en/administration_guide/poller/install_remote_server_iso.rst +++ b/doc/en/administration_guide/poller/install_remote_server_iso.rst @@ -2,6 +2,10 @@ Using Centreon el7 ISO ====================== +.. note:: + During this procedure it is recommended to select **Central with database** + option. + .. include:: ../../installation/common/install_iso.rst .. include:: ../../installation/common/web_install.rst diff --git a/doc/en/administration_guide/poller/wizard_add_remote.rst b/doc/en/administration_guide/poller/wizard_add_remote.rst index 307e709d789..9c813b4871c 100644 --- a/doc/en/administration_guide/poller/wizard_add_remote.rst +++ b/doc/en/administration_guide/poller/wizard_add_remote.rst @@ -16,21 +16,32 @@ Select **Add a Centreon Remote Server** and click on **Next**: .. image:: /images/poller/wizard_add_remote_1.png :align: center -If you define a new server, select the **Manual input** option and fill in the form: +If you enabled the **Remote Server** option when installing your server, +select the option **Select a Remote Server**, then select your server and fill in +the form: .. image:: /images/poller/wizard_add_remote_2a.png :align: center -If you enabled the **Remote Server** option when installing your server, -select the option **Select a Remote Server**, then select your server and fill in -the form: +Otherwise, select the **Manual input** option and fill in the form: .. image:: /images/poller/wizard_add_remote_2b.png :align: center -.. note:: - The **Database username** and **Database password** are the credentials defined - during the installation of the Remote Server. +The **Database username** and **Database password** are the credentials defined +during the installation of the Remote Server. + +The **Server IP address** field is of the following form: +[(http|https)://]@IP[:(port)]. If your Remote Server is only available on HTTPS, it +is mandatory to define the HTTP method and the TCP port is this one is not the +default one. + +The **Do not check SSL certificate validation** option allows to connect +to the Remote Server using self-signed SSL certificate. + +The **Do not use configured proxy tp connect to this server** allows to +connect to the Remote Server without using the proxy configuration of the +Centreon Central server. Click on **Next**. @@ -44,6 +55,12 @@ The wizard will configure your new server: .. image:: /images/poller/wizard_add_remote_4.png :align: center + +Once the configuration is exported, restart the Centreon Broker process on the +Remote Server using the following command: :: + + # systemctl restart cbd + The Remote Server is now configured: .. image:: /images/poller/wizard_add_remote_5.png diff --git a/doc/en/images/poller/wizard_add_remote_2a.png b/doc/en/images/poller/wizard_add_remote_2a.png index 5a7d7634d2d..e9fe67dffea 100644 Binary files a/doc/en/images/poller/wizard_add_remote_2a.png and b/doc/en/images/poller/wizard_add_remote_2a.png differ diff --git a/doc/en/images/poller/wizard_add_remote_2b.png b/doc/en/images/poller/wizard_add_remote_2b.png index 011a8235533..dde8ece7f4b 100644 Binary files a/doc/en/images/poller/wizard_add_remote_2b.png and b/doc/en/images/poller/wizard_add_remote_2b.png differ diff --git a/doc/en/installation/architecture/network.rst b/doc/en/installation/architecture/network.rst index bf021e17794..f728f941b27 100644 --- a/doc/en/installation/architecture/network.rst +++ b/doc/en/installation/architecture/network.rst @@ -46,21 +46,27 @@ Tables of network flows to integrate monitoring platform to IT Tables of monitoring flows ************************** -+-------------------+----------------------------------+------------+-----------+----------------------------------+ -| From | To | Protocol | Port | Application | -+===================+==================================+============+===========+==================================+ -| Central server | Poller | SSH | TCP 22 | Export of Centreon configuration | -+-------------------+----------------------------------+------------+-----------+----------------------------------+ -| Poller | Central server | BBDO | TCP 5669 | Transfer of collected data | -+-------------------+----------------------------------+------------+-----------+----------------------------------+ -| Poller | Network equipment, servers, etc. | SNMP | UDP 161 | Monitoring | -+-------------------+----------------------------------+------------+-----------+----------------------------------+ -| Network equipment | Poller | Trap SNMP | UDP 162 | Monitoring | -+-------------------+----------------------------------+------------+-----------+----------------------------------+ -| Poller | Servers | NRPE | TCP 5666 | Monitoring | -+-------------------+----------------------------------+------------+-----------+----------------------------------+ -| Poller | Servers | NSClient++ | TCP 12489 | Monitoring | -+-------------------+----------------------------------+------------+-----------+----------------------------------+ ++-------------------+----------------------------------+------------+--------------+-------------------------------------------+ +| From | To | Protocol | Port | Application | ++===================+==================================+============+==============+===========================================+ +| Central server | Poller | SSH | TCP 22 | Export of Centreon configuration | ++-------------------+----------------------------------+------------+--------------+-------------------------------------------+ +| Central server | Remote Server | HTTP(S) | TCP 80 (443) | Export of Remote Server configuration | ++-------------------+----------------------------------+------------+--------------+-------------------------------------------+ +| Poller | Central server | BBDO | TCP 5669 | Transfer of collected data | ++-------------------+----------------------------------+------------+--------------+-------------------------------------------+ +| Poller | Network equipment, servers, etc. | SNMP | UDP 161 | Monitoring | ++-------------------+----------------------------------+------------+--------------+-------------------------------------------+ +| Network equipment | Poller | Trap SNMP | UDP 162 | Monitoring | ++-------------------+----------------------------------+------------+--------------+-------------------------------------------+ +| Poller | Servers | NRPE | TCP 5666 | Monitoring | ++-------------------+----------------------------------+------------+--------------+-------------------------------------------+ +| Poller | Servers | NSClient++ | TCP 12489 | Monitoring | ++-------------------+----------------------------------+------------+--------------+-------------------------------------------+ +| Central server | Remote Server | HTTP(S) | TCP 80 (443) | Export of Centreon configuration | ++-------------------+----------------------------------+------------+--------------+-------------------------------------------+ +| Remote Server | Central server | HTTP(S) | TCP 80 (443) | Activation of Remote Server functionality | ++-------------------+----------------------------------+------------+--------------+-------------------------------------------+ .. note:: If the Centreon server is a poller too, do not forget to open monitoring flows. diff --git a/doc/fr/administration_guide/poller/enable_remote.rst b/doc/fr/administration_guide/poller/enable_remote.rst index 7e87f0db1ee..04acc60d448 100644 --- a/doc/fr/administration_guide/poller/enable_remote.rst +++ b/doc/fr/administration_guide/poller/enable_remote.rst @@ -5,11 +5,32 @@ Activer l'option Remote Server Connectez-vous à votre serveur ayant la fonction **Remote Server** et exécutez la commande suivante :: - # /usr/share/centreon/bin/centreon -u admin -p centreon -a enableRemote -o CentreonRemoteServer -v @IP_CENTREON_CENTRAL + # /usr/share/centreon/bin/centreon -u admin -p centreon -a enableRemote -o CentreonRemoteServer -v '@IP_CENTREON_CENTRAL;;;;;' .. note:: Remplacez **@IP_CENTREON_CENTRAL** par l'IP du serveur Centreon vu par le collecteur. - Vous pouvez définir plusieurs adresse IP en utilisant la virgule comme séparateur. + Vous pouvez définir plusieurs adresses IP en utilisant la virgule comme séparateur. + +.. note:: + * Pour utiliser HTTPS, remplacez **@IP_CENTREON_CENTRAL** par + **https://@IP_CENTREON_CENTRAL**. + * Pour utilsier un autre port TCP, remplacez **@IP_CENTREON_CENTRAL** par + **@IP_CENTREON_CENTRAL:**. + +Pour ne pas contrôler le certificat SSL sur le serveur Centreon Central, +mettre à **1** l'option ****, sinon **0**. + +L'option **** permet de définir la méthode de connexion pour +contacter le Remote Server : HTTP ou HTTPS. + +L'option **** permet de définir sur quel port TCP communiquer avec le +Remote Server. + +Pour ne pas contrôler le certificat SSL sur le Remote server, mettre à **1** +l'option ****, sinon **0**. + +Pour ne pas utiliser le proxy pour contacter le serveur Centreon Central, +mettre à **1** l'option ****, sinon **0**. Cette commande va activer le mode **Remote Server** :: diff --git a/doc/fr/administration_guide/poller/install_remote_server_iso.rst b/doc/fr/administration_guide/poller/install_remote_server_iso.rst index 96a6b5686b9..02d904b5020 100644 --- a/doc/fr/administration_guide/poller/install_remote_server_iso.rst +++ b/doc/fr/administration_guide/poller/install_remote_server_iso.rst @@ -2,6 +2,10 @@ A partir de l'ISO Centreon el7 ============================== +.. note:: + Lors de cette procédure, il est préférable de sélectionner l'option : + **Central with database**. + .. include:: ../../installation/common/install_iso.rst .. include:: ../../installation/common/web_install.rst diff --git a/doc/fr/administration_guide/poller/wizard_add_remote.rst b/doc/fr/administration_guide/poller/wizard_add_remote.rst index 0a3b057d023..f8b3229346a 100644 --- a/doc/fr/administration_guide/poller/wizard_add_remote.rst +++ b/doc/fr/administration_guide/poller/wizard_add_remote.rst @@ -17,22 +17,32 @@ Sélectionnez **Add a Centreon Remote Server** et cliquez sur **Next** : .. image:: /images/poller/wizard_add_remote_1.png :align: center -Si vous souhaitez ajouter un nouveau serveur, sélectionnez l'option **Manual input** -et saisissez les informations demandées. +Si vous avez activé votre serveur en suivant la documentation, sélectionnez +l'option **Select a Remote Server**. Dans la liste déroulante sélectionnez +votre serveur, puis saisissez les informations demandées : .. image:: /images/poller/wizard_add_remote_2a.png :align: center -Si vous avez déjà activé l'option **Remote Server** durant l'installation de -votre serveur, sélectionnez l'option **Select a Remote Server** et sélectionnez -votre serveur dans la liste puis complétez les informations demandées. +Sinon, sélectionnez l'option **Create new Remote Server** +et saisissez les informations demandées. .. image:: /images/poller/wizard_add_remote_2b.png :align: center -.. note:: - Les champs **Database user** et **Database password** sont les accès aux bases - de données Centreon définis durant l'installation de votre Remote Server. +Les champs **Database user** et **Database password** sont les accès aux bases +de données Centreon définis durant l'installation de votre Remote Server. + +Le champ **Server IP address** est de la forme : [(http|https)://]@IP[:(port)]. +Si votre Remote Server est accessible en HTTPS, il est nécessaire de préciser +la méthode d'accès et le port si celui-ci n'est pas par défaut. + +L'option **Do not check SSL certificate validation** permet de contacter le +Remote Server si celui-ci possède un certificat SSL auto-signé. + +L'option **Do not use configured proxy tp connect to this server** permet +de de contacter le Remote Server en n'utilisant pas la configuration +du proxy configurée sur le serveur Centreon Central. Cliquez sur **Next** : @@ -47,6 +57,11 @@ L'assistant va configurer votre nouveau serveur : .. image:: /images/poller/wizard_add_remote_4.png :align: center +Une fois la configuration exportée, redémarrez le processus Centreon Broker +sur le Remote Server via la commande suivante : :: + + # systemctl restart cbd + Le Remote Server est maintenant configuré : .. image:: /images/poller/wizard_add_remote_5.png diff --git a/doc/fr/images/poller/wizard_add_remote_2a.png b/doc/fr/images/poller/wizard_add_remote_2a.png index 5a7d7634d2d..e9fe67dffea 100644 Binary files a/doc/fr/images/poller/wizard_add_remote_2a.png and b/doc/fr/images/poller/wizard_add_remote_2a.png differ diff --git a/doc/fr/images/poller/wizard_add_remote_2b.png b/doc/fr/images/poller/wizard_add_remote_2b.png index 011a8235533..dde8ece7f4b 100644 Binary files a/doc/fr/images/poller/wizard_add_remote_2b.png and b/doc/fr/images/poller/wizard_add_remote_2b.png differ diff --git a/doc/fr/installation/architecture/network.rst b/doc/fr/installation/architecture/network.rst index 9ecd2f8cb6b..9d1cf0b0f04 100644 --- a/doc/fr/installation/architecture/network.rst +++ b/doc/fr/installation/architecture/network.rst @@ -46,21 +46,25 @@ Tableaux des flux d'intégration de la plate-forme de supervision dans le SI Tableau des flux de la supervision ********************************** -+--------------------+------------------------------------+------------+-----------+-------------------------------------------------+ -| Depuis | Vers | Protocole | Port | Application | -+====================+====================================+============+===========+=================================================+ -| Central serveur | Collecteur | SSH | TCP 22 | Export des configurations Centreon | -+--------------------+------------------------------------+------------+-----------+-------------------------------------------------+ -| Collecteur | Central serveur | BBDO | TCP 5669 | Transfert des données de supervision collectées | -+--------------------+------------------------------------+------------+-----------+-------------------------------------------------+ -| Collecteur | Equipements réseau, serveurs, etc. | SNMP | UDP 161 | Supervision | -+--------------------+------------------------------------+------------+-----------+-------------------------------------------------+ -| Equipements réseau | Collecteur | Trap SNMP | UDP 162 | Supervision | -+--------------------+------------------------------------+------------+-----------+-------------------------------------------------+ -| Collecteur | Servers | NRPE | TCP 5666 | Supervision | -+--------------------+------------------------------------+------------+-----------+-------------------------------------------------+ -| Collecteur | Servers | NSClient++ | TCP 12489 | Supervision | -+--------------------+------------------------------------+------------+-----------+-------------------------------------------------+ ++--------------------+------------------------------------+------------+---------------+-------------------------------------------------+ +| Depuis | Vers | Protocole | Port | Application | ++====================+====================================+============+===============+=================================================+ +| Central serveur | Collecteur | SSH | TCP 22 | Export des configurations Centreon | ++--------------------+------------------------------------+------------+---------------+-------------------------------------------------+ +| Central serveur | Remote Server | HTTP(S) | TCP 80 (443) | Export des configurations Remote Server | ++--------------------+------------------------------------+------------+---------------+-------------------------------------------------+ +| Collecteur | Central serveur | BBDO | TCP 5669 | Transfert des données de supervision collectées | ++--------------------+------------------------------------+------------+---------------+-------------------------------------------------+ +| Collecteur | Equipements réseau, serveurs, etc. | SNMP | UDP 161 | Supervision | ++--------------------+------------------------------------+------------+---------------+-------------------------------------------------+ +| Equipements réseau | Collecteur | Trap SNMP | UDP 162 | Supervision | ++--------------------+------------------------------------+------------+---------------+-------------------------------------------------+ +| Collecteur | Servers | NRPE | TCP 5666 | Supervision | ++--------------------+------------------------------------+------------+---------------+-------------------------------------------------+ +| Collecteur | Servers | NSClient++ | TCP 12489 | Supervision | ++--------------------+------------------------------------+------------+---------------+-------------------------------------------------+ +| Remote Server | Central serveur | HTTP(S) | TCP 80 (443) | Activation de la fonctionnalité Remote Server | ++--------------------+------------------------------------+------------+---------------+-------------------------------------------------+ .. note:: Dans le cas où le serveur central Centreon fait office de collecteur, diff --git a/doc/fr/installation/common/install_packages.rst b/doc/fr/installation/common/install_packages.rst index dcf3063e836..d59592ed80b 100644 --- a/doc/fr/installation/common/install_packages.rst +++ b/doc/fr/installation/common/install_packages.rst @@ -122,7 +122,7 @@ fonctionnera PAS: :: Fuseau horaire PHP ------------------ -La timezone par défaut de PHP doit être configurée. Executer la commande suivante : :: +La timezone par défaut de PHP doit être configurée. Exécuter la commande suivante : :: # echo "date.timezone = Europe/Paris" > /etc/opt/rh/rh-php71/php.d/php-timezone.ini diff --git a/doc/fr/installation/common/post_install.rst b/doc/fr/installation/common/post_install.rst index df9c00c7924..613f2d399fd 100644 --- a/doc/fr/installation/common/post_install.rst +++ b/doc/fr/installation/common/post_install.rst @@ -66,7 +66,7 @@ plupart des services de votre réseau. Centreon IMP nécessite les composants techniques Centreon License Manager et Centreon Plugin Pack Manager pour fonctionner. -Si vous n'avez pas installé les modules durant l'instalaltion de Centreon, +Si vous n'avez pas installé les modules durant l'installation de Centreon, Rendez-vous au menu **Administration > Extensions > Modules**. Clicquez sur le bouton **Install/Upgrade all** et validez l'action : diff --git a/lang/es_ES.UTF-8/LC_MESSAGES/help.po b/lang/es_ES.UTF-8/LC_MESSAGES/help.po index 7546567e8f6..2eb1f7deee6 100644 --- a/lang/es_ES.UTF-8/LC_MESSAGES/help.po +++ b/lang/es_ES.UTF-8/LC_MESSAGES/help.po @@ -4296,3 +4296,20 @@ msgstr "Método de recarga de la configuración: reiniciar, recargar o comando e #: centreon-web/www/include/configuration/configGenerate/help.php:8 msgid "Run the commands that are defined in the poller configuration page (Configuration > Centreon > Poller > Post-Restart command)." msgstr "Ejecuta el comando definido en la configuración del recopilador (Configuración> Centreon> Poller> Comando posterior al reinicio)." + +msgid "" +"What kind of method is needed to reach the Remote Server, HTTP or HTTPS?" +msgstr "" + +msgid "On which TCP port is listening the Remote Server?" +msgstr "" + +msgid "" +"If checked, it won't check the validity of the SSL certificate of the Remote Server." +msgstr "" +"" + +msgid "If checked, it won't use the proxy configured in " +"'Administration > Parameters > Centreon UI' to connect to the Remote Server." +msgstr "" +"" diff --git a/lang/fr_FR.UTF-8/LC_MESSAGES/help.po b/lang/fr_FR.UTF-8/LC_MESSAGES/help.po index 43cc5f6afae..ea156755a78 100644 --- a/lang/fr_FR.UTF-8/LC_MESSAGES/help.po +++ b/lang/fr_FR.UTF-8/LC_MESSAGES/help.po @@ -6463,6 +6463,26 @@ msgstr "" "Exécute la commande définie dans la configuration du collecteur (Configuration " "> Centreon > Poller > Post-Restart command)." +msgid "" +"What kind of method is needed to reach the Remote Server, HTTP or HTTPS?" +msgstr "" +"Quel type de méthode est nécessaire pour contacter le Remote Server, HTTP ou HTTPS ?" + +msgid "On which TCP port is listening the Remote Server?" +msgstr "" +"Sur quel port TCP écoute le Remote Server ?" + +msgid "" +"If checked, it won't check the validity of the SSL certificate of the Remote Server." +msgstr "" +"Si cette case est cochée, la validité du certificat SSL du Remote Server ne sera pas vérifiée." + +msgid "If checked, it won't use the proxy configured in " +"'Administration > Parameters > Centreon UI' to connect to the Remote Server." +msgstr "" +"Si cette case est cochée, le paramétrage du proxy dans le menu " +"Administration > Parameters > Centreon UI' ne sera pas utilisée pour se connecter au Remote Server" + #~ msgid "SNMP global community." #~ msgstr "Communauté SNMP globale utilisée par défaut." diff --git a/lang/pt_BR.UTF-8/LC_MESSAGES/help.po b/lang/pt_BR.UTF-8/LC_MESSAGES/help.po index d357480ac92..f2563d93141 100644 --- a/lang/pt_BR.UTF-8/LC_MESSAGES/help.po +++ b/lang/pt_BR.UTF-8/LC_MESSAGES/help.po @@ -5905,6 +5905,22 @@ msgstr "" "Essa opção torna o mecanismo do Mecanismo Centreon compatível com módulos de" " terceiros, como MKLiveStatus e Mod_Gearman." +msgid "" +"What kind of method is needed to reach the Remote Server, HTTP or HTTPS?" +msgstr "" + +msgid "" +"On which TCP port is listening the Remote Server?" +msgstr "" + +msgid "" +"If checked, it won't check the validity of the SSL certificate of the Remote Server." +msgstr "" + +msgid "If checked, it won't use the proxy configured in " +"'Administration > Parameters > Centreon UI' to connect to the Remote Server." +msgstr "" + #~ msgid "Enable caching" #~ msgstr "Ativa Cache" diff --git a/lang/pt_PT.UTF-8/LC_MESSAGES/help.po b/lang/pt_PT.UTF-8/LC_MESSAGES/help.po index 6e089437a5f..af8d990fe79 100644 --- a/lang/pt_PT.UTF-8/LC_MESSAGES/help.po +++ b/lang/pt_PT.UTF-8/LC_MESSAGES/help.po @@ -4292,6 +4292,22 @@ msgstr "Método de atualização de configuração: Reiniciar, Recarregar ou Com msgid "Run the commands that are defined in the poller configuration page (Configuration > Centreon > Poller > Post-Restart command)." msgstr "Executa o comando definido na configuração do coletor (Configuração> Centreon> Poller> comando Post-Restart)." +msgid "" +"What kind of method is needed to reach the Remote Server, HTTP or HTTPS?" +msgstr "" + +msgid "" +"On which TCP port is listening the Remote Server?" +msgstr "" + +msgid "" +"If checked, it won't check the validity of the SSL certificate of the Remote Server." +msgstr "" + +msgid "If checked, it won't use the proxy configured in " +"'Administration > Parameters > Centreon UI' to connect to the Remote Server." +msgstr "" + #~ msgid "SNMP global community." #~ msgstr "Comunidade SNMP global usada por padrão." diff --git a/src/CentreonRemote/Application/Clapi/CentreonRemoteServer.php b/src/CentreonRemote/Application/Clapi/CentreonRemoteServer.php index 3e4528a88ff..14fe456b73a 100644 --- a/src/CentreonRemote/Application/Clapi/CentreonRemoteServer.php +++ b/src/CentreonRemote/Application/Clapi/CentreonRemoteServer.php @@ -38,20 +38,54 @@ public static function getName() : string */ public function enableRemote(string $string_ip) { + /* Set default value */ + $noCheckCertificate = false; + $data = array( + 'remoteHttpMethod' => 'http', + 'remoteHttpPort' => null, + 'remoteNoCheckCertificate' => false, + ); + + /* Check CLAPI */ + $options = explode (';', $string_ip); + + if (count($options) === 6) { + $string_ip = $options[0]; + $noCheckCertificate = $options[1]; + $data['remoteHttpMethod'] = $options[2]; + $data['remoteHttpPort'] = $options[3]; + $data['remoteNoCheckCertificate'] = $options[4]; + $noProxy = $options[5]; + } elseif (count($options) > 1) { + echo "6 arguments are needed, please check your arguments."; + return 1; + } + + /* Extract host from URI */ + $aIPMaster = array(); + $pattern_extract_host = '/^[a-z][a-z0-9+\-.]*:\/\/([a-z0-9\-._~%!$&\'()*+,;=]+@)?([a-z0-9\-._~%]+|\[[a-z0-9\-._~%!$&\'()*+,;=:]+\])/'; $ipList = explode(',', $string_ip); + foreach ($ipList as $ip) { + if (preg_match($pattern_extract_host, $ip, $matches)) { + $ip = $matches[2]; + } + $aIPMaster[] = $ip; + } echo "Starting Centreon Remote enable process: \n"; echo "Limiting Menu Access..."; $result = $this->getDi()['centreon.db-manager']->getRepository(TopologyRepository::class)->disableMenus(); - echo ($result) ? 'Success' . "\n" : 'Fail' . "\n"; + echo (($result) ? 'Success' : 'Fail') . "\n"; echo "Limiting Actions..."; $this->getDi()['centreon.db-manager']->getRepository(InformationsRepository::class)->toggleRemote('yes'); echo "Done\n"; echo "Authorizing Master..."; - $this->getDi()['centreon.db-manager']->getRepository(InformationsRepository::class)->authorizeMaster($string_ip); + $this->getDi()['centreon.db-manager']->getRepository(InformationsRepository::class)->authorizeMaster( + implode(',',$aIPMaster) + ); echo "Done\n"; echo "Set 'remote' instance type..."; @@ -63,10 +97,15 @@ public function enableRemote(string $string_ip) echo "Notifying Master..."; $result = ""; foreach ($ipList as $ip) { - $result = $this->getDi()['centreon.notifymaster']->pingMaster($ip); + $result = $this->getDi()['centreon.notifymaster']->pingMaster( + $ip, + $data, + $noCheckCertificate, + $noProxy + ); if (!empty($result['status']) && $result['status'] == 'success') { echo "Success\n"; - continue; + break; } } if (empty($result['status']) || $result['status'] != 'success') { diff --git a/src/CentreonRemote/Application/Clapi/CentreonWorker.php b/src/CentreonRemote/Application/Clapi/CentreonWorker.php index a58273e80f1..476c707a270 100644 --- a/src/CentreonRemote/Application/Clapi/CentreonWorker.php +++ b/src/CentreonRemote/Application/Clapi/CentreonWorker.php @@ -144,15 +144,21 @@ public function createRemoteTask(int $taskId): void $params = unserialize($task->getParams())['params']; $centreonPath = trim($params['centreon_path'], '/'); $centreonPath = $centreonPath ? $centreonPath : '/centreon'; - $url = "{$params['remote_ip']}/{$centreonPath}/api/external.php?" - . "object=centreon_task_service&action=AddImportTaskWithParent"; + $url = $params['http_method'] ? $params['http_method'] . "://" : ""; + $url .= $params['remote_ip']; + $url .= $params['http_port'] ? ":" . $params['http_port'] : ""; + $url .= "/{$centreonPath}/api/external.php?object=centreon_task_service&action=AddImportTaskWithParent"; try { $curl = new \CentreonRestHttp; $res = $curl->call( $url, 'POST', - ['parent_id' => $task->getId()] + ['parent_id' => $task->getId()], + null, + false, + $params['no_check_certificate'], + $params['no_proxy'] ); } catch (\Exception $e) { diff --git a/src/CentreonRemote/Application/Webservice/CentreonConfigurationRemote.php b/src/CentreonRemote/Application/Webservice/CentreonConfigurationRemote.php index 19ff52a0e14..4394b352418 100755 --- a/src/CentreonRemote/Application/Webservice/CentreonConfigurationRemote.php +++ b/src/CentreonRemote/Application/Webservice/CentreonConfigurationRemote.php @@ -218,6 +218,9 @@ public function postLinkCentreonRemoteServer(): array $openBrokerFlow = isset($this->arguments['open_broker_flow']) && $this->arguments['open_broker_flow'] === true; $centreonPath = $this->arguments['centreon_folder'] ?? '/centreon/'; + $noCheckCertificate = isset($this->arguments['no_check_certificate']) + && $this->arguments['no_check_certificate'] === true; + $noProxy = isset($this->arguments['no_proxy']) && $this->arguments['no_proxy'] === true; $serverWizardIdentity = new ServerWizardIdentity; $isRemoteConnection = $serverWizardIdentity->requestConfigurationIsRemote(); $configurationServiceName = $isRemoteConnection ? @@ -234,16 +237,32 @@ public function postLinkCentreonRemoteServer(): array /** @var $pollerConfigurationBridge PollerConfigurationRequestBridge */ $pollerConfigurationBridge = $this->getDi()['centreon_remote.poller_config_bridge']; - $serverIP = $this->arguments['server_ip']; + // extract HTTP method and port from form or database if registered + $httpMethod = ""; + $httpPort = ""; + $serverIP = parse_url($this->arguments['server_ip'], PHP_URL_HOST) ?: $this->arguments['server_ip']; $serverName = substr($this->arguments['server_name'], 0, 40); + $dbAdapter = $this->getDi()['centreon.db-manager']->getAdapter('configuration_db'); + $sql = 'SELECT * FROM `remote_servers` WHERE `ip` = ?'; + $dbAdapter->query($sql, [$serverIP]); + $hasIpInTable = (bool) $dbAdapter->count(); + + if (!$hasIpInTable) { + $httpMethod = parse_url($this->arguments['server_ip'], PHP_URL_SCHEME) ?: 'http'; + $httpPort = parse_url($this->arguments['server_ip'], PHP_URL_PORT) ?: ''; + } else { + $result = $dbAdapter->results(); + $remoteData = reset($result); + $httpMethod = $remoteData->http_method; + $httpPort = $remoteData->http_port; + } + $serverConfigurationService->setCentralIp($this->arguments['centreon_central_ip']); $serverConfigurationService->setServerIp($serverIP); $serverConfigurationService->setName($serverName); $serverConfigurationService->setOnePeerRetention($openBrokerFlow); - $pollerConfigurationService->setOnePeerRetention($openBrokerFlow); - // set linked pollers $pollerConfigurationBridge->collectDataFromRequest(); @@ -279,6 +298,10 @@ public function postLinkCentreonRemoteServer(): array 'server' => $remoteServer->getId(), 'remote_ip' => $remoteServer->getIp(), 'centreon_path' => $centreonPath, + 'http_method' => $httpMethod, + 'http_port' => $httpPort, + 'no_check_certificate' => $noCheckCertificate, + 'no_proxy' => $noProxy, 'pollers' => [] ]; @@ -296,7 +319,14 @@ public function postLinkCentreonRemoteServer(): array $taskId = $this->createExportTask($params); // add server to the list of remote servers in database (table remote_servers) - $this->addServerToListOfRemotes($serverIP, $centreonPath); + $this->addServerToListOfRemotes( + $serverIP, + $centreonPath, + $httpMethod, + $httpPort, + $noCheckCertificate, + $noProxy + ); $this->setCentreonInstanceAsCentral(); // if it is poller wizard and poller is linked to another poller/remote server (instead of central) @@ -330,10 +360,21 @@ public function authorize($action, $user, $isInternal = false) /** * Add server ip in table of remote servers * - * @param $serverIP + * @param string $serverIP the IP of the server + * @param string $centreonPath the path to access to Centreon + * @param string $httpMethod the method to access to server (HTTP/HTTPS) + * @param string $httpPort the port to access to the server + * @param boolean $noCheckCertificate to do not check SSL CA + * @param boolean $noProxy to do not use configured proxy */ - private function addServerToListOfRemotes($serverIP, $centreonPath) - { + private function addServerToListOfRemotes( + $serverIP, + $centreonPath, + $httpMethod, + $httpPort, + $noCheckCertificate, + $noProxy + ) { $dbAdapter = $this->getDi()['centreon.db-manager']->getAdapter('configuration_db'); $date = date('Y-m-d H:i:s'); @@ -342,19 +383,24 @@ private function addServerToListOfRemotes($serverIP, $centreonPath) $hasIpInTable = (bool) $dbAdapter->count(); if ($hasIpInTable) { - $sql = 'UPDATE `remote_servers` SET `is_connected` = ?, `connected_at` = ?, `centreon_path` = ? ' . + $sql = 'UPDATE `remote_servers` SET `is_connected` = ?, `connected_at` = ?, `centreon_path` = ?, ' . + '`no_check_certificate` = ?, `no_proxy` = ? ' . 'WHERE `ip` = ?'; - $data = ['1', $date, $centreonPath, $serverIP]; + $data = ['1', $date, $centreonPath, ($noCheckCertificate ?: 0), ($noProxy ?: 0), $serverIP]; $dbAdapter->query($sql, $data); } else { $data = [ - 'ip' => $serverIP, - 'app_key' => '', - 'version' => '', - 'is_connected' => '1', - 'created_at' => $date, - 'connected_at' => $date, - 'centreon_path' => $centreonPath, + 'ip' => $serverIP, + 'app_key' => '', + 'version' => '', + 'is_connected' => '1', + 'created_at' => $date, + 'connected_at' => $date, + 'centreon_path' => $centreonPath, + 'http_method' => $httpMethod, + 'http_port' => $httpPort ?: null, + 'no_check_certificate' => $noCheckCertificate ?: 0, + 'no_proxy' => $noProxy ?: 0 ]; $dbAdapter->insert('remote_servers', $data); } diff --git a/src/CentreonRemote/Application/Webservice/CentreonRemoteServer.php b/src/CentreonRemote/Application/Webservice/CentreonRemoteServer.php index b5e145929c6..8e894a19f39 100644 --- a/src/CentreonRemote/Application/Webservice/CentreonRemoteServer.php +++ b/src/CentreonRemote/Application/Webservice/CentreonRemoteServer.php @@ -85,14 +85,17 @@ public function postAddToWaitList(): string } $createdAt = date('Y-m-d H:i:s'); - $insertQuery = 'INSERT INTO `remote_servers` (`ip`, `app_key`, `version`, `is_connected`, `created_at`) '; - $insertQuery .= "VALUES (:ip, :app_key, :version, 0, '{$createdAt}')"; + $insertQuery = 'INSERT INTO `remote_servers` (`ip`, `app_key`, `version`, `is_connected`, `created_at`, `http_method`, `http_port`, `no_check_certificate`) '; + $insertQuery .= "VALUES (:ip, :app_key, :version, 0, '{$createdAt}', :http_method, :http_port, :no_check_certificate)"; $insert = $this->pearDB->prepare($insertQuery); $bindings = [ - ':ip' => $ip, - ':app_key' => $_POST['app_key'], - ':version' => $_POST['version'], + ':ip' => $ip, + ':app_key' => $_POST['app_key'], + ':version' => $_POST['version'], + ':http_method' => $_POST['http_method'] ?? 'http', + ':http_port' => $_POST['http_port'] ?? null, + ':no_check_certificate' => $_POST['no_check_certificate'] ?? 0, ]; try { diff --git a/src/CentreonRemote/Application/Webservice/CentreonTaskService.php b/src/CentreonRemote/Application/Webservice/CentreonTaskService.php index c9e05624301..7fb462a187b 100644 --- a/src/CentreonRemote/Application/Webservice/CentreonTaskService.php +++ b/src/CentreonRemote/Application/Webservice/CentreonTaskService.php @@ -119,14 +119,18 @@ public function postGetRemoteTaskStatusByParent(): array throw new \RestBadRequestException('Missing arguments'); } - $result = $this->getDi()['centreon.taskservice'] - ->getRemoteStatusByParent( - $this->arguments['parent_id'], - $this->arguments['server_ip'], - $this->arguments['centreon_folder'] - ); - - return ['success' => true, 'status' => $result]; + try { + $result = $this->getDi()['centreon.taskservice'] + ->getRemoteStatusByParent( + $this->arguments['parent_id'], + $this->arguments['server_ip'], + $this->arguments['centreon_folder'] + ); + + return ['success' => true, 'status' => $result]; + } catch (\Exception $e) { + return ['success' => false, 'status' => $e->getMessage()]; + } } /** diff --git a/src/CentreonRemote/Domain/Service/ConfigurationWizard/LinkedPollerConfigurationService.php b/src/CentreonRemote/Domain/Service/ConfigurationWizard/LinkedPollerConfigurationService.php index 8c5753c70c1..00cec1ab5cc 100644 --- a/src/CentreonRemote/Domain/Service/ConfigurationWizard/LinkedPollerConfigurationService.php +++ b/src/CentreonRemote/Domain/Service/ConfigurationWizard/LinkedPollerConfigurationService.php @@ -225,21 +225,25 @@ private function triggerExportForOldRemotes(array $pollerIDs): void $linkedResults = $linkedStatement->fetchAll(\PDO::FETCH_ASSOC); $linkedPollersOfRemote = array_column($linkedResults, 'id'); - // Get IP of remote - $queryRemoteData = "SELECT ns.ns_ip_address as ip, rs.centreon_path FROM nagios_server as ns " . - " JOIN remote_servers as rs ON rs.ip = ns.ns_ip_address " . - " WHERE ns.id = {$remoteID}"; - $remoteDataStatement = $this->db->query($queryRemoteData); + // Get information of remote + $remoteDataStatement = $this->db->query("SELECT ns.ns_ip_address as ip, rs.centreon_path, + rs.http_method, rs.http_port, rs.no_check_certificate, rs.no_proxy + FROM nagios_server as ns JOIN remote_servers as rs ON rs.ip = ns.ns_ip_address + WHERE ns.id = {$remoteID}"); $remoteDataResults = $remoteDataStatement->fetchAll(\PDO::FETCH_ASSOC); // Exclude the selected pollers which are going to another remote $pollerIDsToExport = array_diff($linkedPollersOfRemote, $pollerIDs); $exportParams = [ - 'server' => $remoteID, - 'pollers' => $pollerIDsToExport, - 'remote_ip' => $remoteDataResults[0]['ip'], + 'server' => $remoteID, + 'pollers' => $pollerIDsToExport, + 'remote_ip' => $remoteDataResults[0]['ip'], 'centreon_path' => $remoteDataResults[0]['centreon_path'], + 'http_method' => $remoteDataResults[0]['http_method'], + 'http_port' => $remoteDataResults[0]['http_port'], + 'no_check_certificate' => $remoteDataResults[0]['no_check_certificate'], + 'no_proxy' => $remoteDataResults[0]['no_proxy'], ]; $this->taskService->addTask(Task::TYPE_EXPORT, ['params' => $exportParams]); } diff --git a/src/CentreonRemote/Domain/Service/NotifyMasterService.php b/src/CentreonRemote/Domain/Service/NotifyMasterService.php index 9681ecec0b1..2ab12dc7275 100644 --- a/src/CentreonRemote/Domain/Service/NotifyMasterService.php +++ b/src/CentreonRemote/Domain/Service/NotifyMasterService.php @@ -62,11 +62,13 @@ public function __construct(CentreonDBManagerService $dbManager) /** * Ping the master IP requesting to be slave for it. - * @param string $ip + * @param string $ip The IP address of the master + * @param boolean $noCheckCertificate To do not check SLL CA on master + * @param array $data The information for the master how to contact the remote * @return array * @throws \ErrorException */ - public function pingMaster($ip) + public function pingMaster($ip, $data, $noCheckCertificate = false, $noProxy = false) { $url = "{$ip}/centreon/api/external.php?object=centreon_remote_server&action=addToWaitList"; @@ -85,8 +87,18 @@ public function pingMaster($ip) $curlData = [ 'app_key' => $applicationKey->getValue(), 'version' => $version->getValue(), + 'http_method' => $data['remoteHttpMethod'] ?? 'http', + 'http_port' => $data['remoteHttpPort'] ?? '', + 'no_check_certificate' => $data['remoteNoCheckCertificate'] ?? 0, ]; + if ($noCheckCertificate) { + $this->getCurl()->setOpt(CURLOPT_SSL_VERIFYPEER, false); + } + if ($noProxy) { + $this->getCurl()->setOpt(CURLOPT_PROXY, false); + } + $this->getCurl()->post($url, $curlData); if ($this->getCurl()->error) { @@ -119,4 +131,4 @@ public function pingMaster($ip) return ['status' => self::SUCCESS]; } -} \ No newline at end of file +} diff --git a/src/CentreonRemote/Domain/Service/TaskService.php b/src/CentreonRemote/Domain/Service/TaskService.php index 454361bdacf..1e3dd74ac67 100644 --- a/src/CentreonRemote/Domain/Service/TaskService.php +++ b/src/CentreonRemote/Domain/Service/TaskService.php @@ -141,14 +141,39 @@ public function getStatus(string $taskId) */ public function getRemoteStatusByParent(int $parentId, string $serverIp, string $centreonFolder) { - $result = $this->centreonRestHttp->call( - 'http://' . $serverIp . '/' . $centreonFolder - . '/api/external.php?object=centreon_task_service&action=getTaskStatusByParent', - 'POST', - ['parent_id' => $parentId] - ); - - return isset($result['status']) ? $result['status'] : null; + $query = "SELECT params FROM task WHERE id = '" . $parentId . "'"; + + try { + $remoteDataResult = $this->getDbManager()->getAdapter('configuration_db')->query($query)->results(); + $result = unserialize($remoteDataResult[0]->params); + + $httpMethod = $result['params']['http_method']; + $httpPort = $result['params']['http_port'];; + $noCheckCertificate = $result['params']['no_check_certificate']; + $noProxy = $result['params']['no_proxy']; + + $url = ""; + if (parse_url($serverIp, PHP_URL_SCHEME)) { + $url = $serverIp; + } else { + $url = ($httpMethod ?? 'http') . '://' . $serverIp . ($httpPort ? ':' . $httpPort : ''); + } + $url .= '/' . $centreonFolder . '/api/external.php?object=centreon_task_service&action=getTaskStatusByParent'; + + $result = $this->centreonRestHttp->call( + $url, + 'POST', + ['parent_id' => $parentId], + null, + false, + $noCheckCertificate, + $noProxy + ); + + return isset($result['status']) ? $result['status'] : null; + } catch (\Exception $e) { + return $e->getMessage(); + } } /** diff --git a/www/class/centreonRestHttp.class.php b/www/class/centreonRestHttp.class.php index 080b5b94445..d6e912621f4 100644 --- a/www/class/centreonRestHttp.class.php +++ b/www/class/centreonRestHttp.class.php @@ -81,9 +81,11 @@ private function insertLog($output, $url, $type = 'RestInternalServerErrorExcept * @param array|null $data The data to send on the request * @param array $headers The extra headers without Content-Type * @param bool $throwContent + * @param bool $noCheckCertificate To disable CURLOPT_SSL_VERIFYPEER + * @param bool$noProxy To disable CURLOPT_PROXY * @return array The result content */ - public function call($url, $method = 'GET', $data = null, $headers = array(), $throwContent = false) + public function call($url, $method = 'GET', $data = null, $headers = array(), $throwContent = false, $noCheckCertificate = false, $noProxy = false) { /* Add content type to headers */ $headers[] = 'Content-type: ' . $this->contentType; @@ -97,7 +99,11 @@ public function call($url, $method = 'GET', $data = null, $headers = array(), $t curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - if (!is_null($this->proxy)) { + if ($noCheckCertificate) { + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + } + + if (!$noProxy && !is_null($this->proxy)) { curl_setopt($ch, CURLOPT_PROXY, $this->proxy); if (!is_null($this->proxyAuthentication)) { curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); diff --git a/www/front_src/src/components/forms/remoteServer/RemoteServerFormStepOne.js b/www/front_src/src/components/forms/remoteServer/RemoteServerFormStepOne.js index b6c7cddf62b..3b85bf4ce2f 100755 --- a/www/front_src/src/components/forms/remoteServer/RemoteServerFormStepOne.js +++ b/www/front_src/src/components/forms/remoteServer/RemoteServerFormStepOne.js @@ -3,6 +3,7 @@ import { Field, reduxForm as connectForm } from "redux-form"; import InputField from "../../form-fields/InputField"; import SelectField from "../../form-fields/SelectField"; import RadioField from "../../form-fields/PreselectedRadioField"; +import CheckboxField from "../../form-fields/CheckboxField"; import {Translate} from 'react-redux-i18n'; import {I18n} from "react-redux-i18n"; @@ -111,6 +112,16 @@ class RemoteServerFormStepOne extends Component { placeholder="/centreon/" label={I18n.t("Centreon Web Folder on Remote") + ":"} /> + + ) : null} @@ -175,6 +186,16 @@ class RemoteServerFormStepOne extends Component { placeholder="/centreon/" label={I18n.t("Centreon Web Folder on Remote") + ":"} /> + + ) : null} diff --git a/www/include/configuration/configGenerate/xml/moveFiles.php b/www/include/configuration/configGenerate/xml/moveFiles.php index 6b102e48d38..2885264fd4a 100644 --- a/www/include/configuration/configGenerate/xml/moveFiles.php +++ b/www/include/configuration/configGenerate/xml/moveFiles.php @@ -79,9 +79,11 @@ // Add task to export files if there is a remote $idBindString = str_repeat('?,', count($pollers)); $idBindString = rtrim($idBindString, ','); -$queryRemotes = "SELECT ns.id, ns.ns_ip_address as ip, rs.centreon_path FROM nagios_server as ns - JOIN remote_servers as rs ON rs.ip = ns.ns_ip_address - WHERE ns.id IN({$idBindString})"; +$queryRemotes = "SELECT ns.id, ns.ns_ip_address AS ip, + rs.centreon_path, rs.http_method, rs.http_port, rs.no_check_certificate, rs.no_proxy + FROM nagios_server AS ns + JOIN remote_servers AS rs ON rs.ip = ns.ns_ip_address + WHERE ns.id IN ({$idBindString})"; $remotesStatement = $pearDB->query($queryRemotes, $pollers); $remotesResults = $remotesStatement->fetchAll(PDO::FETCH_ASSOC); @@ -93,9 +95,13 @@ $linkedResults = $linkedStatement->fetchAll(PDO::FETCH_ASSOC); $exportParams = [ - 'server' => $remote['id'], - 'remote_ip' => $remote['ip'], + 'server' => $remote['id'], + 'remote_ip' => $remote['ip'], 'centreon_path' => $remote['centreon_path'], + 'http_method' => $remote['http_method'], + 'http_port' => $remote['http_port'] ?: null, + 'no_check_certificate' => $remote['no_check_certificate'], + 'no_proxy' => $remote['no_proxy'], 'pollers' => [] ]; diff --git a/www/include/configuration/configServers/DB-Func.php b/www/include/configuration/configServers/DB-Func.php index c6d14345b0a..c56fe503b09 100644 --- a/www/include/configuration/configServers/DB-Func.php +++ b/www/include/configuration/configServers/DB-Func.php @@ -495,6 +495,33 @@ function addUserRessource(int $serverId): bool return true; } +/** + * Update Remote Server informations + * + * @param array $data + * + */ +function updateRemoteServerInformation(array $data) +{ + global $pearDB, $centreon; + + $res = $pearDB->query("SELECT * FROM `remote_servers` WHERE ip = '" . $data["ns_ip_address"] . "'"); + $rows = $res->fetch(\PDO::FETCH_ASSOC); + + if ($rows > 1) { + $rq = "UPDATE `remote_servers` SET "; + $rq .= "http_method = '" . $data["http_method"] . "', "; + isset($data["http_port"]) && !empty($data["http_port"]) + ? $rq .= "http_port = '" . $data["http_port"] . "', " + : $rq .= "http_port = NULL, "; + $rq .= "no_check_certificate = '" . $data["no_check_certificate"]["no_check_certificate"] . "', "; + $rq .= "no_proxy = '" . $data["no_proxy"]["no_proxy"] . "', "; + $rq .= "ip = '" . $data["ns_ip_address"] . "'"; + $pearDB->query($rq); + } + $res->closeCursor(); +} + /** * Update a server * @@ -597,6 +624,8 @@ function updateServer(int $id, $data): void $rq .= "WHERE id = '" . $id . "'"; $pearDB->query($rq); + updateRemoteServerInformation($data); + if (isset($_REQUEST['pollercmd'])) { $instanceObj = new CentreonInstance($pearDB); $instanceObj->setCommands($id, $_REQUEST['pollercmd']); @@ -705,4 +734,4 @@ function checkChangeState(int $poller_id, int $last_restart): bool $dbResult = $pearDBO->query($query); return $dbResult->rowCount() ? true : false; -} \ No newline at end of file +} diff --git a/www/include/configuration/configServers/formServers.ihtml b/www/include/configuration/configServers/formServers.ihtml index b6cce6a07ed..286410cb6ad 100644 --- a/www/include/configuration/configServers/formServers.ihtml +++ b/www/include/configuration/configServers/formServers.ihtml @@ -20,17 +20,23 @@ {$form.name.label}{$form.name.html} - - -

{$genOpt_nagios_version}

- - {$form.ns_ip_address.label}{$form.ns_ip_address.html} {$form.localhost.label}{$form.localhost.html} {$form.is_default.label}{$form.is_default.html} {if $form.remote_id.label} {$form.remote_id.label}{$form.remote_id.html} {/if} + {if $form.header.Remote_Configuration.label} + + +

{$form.header.Remote_Configuration}

+ + {$form.http_method.label}{$form.http_method.html} + {$form.http_port.label}{$form.http_port.html} + {$form.no_check_certificate.label}{$form.no_check_certificate.html} + {$form.no_proxy.label}{$form.no_proxy.html} + + {/if}

{$form.header.SSH_Informations}

diff --git a/www/include/configuration/configServers/formServers.php b/www/include/configuration/configServers/formServers.php index d2461a19a25..207222af2ed 100644 --- a/www/include/configuration/configServers/formServers.php +++ b/www/include/configuration/configServers/formServers.php @@ -72,6 +72,13 @@ } elseif (in_array($cfg_server['ns_ip_address'], $remotesServerIPs)) { $serverType = "remote"; } + + if ($serverType === "remote") { + $dbResult = $pearDB->query("SELECT http_method, http_port, no_check_certificate, no_proxy " . + "FROM `remote_servers` WHERE `ip` = '" . $cfg_server['ns_ip_address'] . "' LIMIT 1"); + $cfg_server = array_merge($cfg_server, array_map("myDecode", $dbResult->fetch())); + $dbResult->closeCursor(); + } } /* @@ -137,6 +144,27 @@ $form->addElement('header', 'Misc', _("Miscelleneous")); $form->addElement('header', 'Centreontrapd', _("Centreon Trap Collector")); +/* + * form for Remote Server + */ +if (strcmp($serverType, 'remote') == 0) { + $form->addElement('header', 'Remote_Configuration', _("Remote Server Configuration")); + $aMethod = array( + 'http' => 'http', + 'https' => 'https' + ); + $form->addElement('select', 'http_method', _("HTTP Method"), $aMethod); + $form->addElement('text', 'http_port', _("HTTP Port"), $attrsText3); + $Tab = array(); + $Tab[] = $form->createElement('radio', 'no_check_certificate', null, _("Yes"), '1'); + $Tab[] = $form->createElement('radio', 'no_check_certificate', null, _("No"), '0'); + $form->addGroup($Tab, 'no_check_certificate', _("Do not check SSL certificate validation"), ' '); + $Tab = array(); + $Tab[] = $form->createElement('radio', 'no_proxy', null, _("Yes"), '1'); + $Tab[] = $form->createElement('radio', 'no_proxy', null, _("No"), '0'); + $form->addGroup($Tab, 'no_proxy', _("Do not use proxy defined in global configuration"), ' '); +} + /* * Poller Configuration basic information */ diff --git a/www/include/configuration/configServers/help.php b/www/include/configuration/configServers/help.php index 404615caa74..9eecdc8b396 100644 --- a/www/include/configuration/configServers/help.php +++ b/www/include/configuration/configServers/help.php @@ -30,3 +30,19 @@ . "Make sure to have sufficient rights for the Apache user to run these commands." ); $help['description'] = dgettext("help", "Short description of the poller"); +$help['http_method'] = dgettext( + "help", + "What kind of method is needed to reach the Remote Server, HTTP or HTTPS?" +); +$help['http_port'] = dgettext( + "help", + "On which TCP port is listening the Remote Server?" +); +$help['no_check_certificate'] = dgettext( + "help", + "If checked, it won't check the validity of the SSL certificate of the Remote Server." +); +$help['no_proxy'] = dgettext( + "help", + "If checked, it won't use the proxy configured in 'Administration > Parameters > Centreon UI' to connect to the Remote Server." +); diff --git a/www/install/createTables.sql b/www/install/createTables.sql index ece5fa3d73d..25166a6a054 100644 --- a/www/install/createTables.sql +++ b/www/install/createTables.sql @@ -2377,7 +2377,11 @@ CREATE TABLE IF NOT EXISTS `remote_servers` ( `is_connected` TINYINT(1) NOT NULL DEFAULT 0, `created_at` TIMESTAMP NOT NULL, `connected_at` TIMESTAMP NULL, - `centreon_path` VARCHAR(255) NULL + `centreon_path` VARCHAR(255) NULL, + `http_method` enum('http','https') NOT NULL DEFAULT 'http', + `http_port` int(11) DEFAULT NULL, + `no_check_certificate` enum('0','1') NOT NULL DEFAULT '0', + `no_proxy` enum('0','1') NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/www/install/react_translation.php b/www/install/react_translation.php index fe9f64f04f9..2b351f0ec57 100644 --- a/www/install/react_translation.php +++ b/www/install/react_translation.php @@ -75,3 +75,5 @@ echo _("You need to send '%s' in the request."); echo _("Some database poller updates are not active; check your configuration"); echo _("Latency detected, check configuration for better optimization"); +echo _("Do not check SSL certificate validation"); +echo _("Do not use configured proxy to connect to this server"); diff --git a/www/install/sql/centreon/Update-DB-18.10.4_to_18.10.5.sql b/www/install/sql/centreon/Update-DB-18.10.4_to_18.10.5.sql index f66e6515933..d5f95175e77 100644 --- a/www/install/sql/centreon/Update-DB-18.10.4_to_18.10.5.sql +++ b/www/install/sql/centreon/Update-DB-18.10.4_to_18.10.5.sql @@ -3,3 +3,9 @@ UPDATE `informations` SET `value` = '18.10.5' WHERE CONVERT( `informations`.`key -- Remove non existing entries DELETE FROM topology_JS WHERE id_page IN ('201', '2020301', '2020302', '5010103', '5010105'); + +-- Add HTTPS connexion to Remote Server +ALTER TABLE remote_servers ADD COLUMN `http_method` enum('http','https') NOT NULL DEFAULT 'http'; +ALTER TABLE remote_servers ADD COLUMN `http_port` int(11) NULL DEFAULT NULL; +ALTER TABLE remote_servers ADD COLUMN `no_check_certificate` enum('0','1') NOT NULL DEFAULT '0'; +ALTER TABLE remote_servers ADD COLUMN `no_proxy` enum('0','1') NOT NULL DEFAULT '0';