2019/02/13

Oracle DBSAT ile Veritabanında Güvenlik İncelemesi

Bu yazımda Oracle Güvenlik taraması yapan bir tool'undan bahsetmek istiyorum. Oracle DBSAT açılımına bakacak olursak Oracle Database Security Assessment Tool(DBSAT) adlandırılır.

Bu tool veritabanında güvenlik politikalarını inceler ve bizlere bir repor sunar. Sunulan bu rapor incelendiğinde veritabanının güvenlik geliştirmesinde yardımcı olur. Bize sunacağı önerileri uygulayabiliriz.

DBSAT ile güvenlik açıklarını kaldırabilir ve bunları raporlayabiliriz.





Oracle DBSAT'ın çalışmasını  biraz daha incelediğimizde önce sistemde bir bilgi toplanmalı ve toplanan bu bilgiler rapor edilmelidir.

Bunu kendi içerisinde gerçekleştiren iki bileşen vardır. İşletim sistemi komutları ve veritabanında çalışacak olan sql cümleleri çalıştırıp bilgi toplayan bileşen DBSAT COLLECTOR olarak adlandırılır.

Daha sonra toplanan bu verileri rapor halin de sunan bileşen ise DBSAT RAPORTER olarak adlandırılır.


Oracle DBSAT kullanımı çok kolay ve pratik bir tool'dur.  Şimdi aşağıda adım adım yapılması gerekenleri sizlerle paylaşıyor olacağım.

Öncelikli olarak dbsat raporlama için kurulu olan işletim sistemimizde python versiyonunun 2.6 üzerinde olması gerekmektedir. Bunun kontrolü için aşağıdaki komut çalıştırılabilir ;

$ python -V
Python 2.7.5

Daha sonra işletim sistemimizde java versiyonu 1.8 olmasına dikkat edilir. Java kurulu değil ise
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
indirilirip kurulabilir ve .bash_profile set edilir.

rpm -Uvh jdk-8u201-linux-x64.rpm


vi .bash_profile

export JAVA_HOME=/usr/java/jdk1.8.0_201-amd64



Bu işlemleri de tamamladıktan sonra dbsat.zip dosyasını

https://support.oracle.com/epmos/faces/DocContentDisplay?_afrLoop=353663339390396&id=2138254.1&_afrWindowMode=0&_adf.ctrl-state=bfkpmmwa1_4

adresinden indirebiliriz.

Oracle DBSAT kullanımı için veritabanında bazı yetkilendirmeler yapmamız gerekiyor. Bunlar aşağıdaki gibi verilebilir.

sqlplus / as sysdba

SQL> create user dbsat identified by dbsat;

Grant succeeded.

SQL> grant create session to dbsat;

Grant succeeded.

SQL> grant select_catalog_role to dbsat;

Grant succeeded.

sadece 12c db için girilmeli.

SQL> grant select on sys.registry$history to dbsat;

Grant succeeded.

SQL> grant audit_viewer to dbsat;

Grant succeeded.

capture etmek için yetkilenmeli

SQL> grant capture_admin to dbsat;

Grant succeeded.

db vault açıksa yetkilendirilmeli.

SQL> grant DV_SECANALYST to dbsat;

Grant succeeded.


İndirilen dbsat.zip dosyası bir klasör oluşturularak oraya unzip edilmeli.

cd /u01
[oracle@orcl u01]$ mkdir dbsat

[oracle@orcl setup]$ mv dbsat.zip ../dbsat/.
[oracle@orcl dbsat]$ unzip dbsat.zip


Yukarıda bahsettiğimiz üzere,collect komutu ile veritabanında bilgi toplar ve tüm bilgileri içeren JSON dosyası üretir. 
Bu komut çalıştırıldığında dosyası şifrelemek için bir şifre soracaktır. 
Ayrıca login için de dbsat user şifresi de soracaktır. Oluşcak dosya nerde dbsat.zip dosyasını unzip ettiysek oraya çıkartılacaktır.

[oracle@orcl dbsat]$ ./dbsat collect dbsat@orcl orcl_dbsat_output

Database Security Assessment Tool version 2.0.2 (May 2018)

This tool is intended to assist in you in securing your Oracle database
system. You are solely responsible for your system and the effect and
results of the execution of this tool (including, without limitation,
any damage or data loss). Further, the output generated by this tool may
include potentially sensitive system configuration data and information
that could be used by a skilled attacker to penetrate your system. You
are solely responsible for ensuring that the output of this tool,
including any generated reports, is handled in accordance with your
company's policies.

Connecting to the target Oracle database...


SQL*Plus: Release 12.2.0.1.0 Production on Wed Feb 13 16:43:55 2019

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

Setup complete.
SQL queries complete.
OS commands complete.
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
DBSAT Collector completed successfully.

Calling /u01/app/oracle/product/12.2.0.1/db_1/bin/zip to encrypt orcl_dbsat_output.json...

Enter password:
Verify password:
  adding: orcl_dbsat_output.json (deflated 86%)
zip completed successfully.


Çıkartılan dosyadan sonra raporlama için dbsat raporter verilerek analiz edilebilir.

[oracle@orcl dbsat]$ ./dbsat report orcl_dbsat_output

Database Security Assessment Tool version 2.0.2 (May 2018)

This tool is intended to assist in you in securing your Oracle database
system. You are solely responsible for your system and the effect and
results of the execution of this tool (including, without limitation,
any damage or data loss). Further, the output generated by this tool may
include potentially sensitive system configuration data and information
that could be used by a skilled attacker to penetrate your system. You
are solely responsible for ensuring that the output of this tool,
including any generated reports, is handled in accordance with your
company's policies.

Archive:  orcl_dbsat_output.zip
[orcl_dbsat_output.zip] orcl_dbsat_output.json password:
  inflating: orcl_dbsat_output.json 
DBSAT Reporter ran successfully.

Calling /usr/bin/zip to encrypt the generated reports...

Enter password:
Verify password:
               zip warning: orcl_dbsat_output_report.zip not found or empty
  adding: orcl_dbsat_output_report.txt (deflated 78%)
  adding: orcl_dbsat_output_report.html (deflated 83%)
  adding: orcl_dbsat_output_report.xlsx (deflated 3%)
  adding: orcl_dbsat_output_report.json (deflated 82%)
zip completed successfully.









Referans-1: https://oracle-base.com/articles/misc/database-security-assessment-tool-dbsat
Referans-2: https://support.oracle.com/epmos/faces/DocContentDisplay?_afrLoop=364195778844835&id=2138254.1&_afrWindowMode=0&_adf.ctrl-state=19teopa6zo_4
Referans 3: https://www.veritabani.gen.tr/2018/04/02/oracle-database-security-assessment-tool-dbsat-ile-veritabanlarinda-guvenlik-taramasi/
Referans 4: https://docs.oracle.com/cd/E93129_01/SATUG/toc.htm#SATUG-GUID-A472649D-622A-4BE7-9068-D6C4AC1D0651





Hiç yorum yok:

Yorum Gönder