Benutzer-Werkzeuge

Webseiten-Werkzeuge


tachtler:icinga2_-_api-zugriff_apache

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
tachtler:icinga2_-_api-zugriff_apache [2018/10/23 13:07] – [icinga2: Features] klaustachtler:icinga2_-_api-zugriff_apache [2018/10/23 13:45] (aktuell) – [/etc/httpd/conf.d/httpd-vhost.conf] klaus
Zeile 137: Zeile 137:
  
 Die LOG-Datei ''/var/log/icinga2/error.log'' sollte hingegen **leer** sein! Die LOG-Datei ''/var/log/icinga2/error.log'' sollte hingegen **leer** sein!
 +
 +===== Konfiguration =====
 +
 +Nachfolgend die **VHOST**-Konfiguration für den [[http://httpd.apache.org/|Apache HTTP Server]].
 +
 +:!: **WICHTIG** - **Nachfolgende Konfigurationen stellen eine grundlegende [[http://httpd.apache.org/|Apache HTTP Server]]-VHOST-Konfiguration dar.\\ Weitere Einzelheiten zu [[http://httpd.apache.org/|Apache HTTP Server]]-VHOST sind in der Dokumentation zum [[http://httpd.apache.org/|Apache HTTP Server]] verfügbar!**
 +
 +==== /etc/httpd/conf.d/httpd-vhost.conf ====
 +
 +Nachfolgend ein Beispiel für einen [[http://httpd.apache.org/|Apache HTTP Server]]-VHOST via **https**:
 +<code apache>
 +#
 +# VirtualHost HTTPS
 +#
 +<VirtualHost *:443>
 +        ServerAdmin hostmaster@tachtler.net
 +        ServerName icingaapiaccess.tachtler.net
 +        ServerPath /
 +
 +        # ----------------------------------------------------------
 +        # HTTPS settings
 +        # ----------------------------------------------------------
 +        SSLEngine on
 +        SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
 +        SSLHonorCipherOrder on
 +        SSLCipherSuite "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:!aNULL:!MD5:!DSS"
 +        SSLCertificateFile /etc/pki/tls/cert.pem
 +        SSLCertificateKeyFile /etc/pki/tls/private.pem
 +        SSLCertificateChainFile /etc/pki/tls/chain.pem
 +        SSLCACertificateFile /etc/pki/tls/fullchain.pem
 +
 +        # ----------------------------------------------------------
 +        # Location settings
 +        # ----------------------------------------------------------
 +        <Location />
 +        </Location>
 +        
 +        # ----------------------------------------------------------
 +        # Proxy settings
 +        # ----------------------------------------------------------
 +        SSLProxyEngine on
 +
 +        SSLProxyVerify none
 +        SSLProxyCheckPeerCN off
 +        SSLProxyCheckPeerName off
 +        SSLProxyCheckPeerExpire off
 +        SSLProxyProtocol all -SSLv3 -SSLv2
 +        ProxyTimeout 1200
 +
 +        ProxyRequests Off
 +        ProxyPreserveHost On
 +        ProxyPass / https://localhost:5665/ retry=0 timeout=300 keepalive=on
 +        ProxyPassReverse / https://localhost:5665/
 +
 +        # ----------------------------------------------------------
 +        # Logging settings
 +        # ----------------------------------------------------------
 +        ErrorLog "logs/error_log"
 +        CustomLog "logs/access_log" combined
 +</VirtualHost>
 +
 +</code>
 +
 +==== Icinga2: API-Test ====
 +
 +:!: **WICHTIG** - Bei der Konfiguration ist darauf zu achten, dass die [[https://icinga.com/docs/icinga2/latest/doc/12-icinga2-api/|Icinga2 API]] unter nachfolgender URL zu erreichen ist:
 +  * [[https://localhost:5665]]
 +
 +Dies kann durch ausführen von nachfolgendem Befehl ausprobiert werden:
 +<code html>
 +# curl -k -s -u apiuser:auchgeheim 'https://localhost:5665/v1'
 +<html><head><title>Icinga 2</title></head><h1>Hello from Icinga 2 (Version: r2.10.1-1)!</h1><p>
 +You are authenticated as <b>apiuser</b>. Your user has the following permissions:</p> <ul><li>*</li></ul>
 +<p>More information about API requests is available in the <a href="https://docs.icinga.com/icinga2/latest"
 +target="_blank">documentation</a>.</p></html>
 +</code>
 +
 +==== Apache: Neustart ====
 +
 +Nach Durchführung der vorhergehenden **Konfigurationsschritte**, sollte einem **Neustart** nichts im Wege stehen und die **Apache VHOST-Konfiguration** angezogen werden:
 +<code>
 +# systemctl restart httpd.service
 +</code>
 +
 +:!: **HINWEIS** - **Es erfolgen __keine__ weiteren Ausgaben, wenn der Start erfolgreich war !**
 +
 +==== Apache: API-Abfrage ====
 +
 +Nun sollte die [[https://icinga.com/docs/icinga2/latest/doc/12-icinga2-api/|Icinga2 API]] unter nachfolgender URL zu erreichen ist:
 +  * [[https://icingaapiaccess.tachtler.net/v1]]
 +
 +Dies kann durch ausführen von nachfolgendem Befehl ausprobiert werden:
 +<code html>
 +# curl -k -s -u apiuser:auchgeheim 'https://icingaapiaccess.tachtler.net/v1'
 +<html><head><title>Icinga 2</title></head><h1>Hello from Icinga 2 (Version: r2.10.1-1)!</h1><p>
 +You are authenticated as <b>apiuser</b>. Your user has the following permissions:</p> <ul><li>*</li></ul>
 +<p>More information about API requests is available in the <a href="https://docs.icinga.com/icinga2/latest"
 +target="_blank">documentation</a>.</p></html>
 +</code>
  
tachtler/icinga2_-_api-zugriff_apache.1540292872.txt.gz · Zuletzt geändert: 2018/10/23 13:07 von klaus