GNU/Linux >> Linux Esercitazione >  >> Ubuntu

Come installare OSSEC su Ubuntu 14.04

In questo tutorial, ti mostreremo come installare e configurare OSSEC su Ubuntu 14.04. Per chi non lo sapesse, OSSEC è un'intrusione gratuita basata su host open source sistema di rilevamento (HIDS).Esegue l'analisi dei registri, il controllo dell'integrità, il monitoraggio del registro di Windows, il rilevamento dei rootkit, gli avvisi basati sul tempo e la risposta attiva. Fornisce il rilevamento delle intrusioni per la maggior parte dei sistemi operativi, inclusi Linux, OpenBSD, FreeBSD, Mac OS X, Solaris e Windows. OSSEC ha un'architettura centralizzata multipiattaforma che consente di monitorare e gestire facilmente più sistemi.

Questo articolo presuppone che tu abbia almeno una conoscenza di base di Linux, sappia come usare la shell e, soprattutto, che ospiti il ​​tuo sito sul tuo VPS. L'installazione è abbastanza semplice e presuppone che tu sono in esecuzione nell'account root, in caso contrario potrebbe essere necessario aggiungere 'sudo ' ai comandi per ottenere i privilegi di root. Ti mostrerò l'installazione passo passo di OSSEC su un server Ubuntu 14.04.

Prerequisiti

  • Un server che esegue uno dei seguenti sistemi operativi:Ubuntu 14.04 e qualsiasi altra distribuzione basata su Debian come Linux Mint.
  • Si consiglia di utilizzare una nuova installazione del sistema operativo per prevenire potenziali problemi.
  • Accesso SSH al server (o semplicemente apri Terminal se sei su un desktop).
  • Un non-root sudo user o accedere all'root user . Ti consigliamo di agire come non-root sudo user , tuttavia, poiché puoi danneggiare il tuo sistema se non stai attento quando agisci come root.

Installa OSSEC su Ubuntu 14.04

Passaggio 1. Innanzitutto, assicurati che tutti i pacchetti di sistema siano aggiornati eseguendo il seguente apt-get comandi nel terminale.

sudo apt-get update
sudo apt-get upgrade

Passaggio 2. Installa il server LAMP (Linux, Apache, MariaDB, PHP).

È richiesto un server LAMP Ubuntu 14.04. Se non hai installato LAMP, puoi seguire la nostra guida qui.

Passaggio 3. Installazione di OSSEC.

La prima cosa da fare è andare alla pagina di download di OSSEC e scaricare l'ultima versione stabile di OSSEC. Al momento della stesura di questo articolo è la versione 2.8.3 :

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

Decomprimi l'archivio OSSEC nella directory principale dei documenti nel tuo server:

tar -xzf ossec-hids-2.8.3.tar.gz
cd ossec-hids-2.8.3
cd src
make setdb

Torna alla directory precedente:

cd ../
./install.sh

Puoi scegliere quali opzioni abilitare/disabilitare, ma ti consigliamo di seguire l'output di seguito. Puoi premere invio se vuoi andare con la scelta predefinita ( che viene messo 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.idroot.us

  -- 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 ---

Successivamente, premi Invio per continuare con l'installazione che non dovrebbe richiedere più di 3 minuti. Dopo aver completato tutto 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

Passaggio 4. Configurazione di MariaDB per OSSEC.

Per impostazione predefinita, MariaDB non è protetto. Puoi proteggere MariaDB usando mysql_secure_installation sceneggiatura. dovresti leggere attentamente e sotto ogni passaggio che imposterà una password di root, rimuoverà gli utenti anonimi, non consentirà l'accesso root remoto e rimuoverà il database di test e l'accesso per proteggere MariaDB:

mysql_secure_installation

Configuralo in questo modo:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

Successivamente, dovremo accedere alla console MariaDB e creare un database per l'OSSEC. Esegui il seguente comando:

mysql -u root -p

Questo ti chiederà una password, quindi inserisci la tua password di root MariaDB e premi Invio. Una volta effettuato l'accesso al server del database, devi creare un database per Installazione OSSEC:

create database ossec;
grant all privileges on ossec.* to ossecuser@localhost identified by 'your_password';
flush privileges;
exit

Per impostazione predefinita, OSSEC fornisce uno schema per il database e si trova nella directory src/os_dbd/. Importalo nel database oOSSECssec appena creato:

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

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

nano /var/ossec/etc/ossec.conf

Puoi inserire le righe precedenti ovunque nel blocco :

<database_output>
        <hostname>127.0.0.1</hostname>
        <username>ossecuser</username>
        <password>your_password</password>
        <database>ossec</database>
        <type>mysql</type>
</database_output>

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

Passaggio 5. Installazione dell'interfaccia utente Web OSSEC.

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

cd /var/www/html/
wget https://github.com/ossec/ossec-wui/archive/master.zip
unzip master.zip
mv ossec-wui-master/ ossec/

Crea un tmp la directory all'interno e impostare la proprietà e le autorizzazioni del file corretto:

mkdir ossec/tmp/
chown www-data: -R ossec/
chmod 666 /var/www/html/ossec/tmp

Passaggio 6. Accesso a OSSEC.

OSSEC sarà disponibile sulla porta HTTP 80 per impostazione predefinita. Apri il tuo browser preferito e vai a http://yourdomain.com/ossec o http://server-ip/ossec . Se stai usando un firewall, apri la porta 80 per abilitare l'accesso al pannello di controllo.

Congratulazioni! Hai installato correttamente OSSEC. Grazie per aver utilizzato questo tutorial per l'installazione di OSSEC sul sistema Ubuntu 14.04. Per ulteriore aiuto o informazioni utili, ti consigliamo di controllare il sito Web ufficiale di OSSEC.


Ubuntu
  1. Come installare Odoo su Ubuntu

  2. Come installare Maven su Ubuntu

  3. Installa OSSEC su Ubuntu 14.04

  4. Come installare R su Ubuntu 16.04

  5. Come installare Vai su Ubuntu 18.04

Come installare R su Ubuntu 20.04

Come installare Vai su Ubuntu 18.04

Come installare R su Ubuntu 18.04

Come installare qt su Ubuntu 20.04

Come installare Go in Ubuntu 20.04

Come installare Vai su Ubuntu 22.04