Nagios Authentifizierung

Nagios, Munin, Serverstats, etc.
Post Reply
AWOHille
Posts: 274
Joined: 2011-09-05 09:00
 

Nagios Authentifizierung

Post 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?
User avatar
Joe User
Project Manager
Project Manager
Posts: 11191
Joined: 2003-02-27 01:00
Location: Hamburg
Contact:
 

Re: Nagios Authentifizierung

Post 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.
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
AWOHille
Posts: 274
Joined: 2011-09-05 09:00
 

Re: Nagios Authentifizierung

Post by AWOHille »

Vielen Dank für die Erklärung bzw. die Standardkonfiguration. Die Umsetzung hat problemlos funktioniert.
Post Reply