GNU/Linux >> Belajar Linux >  >> Panels >> Panels

Instal OSSEC di Ubuntu 14.04

Artikel ini adalah bagian pertama dari tutorial lengkap untuk menginstal server/agen OSSEC di Ubuntu 14.04 VPS . Bagian ini mencakup instalasi OSSEC 2.8.3 (versi stabil terbaru saat tutorial ini ditulis), instalasi UI Web dan menunjukkan cara mengaktifkan dukungan MySQL untuk OSSEC.

OSSEC adalah Sistem Deteksi Intrusi berbasis Host Sumber Terbuka. Ini menggabungkan semua aspek HIDS (deteksi intrusi berbasis host) dan Manajemen Insiden Keamanan (SIM)/Informasi Keamanan dan Manajemen Peristiwa (SIEM) bersama-sama dalam solusi sumber terbuka yang sederhana, kuat, dan.

Manfaat utama OSSEC adalah:

  • Persyaratan Kepatuhan
  • Multi platform
  • Peringatan Waktu Nyata dan Dapat Dikonfigurasi
  • Integrasi dengan infrastruktur saat ini
  • Manajemen terpusat
  • Pemantauan agen dan tanpa agen

OSSEC melakukan analisis log, pemeriksaan integritas file, pemantauan kebijakan, deteksi rootkit, peringatan waktu nyata, dan respons aktif. Untuk memeriksa sistem operasi dan format log yang didukung OSSEC, silakan kunjungi halaman mereka.

PERSYARATAN

Kami akan menggunakan paket Hosting VPS Linux SSD 1 kami untuk tutorial ini.

Masuk ke server Anda melalui SSH:

# ssh root@server_ip

Sebelum memulai, masukkan perintah di bawah ini untuk memeriksa apakah Anda telah menginstal versi Ubuntu yang tepat di komputer Anda:

# lsb_release -a

Ini akan memberi Anda output di bawahnya:

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

PERBARUI SISTEM

Pastikan server Anda benar-benar mutakhir:

# apt-get update && apt-get upgrade

Sekarang instal Apache, MySQL, PHP dan beberapa modul yang diperlukan dengan perintah di bawah ini:

# 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

PASANG OSSEC

Masukkan /opt direktori:

# cd /opt

Unduh OSSEC:

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

Buka paket arsip dan masuk ke direktori yang belum dibongkar:

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

# cd ossec-hids-2.8.3

Aktifkan dukungan database MySQL:

# cd src

# make setdb

Kembali ke direktori sebelumnya:

# cd ../

Sekarang, mulai skrip instalasi OSSEC dan ikuti petunjuk mudahnya:

# ./install.sh

Di bawahnya adalah output dari seluruh prosedur penginstalan dan fitur yang kami aktifkan. Tentu saja Anda memilih opsi mana yang akan diaktifkan/dinonaktifkan, tetapi kami menyarankan Anda untuk mengikuti output di bawah ini. Anda dapat menekan enter jika Anda ingin menggunakan pilihan default (yang dimasukkan dalam tanda kurung) untuk setiap pertanyaan yang diajukan.

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

Tekan enter.

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

Sekarang tekan enter untuk melanjutkan instalasi yang seharusnya tidak lebih dari 2 menit. Setelah semuanya selesai Anda akan mendapatkan:

- 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

Mulai OSSEC:

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

Langkah berikutnya adalah membuat pengguna dan database MySQL untuk OSSEC. Masukkan MySQL sebagai 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 menyediakan skema untuk database dan terletak di direktori src/os_dbd/. Oleh karena itu, impor ke database ossec yang baru Anda buat:

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

Masukkan sandi pengguna saat diminta.

Sekarang tambahkan konfigurasi database ke file konfigurasi 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>

Anda dapat meletakkan baris di atas di mana saja di blok . Simpan dan keluar dari file. Kemudian, aktifkan database dan mulai ulang OSSEC:

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

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

INSTAL UI WEB OSSEC

Instal UI Web OSSEC di root dokumen default Apache. Masuk ke direktori:

# cd /var/www/html/

Unduh OSSEC WUI terbaru dan buka paket arsip:

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

# unzip master.zip

Ubah nama direktori menjadi ossec:

# mv ossec-wui-master/ ossec/

Buat direktori tmp di dalam dan atur kepemilikan dan izin file yang benar:

# mkdir ossec/tmp/

# chown www-data: -R ossec/

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

Anda sekarang dapat mengakses UI web dengan membuka browser web favorit Anda dan menavigasi ke http://your_server_IP/ossec/

Selamat, Anda telah berhasil menginstal server OSSEC dan antarmuka pengguna webnya pada VPS Ubuntu 14.04. Untuk informasi lebih lanjut, silakan periksa dokumentasi lengkap OSSEC.

Di bagian kedua dari tutorial ini kita akan membahas instalasi agen OSSEC di komputer lain dan kita akan menginstal Dasbor Web Analogi yang memberikan antarmuka yang lebih baik dan lebih informatif jika dibandingkan dengan UI Web standar.

Tentu saja Anda tidak perlu melakukan semua ini jika Anda menggunakan salah satu layanan Hosting VPS Linux kami, dalam hal ini Anda dapat meminta admin Linux ahli kami untuk melakukan ini untuk Anda. Mereka tersedia 24×7 dan akan segera memenuhi permintaan Anda.

PS . Jika Anda menyukai posting ini, silakan bagikan dengan teman-teman Anda di jejaring sosial menggunakan tombol di sebelah kiri atau cukup tinggalkan balasan di bawah. Terima kasih.


Panels
  1. Instal phpMyAdmin di Ubuntu 16.04

  2. Instal PHP 7 di Ubuntu 14.04

  3. Instal Radiant di Ubuntu 14.04

  1. Instal agen OSSEC di Ubuntu 14.04

  2. Instal RethinkDB di Ubuntu

  3. Instal Icinga 2 di Ubuntu 16.04

  1. Instal XWiki di Ubuntu 16.04

  2. Instal npm di Ubuntu 16.04

  3. Instal Orangescrum di Ubuntu 16.04