[HowTo] Installation OSSEC Web Interface (mit Warning!!!)

sTaN

New Member
Hallo liebe Community,

anbei ein kurzes HowTo zur Installation des OSSEC Webinterfaces.
Allerdings erhalte ich hierbei noch eine Fehlermeldung im Webinterface und bin mit meinem Latein am Ende. -->
Wurde gefixxt. Anleitung entspricht dem vorgehen ohne Fehlermeldung und SSL Verschlüsselung!

Vorgehensweise:

Zuerst das OSSEC Web Userinterface (Web UI) herunterladen:
Code:
#wget http://www.ossec.net/files/ui/ossec-wui-0.3.tar.gz

Checksum und Signatur des Paketes überprüfen
Code:
# wget http://www.ossec.net/files/ui/ossec-wui-0.3-checksum.txt
# wget http://www.ossec.net/files/ui/ossec-wui-0.3.tar.gz.sig
# cat ossec-wui-0.3-checksum.txt
# md5sum ossec-wui-0.3.tar.gz
         MD5 (ossec-wui-0.3.tar.gz) = c79fa486e9a20fb06a517541033af304
# sha1sum ossec-wui-0.3.tar.gz
         SHA1 (ossec-wui-0.3.tar.gz) = e00bff680721982ee55295a5292eb4e2a638b820

OSSEC Web UI Dateien entpacken und in ein Verzeichnis verschieben, auf welches der Webserver Zugriff hat:
Code:
# tar -zxvf ossec-wui-0.3.tar.gz
# mv ossec-wui-0.3 /var/www/vhosts/domain.de/httpsdocs/ossec-wui

Setup-Skript ausgeführen und Usernamen sowie Passwort vergeben
Code:
# cd /var/www/vhosts/domain.de/httpsdocs/ossec-wui
# ./setup.sh

Web Server User (www-data, o.ä.)der OSSEC-Gruppe hinzugefügen
Ermitteln des Users mit
Code:
# ps auwx |grep apache | cut -d " " -f 1 | grep -v root | uniq

Code:
# vi /etc/group
Änderung
Von:
Code:
ossec:x:1001:
Zu:
Code:
ossec:x:1001:www-data

Berechtigungen für das tmp-Verzeichnis anpassen und Apache neu starten
Code:
# chmod 770 tmp/
# chgrp www tmp/
# /etc/init.d/apache2 restart

vhost_ssl.conf anpassen (Alias setzen und open_basedir einfügen)
Code:
# vi /var/www/vhosts/domain.de/conf/vhost_ssl.conf
Code:
Alias /ossec-wui /var/www/vhosts/domain.de/httpsdocs/ossec-wui/
<Directory /var/www/vhosts/domain.de/httpsdocs>
        <IfModule sapi_apache2.c>
                php_admin_value open_basedir "/var/www/vhosts/domain.de/httpsdocs:/tmp:/var/ossec"
        </IfModule>
        <IfModule mod_php5.c>
                ...
                php_admin_value open_basedir "/var/www/vhosts/domain.de/httpsdocs:/tmp:/var/ossec"
        </IfModule>

vhosts_ssl.conf neu einlesen
Code:
# /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=domain.de -r -a

Ossec Web User Interface aufrufen über:
Code:
http://domain.de/ossec-wui/

Folgende Fehlermeldung tritt auf, wenn die open_basedir Direktive vergessen oder nicht richtig gesetzt wurde:

Code:
Warning: opendir() [function.opendir]: open_basedir restriction in effect. File(/var/ossec) is not within the allowed path(s): (/var/www/vhosts/domain.de/httpdocs:/tmp) in /var/www/vhosts/domain.de/httpdocs/ossec-wui/lib/os_lib_handle.php  on line 94

Warning: opendir(/var/ossec) [function.opendir]: failed to open dir: Operation not permitted in /var/www/vhosts/domain.de/httpdocs/ossec-wui/lib/os_lib_handle.php on line 94
Unable to access ossec directory.

Viel Spaß damit!

Gruß,
sTaN
 
Last edited by a moderator:
Du musst das Verzeichnis /var/ossec mit in open_basedir Direktive in der php.ini inkludieren.

--marneus
 
Implementiere ich das Verzeichnis direkt in die Haupt php.ini, in die von Plesk oder in die vhost.conf der jeweiligen Domain, wo das Ossec-WUI liegt?

Gruß,
sTaN
 
Last edited by a moderator:
Das obliegt Deiner Entscheidung. Da Du anscheinend nur von dem von Dir vorhergesehenem vhost auf die Ossec Dateien zugreifen willst, reicht die php.ini des entsprechenden vhosts.

--marneus
 
Habe den Eintrag in meiner /var/www/vhosts/domain.de/conf/vhost.conf gemacht und bringt leider keinen Erfolg. Sicher ein Syntaxfehler.

Hier meine vhost.conf:

Code:
DocumentRoot /var/www/vhosts/domain.de/httpdocs/meinverzeichnis/
Alias /ossec-wui /var/www/vhosts/domain.de/httpdocs/ossec-wui/
<Directory /var/www/vhosts/domain.de/httpdocs>
php_admin_value open_basedir "/var/www/vhosts/domain.de/httpdocs:/tmp:/var/ossec"
        <IfModule sapi_apache2.c>
                php_admin_flag engine on
                php_admin_flag safe_mode off
                php_flag register_globals off
                php_flag magic_quotes_gpc off
                php_flag magic_quotes_runtime off
                php_admin_value open_basedir "/var/www/vhosts/domain.de/httpdocs:/tmp:/usr/share/php"
        </IfModule>
        <IfModule mod_php5.c>
                php_admin_flag engine on
                php_admin_flag safe_mode off
                php_flag register_globals off
                php_flag magic_quotes_gpc off
                php_flag magic_quotes_runtime off
                php_admin_value open_basedir "/var/www/vhosts/domain.de/httpdocs:/tmp:/usr/share/php"
        </IfModule>
                SSLRequireSSL
                Options -Includes -ExecCGI
</Directory>

Das nächste Problem, komischerweise funktioniert ein Aufruf der OSSEC-WUI über https://domain.de/ossec-wui aber nicht über http://domain.de/ossec-wui. Dort erhalte ich 403 Forbidden.

Meine vhost_ssl.conf sieht so aus:
Code:
Alias /ossec-wui /var/www/vhosts/domain.de/httpdocs/ossec-wui
<Directory /var/www/vhosts/domain.de/httpsdocs>
php_admin_value open_basedir "/var/www/vhosts/domain.de/httpdocs:/tmp:/var/ossec"
        <IfModule sapi_apache2.c>
                php_admin_flag engine on
                php_admin_flag safe_mode off
                php_flag register_globals off
                php_flag magic_quotes_gpc off
                php_flag magic_quotes_runtime off
                php_admin_value open_basedir "/var/www/vhosts/domain.de/httpsdocs:/tmp:/usr/share/php"
        </IfModule>
        <IfModule mod_php5.c>
                php_admin_flag engine on
                php_admin_flag safe_mode off
                php_flag register_globals off
                php_flag magic_quotes_gpc off
                php_flag magic_quotes_runtime off
                php_admin_value open_basedir "/var/www/vhosts/domain.de/httpsdocs:/tmp:/usr/share/php"
        </IfModule>
                SSLRequireSSL
                Options -Includes -ExecCGI
</Directory>

Dateien wurden jeweils neu geladen und Apache neugestartet mit:

Code:
# /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=domain.de -r -a
# /etc/init.d/apache2 restart

Gruß,
sTaN
 
Last edited by a moderator:
Back
Top