Questo articolo è la seconda parte della nostra Installazione di OSSEC su Ubuntu 14.04 esercitazione.
Nella prima parte, abbiamo installato OSSEC come server e la sua interfaccia utente web su un Ubuntu 14.04 VPS.
Oggi installeremo Analogi Web Dashboard e tratteremo l'installazione dell'agente OSSEC su un altro VPS Ubuntu 14.04. Quindi aggiungeremo l'agente installato (client) al server OSSEC.
Quindi, iniziamo.
Accedi al VPS Linux in cui hai installato OSSEC come server:
# ssh root@server_ip
Aggiorna l'indice del pacchetto e controlla se sono disponibili aggiornamenti per il server:
# apt-get update && apt-get upgrade
Una volta che è fuori dai giochi, installiamo il dashboard Web di Analogi. Immettere la radice del documento predefinita per Apache che è '/var/www/html' :
# cd /var/www/html/
Clona il repository Analogi GIT:
# git clone https://github.com/ECSC/analogi.git
Copia il file di configurazione del database e modifica le impostazioni del database con i valori del database creato nella prima parte di questo tutorial:
# cp analogi/db_ossec.php.new analogi/db_ossec.php # nano analogi/db_ossec.php
Dopo aver modificato i valori, dovrebbero apparire così:
define ('DB_USER_O', 'ossecuser'); define ('DB_PASSWORD_O', 'your_password'); define ('DB_HOST_O', '127.0.0.1'); define ('DB_NAME_O', 'ossec');
Salva e chiudi il file.
Ora puoi visitare la dashboard di Analogi dal tuo browser web preferito. Apri http://tuo_indirizzo_IP/analogici
INSTALLAZIONE DELL'AGENTE OSSEC
Successivamente, devi installare OSSEC come agente sull'altra istanza di Ubuntu. Ma prima, installa i moduli come mostrato nella prima parte di questo tutorial. Se ti capita di avere già installato lo stack LAMP sulla tua istanza Ubuntu 14.04, procedi ed esegui il seguente comando:
# apt-get install libmysqlclient-dev 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
Scarica OSSEC nella directory '/opt', decomprimi l'archivio e accedi alla directory decompressa:
# cd /opt # wget https://bintray.com/artifact/download/ossec/ossec-hids/ossec-hids-2.8.3.tar.gz # tar -xzf ossec-hids-2.8.3.tar.gz # cd ossec-hids-2.8.3
Ora avvia lo script di installazione di OSSEC e segui le semplici istruzioni come mostrato nell'output di seguito:
# ./install.sh
1- What kind of installation do you want (server, agent, local, hybrid or help)? agent - Agent(client) 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- What's the IP Address or hostname of the OSSEC HIDS server?: enter the IP address of the OSSEC server machine - Adding Server IP xxx.xxx.xx.xxx 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 - Do you want to enable active response? (y/n) [y]: 3.5- 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 . - 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). --- - You first need to add this agent to the server so they can communicate with each other. When you have done so, you can run the 'manage_agents' tool to import the authentication key from the server. /var/ossec/bin/manage_agents
Come mostra la dichiarazione precedente, ora dovresti aggiungere l'agente al server OSSEC. Torna alla console del server OSSEC e genera una chiave per l'agente. Usa il comando seguente:
# /var/ossec/bin/manage_agents
Ora scegli l'opzione A, inserisci il nome per il nuovo agente, è l'indirizzo IP e l'ID. Segui l'output sottostante:
**************************************** * OSSEC HIDS v2.8.3 Agent manager. * * The following options are available: * **************************************** (A)dd an agent (A). (E)xtract key for an agent (E). (L)ist already added agents (L). (R)emove an agent (R). (Q)uit. Choose your action: A,E,L,R or Q: A - Adding a new agent (use '\q' to return to the main menu). Please provide the following: * A name for the new agent: ossec-client * The IP Address of the new agent: here you should enter the IP address of the OSSEC agent * An ID for the new agent[001]: Agent information: ID:001 Name:ossec-client IP Address:xxx.xx.xxx.xxx Confirm adding it?(y/n): y Agent added.
Esegui /var/ossec/bin/manage_agents comando di nuovo ed estrarre la chiave per l'agente:
# /var/ossec/bin/manage_agents **************************************** * OSSEC HIDS v2.8.3 Agent manager. * * The following options are available: * **************************************** (A)dd an agent (A). (E)xtract key for an agent (E). (L)ist already added agents (L). (R)emove an agent (R). (Q)uit. Choose your action: A,E,L,R or Q: E Available agents: ID: 001, Name: ossec-client, IP: enter the IP address of the OSSEC agent Provide the ID of the agent to extract the key (or '\q' to quit): 001 Agent key information for '001' is: MDAxIG9==...... ** Press ENTER to return to the main menu.
Copia la chiave e passa alla console dell'agente OSSEC. Esegui il comando /var/ossec/bin/manage_agents:
# /var/ossec/bin/manage_agents **************************************** * OSSEC HIDS v2.8.3 Agent manager. * * The following options are available: * **************************************** (I)mport key from the server (I). (Q)uit. Choose your action: I or Q: I * Provide the Key generated by the server. * The best approach is to cut and paste it. *** OBS: Do not include spaces or new lines. Paste it here (or '\q' to quit): paste the key that you generated on your OSSEC server Agent information: ID:001 Name:ossec-client IP Address: IP address of the OSSEC agent Confirm adding it?(y/n): y Added.
Puoi controllare il file di configurazione OSSEC per vedere se il server OSSEC è stato aggiunto correttamente:
# nano /var/ossec/etc/ossec.conf
L'indirizzo IP del server OSSEC viene aggiunto all'inizio del file:
<client> <server-hostname>xxx.xxx.xx.xxx</server-hostname> </client>
Una volta fatto, riavvia OSSEC su entrambi i computer server e agente:
# /var/ossec/bin/ossec-control restart
Ora puoi monitorare l'agente dall'interfaccia utente Web standard o il Dashboard Analog . Spetta a voi. Ovviamente OSSEC è un complesso sistema di rilevamento delle intrusioni e puoi modificarne la configurazione e gli agenti, quindi per maggiori informazioni consulta la documentazione completa OSSEC.
Congratulazioni. Hai configurato e integrato correttamente un agente OSSEC con il server OSSEC. Dovresti seguire questa stessa procedura se desideri aggiungere un altro agente a OSSEC.
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.