GNU/Linux >> Linux Esercitazione >  >> Panels >> Panels

Installa OSSEC su Ubuntu 14.04

Questo articolo è la prima parte del tutorial completo per installazione del server/agente OSSEC su un VPS Ubuntu 14.04 . Questa parte copre l'installazione di OSSEC 2.8.3 (l'ultima versione stabile quando è stato scritto questo tutorial), è l'installazione dell'interfaccia utente Web e mostra come abilitare il supporto MySQL per OSSEC.

OSSEC è un sistema di rilevamento delle intrusioni basato su host open source. Combina tutti gli aspetti di HIDS (rilevamento delle intrusioni basato su host) e Security Incident Management (SIM)/Security Information and Event Management (SIEM) in una soluzione semplice, potente e open source.

I principali vantaggi di OSSEC sono:

  • Requisiti di conformità
  • Multipiattaforma
  • Avvisi in tempo reale e configurabili
  • Integrazione con l'infrastruttura attuale
  • Gestione centralizzata
  • Monitoraggio agent e agentless

OSSEC esegue l'analisi dei log, il controllo dell'integrità dei file, il monitoraggio delle policy, il rilevamento dei rootkit, gli avvisi in tempo reale e la risposta attiva. Per controllare i sistemi operativi e i formati di registro supportati da OSSEC, visita la loro pagina.

REQUISITI

Utilizzeremo il nostro piano di hosting VPS Linux SSD 1 per questo tutorial.

Accedi al tuo server tramite SSH:

# ssh root@server_ip

Prima di iniziare, inserisci il comando seguente per verificare se sul tuo computer è installata la versione corretta di Ubuntu:

# lsb_release -a

Dovrebbe darti l'output sottostante:

Distributor ID: Ubuntu
Description:    Ubuntu 14.04.3 LTS
Release:        14.04
Codename:       trusty

AGGIORNA IL SISTEMA

Assicurati che il tuo server sia completamente aggiornato:

# apt-get update && apt-get upgrade

Ora installa Apache, MySQL, PHP e alcuni moduli necessari con il comando seguente:

# apt-get install mysql-server libmysqlclient-dev mysql-client apache2 php5 libapache2-mod-php5 php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

INSTALLA OSSEC

Inserisci /opt directory:

# cd /opt

Scarica OSSEC:

# wget https://bintray.com/artifact/download/ossec/ossec-hids/ossec-hids-2.8.3.tar.gz

Decomprimi l'archivio e accedi alla directory decompressa:

# tar -xzf ossec-hids-2.8.3.tar.gz

# cd ossec-hids-2.8.3

Abilita il supporto del database MySQL:

# cd src

# make setdb

Torna alla directory precedente:

# cd ../

Ora avvia lo script di installazione di OSSEC e segui le semplici istruzioni:

# ./install.sh

Sotto c'è l'output dell'intera procedura di installazione e le funzionalità che abbiamo abilitato. Ovviamente scegli quali opzioni abilitare/disabilitare, ma ti consigliamo di seguire l'output di seguito. Puoi premere invio se vuoi andare con la scelta predefinita (che è messa tra parentesi) per ogni domanda posta.

OSSEC HIDS v2.8.3 Installation Script - http://www.ossec.net

 You are about to start the installation process of the OSSEC HIDS.
 You must have a C compiler pre-installed in your system.
 If you have any questions or comments, please send an e-mail
 to [email protected] (or [email protected]).

  - System: Linux vps 2.6.32-042stab113.11
  - User: root
  - Host: vps.rosehosting.com


  -- Press ENTER to continue or Ctrl-C to abort. --

Premi invio.

1- What kind of installation do you want (server, agent, local, hybrid or help)? server

  - Server installation chosen.

2- Setting up the installation environment.

 - Choose where to install the OSSEC HIDS [/var/ossec]:

    - Installation will be made at  /var/ossec .

3- Configuring the OSSEC HIDS.

  3.1- Do you want e-mail notification? (y/n) [y]:

   - What's your e-mail address? [email protected]
   - What's your SMTP server ip/host? smtp.example.com

  3.2- Do you want to run the integrity check daemon? (y/n) [y]:

   - Running syscheck (integrity check daemon).

  3.3- Do you want to run the rootkit detection engine? (y/n) [y]:

   - Running rootcheck (rootkit detection).

  3.4- Active response allows you to execute a specific
       command based on the events received. For example,
       you can block an IP address or disable access for
       a specific user.
       More information at:
       http://www.ossec.net/en/manual.html#active-response

   - Do you want to enable active response? (y/n) [y]:

     - Active response enabled.

   - By default, we can enable the host-deny and the
     firewall-drop responses. The first one will add
     a host to the /etc/hosts.deny and the second one
     will block the host on iptables (if linux) or on
     ipfilter (if Solaris, FreeBSD or NetBSD).
   - They can be used to stop SSHD brute force scans,
     portscans and some other forms of attacks. You can
     also add them to block on snort events, for example.

   - Do you want to enable the firewall-drop response? (y/n) [y]:

     - firewall-drop enabled (local) for levels >= 6

   - Default white list for the active response:
      - xxx.xxx.xxx.xx
      - xx.xxx.xx.xxx

   - Do you want to add more IPs to the white list? (y/n)? [n]:

  3.5- Do you want to enable remote syslog (port 514 udp)? (y/n) [y]:

   - Remote syslog enabled.

  3.6- Setting the configuration to analyze the following logs:
    -- /var/log/messages
    -- /var/log/auth.log
    -- /var/log/syslog
    -- /var/log/mail.info
    -- /var/log/dpkg.log
    -- /var/log/apache2/error.log (apache log)
    -- /var/log/apache2/access.log (apache log)

 - If you want to monitor any other file, just change
   the ossec.conf and add a new localfile entry.
   Any questions about the configuration can be answered
   by visiting us online at http://www.ossec.net .


   --- Press ENTER to continue ---

Ora premi Invio per continuare con l'installazione che non dovrebbe richiedere più di 2 minuti. Dopo che tutto sarà completato otterrai:

- System is Debian (Ubuntu or derivative).
 - Init script modified to start OSSEC HIDS during boot.

 - Configuration finished properly.

 - To start OSSEC HIDS:
                /var/ossec/bin/ossec-control start

 - To stop OSSEC HIDS:
                /var/ossec/bin/ossec-control stop

 - The configuration can be viewed or modified at /var/ossec/etc/ossec.conf


    Thanks for using the OSSEC HIDS.
    If you have any question, suggestion or if you find any bug,
    contact us at [email protected] or using our public maillist at
    [email protected]
    ( http://www.ossec.net/main/support/ ).

    More information can be found at http://www.ossec.net

    ---  Press ENTER to finish (maybe more information below). ---

    - In order to connect agent and server, you need to add each agent to the server.
   Run the 'manage_agents' to add or remove them:

   /var/ossec/bin/manage_agents

Avvia OSSEC:

# /var/ossec/bin/ossec-control start

Il passaggio successivo consiste nel creare un utente e un database MySQL per OSSEC. Inserisci MySQL come root:

# mysql -u root -p

mysql> create database ossec;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on ossec.* to ossecuser@localhost identified by 'your_password';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

OSSEC fornisce uno schema per il database e si trova nella directory src/os_dbd/. Pertanto, importalo nel database ossec appena creato:

# mysql -u ossecuser -p ossec < src/os_dbd/mysql.schema

Inserisci la password dell'operatore quando richiesto.

Ora aggiungi la configurazione del database al file di configurazione OSSEC:

# nano /var/ossec/etc/ossec.conf
<database_output>
        <hostname>127.0.0.1</hostname>
        <username>ossecuser</username>
        <password>your_password</password>
        <database>ossec</database>
        <type>mysql</type>
    </database_output>

Puoi inserire le righe precedenti ovunque nel blocco . Salva ed esci dal file. Quindi, abilita il database e riavvia OSSEC:

# /var/ossec/bin/ossec-control enable database

# /var/ossec/bin/ossec-control restart

INSTALLA UI WEB OSSEC

Installa l'interfaccia utente Web OSSEC nella root del documento predefinita di Apache. Inserisci la directory:

# cd /var/www/html/

Scarica l'ultima OSSEC WUI e decomprimi l'archivio:

# wget https://github.com/ossec/ossec-wui/archive/master.zip

# unzip master.zip

Rinomina la directory in ossec:

# mv ossec-wui-master/ ossec/

Crea una directory tmp all'interno e imposta la proprietà e i permessi dei file corretti:

# mkdir ossec/tmp/

# chown www-data: -R ossec/

# chmod 666 /var/www/html/ossec/tmp

Ora puoi accedere all'interfaccia utente web aprendo il tuo browser web preferito e navigando su http://your_server_IP/ossec/

Congratulazioni, hai installato correttamente il server OSSEC e la sua interfaccia utente web su un VPS Ubuntu 14.04. Per ulteriori informazioni, consultare la documentazione completa dell'OSSEC.

Nella seconda parte di questo tutorial tratteremo l'installazione dell'agente OSSEC su un altro computer e installeremo il dashboard Web Analogi che offre un'interfaccia migliore e più informativa rispetto all'interfaccia utente Web standard.

Ovviamente non devi fare nulla di tutto ciò se utilizzi uno dei nostri servizi di hosting VPS Linux, nel qual caso puoi semplicemente chiedere ai nostri esperti amministratori Linux di farlo per te. Sono disponibili 24 ore su 24, 7 giorni su 7 e si prenderanno immediatamente cura della tua richiesta.

PS . Se questo post ti è piaciuto condividilo con i tuoi amici sui social network utilizzando i pulsanti a sinistra o semplicemente lascia una risposta qui sotto. Grazie.


Panels
  1. Installa PHP 7 su Ubuntu 14.04

  2. Installa Radiant su Ubuntu 14.04

  3. Installa l'agente OSSEC su Ubuntu 14.04

  4. Installa RethinkDB su Ubuntu

  5. Installa Elasticsearch su Ubuntu

Come installare OSSEC su Ubuntu 14.04

Installa Webmin su Ubuntu 16.04

Installa phpMyAdmin su Ubuntu 16.04

Installa MEAN su Ubuntu 14.04

Installa npm su Ubuntu 16.04

Installa OrangeScrum su Ubuntu 16.04