Page 1 of 1
Nagios Authentifizierung
Posted: 2014-08-20 22:40
by AWOHille
Hallo,
ich möchte für Nagios, neben der Passwort Authentifizierung, auch noch eine Begrenzung auf bestimmte IP's. Dies wollte ich folgendermaßen lösen
Code: Select all
<DirectoryMatch (/usr/share/nagios3/htdocs|/usr/lib/cgi-bin/nagios3|/etc/nagios3/stylesheets)>
Options FollowSymLinks
DirectoryIndex index.php index.html
Require all denied
Require ip meine_ip
AllowOverride AuthConfig
AuthName "Nagios Access"
AuthType Digest
AuthUserFile /etc/nagios3/htpasswd.users
Satisfy All
Require valid-user
SSLRequireSSL
</DirectoryMatch>
Das Problem hierbei ist, das der Zugang zwar nun auf die IP begrenzt wird, es aber zu keiner Authentifizierung per Passwort mehr kommt. Wo liegt mein Fehler?
Re: Nagios Authentifizierung
Posted: 2014-08-21 13:53
by Joe User
Ab Apache 2.4 müssen mehrere Require-Directiven in <Require(All|Any|None)>-Container gruppiert werden, sonst gilt nur die jeweils letzte Require-Directive.
Ich habe Dir mal schnell eine kleine Standardkonfiguration erstellt, damit Du die Zusammenhänge besser verstehen kannst. Pfade solltest Du natürlich anpassen wenn Du die Konfiguration übernimmst und auch die Optionen nochmal prüfen.
Nagios wäre hier nur per HTTPS unter
https://host.domain.tld/nagios/ erreichbar. HTTP und HTTPS haben getrennte Docroots und Logs, sind also sauber getrennt. SSL/TLS ist sicher und trotzdem weitestgehend kompatibel konfiguriert. Wenn Du SNI nicht verwendest, dann bitte SSLStrictSNIVHostCheck löschen.
Code: Select all
<Directory "/">
Options None +FollowSymLinks
AllowOverride None
<RequireAll>
Require method GET POST OPTIONS
Require all denied
</RequireAll>
</Directory>
<FilesMatch "^[\._]">
Require all denied
</FilesMatch>
<IfModule ssl_module>
Listen 443
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect file:/dev/urandom 512
SSLPassPhraseDialog builtin
<IfModule socache_shmcb_module>
SSLSessionCache "shmcb:/var/run/ssl_scache(512000)"
</IfModule>
<IfModule !socache_shmcb_module>
<IfModule socache_dbm_module>
SSLSessionCache "dbm:/var/run/ssl_scache"
</IfModule>
<IfModule !socache_dbm_module>
SSLSessionCache "nonenotnull"
</IfModule>
</IfModule>
SSLSessionCacheTimeout 300
SSLCompression Off
SSLHonorCipherOrder On
SSLStrictSNIVHostCheck On
SSLProtocol -ALL +TLSv1 +TLSv1.2
SSLCipherSuite "EECDH+AES256 EECDH+AES128 EDH+AES256 EDH+AES128 !CAMELLIA !RC4 !3DES !IDEA !SEED !PSK !SRP !DSS !eNULL !aNULL !LOW !EXP"
<FilesMatch "\.(php|phps|php5|phtml|cgi|pl|py|shtml)$">
SSLOptions +StdEnvVars
</FilesMatch>
</IfModule>
<VirtualHost *:80>
ServerName host.domain.tld
CustomLog "/data/www/vhosts/host.domain.tld/logs/access_log" combined
ErrorLog "/data/www/vhosts/host.domain.tld/logs/error_log"
DocumentRoot "/data/www/vhosts/host.domain.tld/data"
<Directory "/data/www/vhosts/host.domain.tld/data">
Options None +FollowSymLinks
AllowOverride None
<RequireAll>
Require method GET POST OPTIONS
Require all granted
</RequireAll>
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerName host.domain.tld
CustomLog "/data/www/vhosts/host.domain.tld/logs/ssl_access_log" combined
ErrorLog "/data/www/vhosts/host.domain.tld/logs/ssl_error_log"
DocumentRoot "/data/www/vhosts/host.domain.tld/ssl_data"
<Directory "/data/www/vhosts/host.domain.tld/ssl_data">
Options None +FollowSymLinks
AllowOverride None
<RequireAll>
Require method GET POST OPTIONS
Require all granted
</RequireAll>
</Directory>
<DirectoryMatch "(/usr/share/nagios3/htdocs|/usr/lib/cgi-bin/nagios3|/etc/nagios3/stylesheets)">
Options None +FollowSymLinks
AllowOverride None AuthConfig
AuthType Digest
AuthName "Nagios Access"
AuthDigestDomain /nagios https://host.domain.tld/nagios
AuthBasicProvider file
AuthUserFile "/etc/nagios3/htpasswd.users"
<RequireAll>
Require method GET POST OPTIONS
Require ip meine_ip
Require valid-user
</RequireAll>
</DirectoryMatch>
SSLEngine on
SSLCertificateFile "/data/pki/certs/host.domain.tld.crt"
SSLCertificateKeyFile "/data/pki/private/host.domain.tld.key"
SSLCertificateChainFile "/data/pki/ca/component-ca-chain.pem"
</VirtualHost>
Hoffe es hilft Dir weiter.
Re: Nagios Authentifizierung
Posted: 2014-08-22 10:41
by AWOHille
Vielen Dank für die Erklärung bzw. die Standardkonfiguration. Die Umsetzung hat problemlos funktioniert.