مقدمه
Database Security Assessment Tool (DBSAT) توسط Oracle به عنوان ابزاری برای بررسی مسائل امنیتی رایج پایگاه داده و همچنین کمک به شناسایی داده های حساس ذخیره شده در پایگاه داده ارائه شده است.
آشنایی با ابزار Database Security Assessment Tool (DBSAT)
Documentation and Downloads:
دو منبع اصلی اطلاعات در مورد ابزار DBSAT وجود دارد:
• Oracle Database Security Assessment Tool (DBSAT) (Doc ID 2138254.1) : شما باید بررسی لازم بصورت منظم برای نسخه جدید انجام دهید. همچنین توضیحاتی در مورد ابزارهای dbsat_extract و dbsat_diff ارائه میدهد.
• Database Security Assessment Tool User Guide : این مستندات اصلی برای ابزار DBSAT است.
Prerequisites:
نیاز به zip , unzip و python برروی سرور:
yum install -y zip unzip python
بررسی پایتون نصب شده برروی سرور:
$ python -V
Python 2.7.5
$
بررسی zip و unzip نصب شده برروی سرور:
zip -v
unzip -v
اگر قصد اجرای discoverer را دارید نیاز به JAVA 8 JDK و انجام تنظیمات مربوط به متغییر JAVA_HOME میباشد:
export JAVA_HOME=/u01/jdk1.8.0_181
بمنظور اتصال به دیتابیس نیاز به دسترسیهای مناسب میباشد:
create user dbsat_user identified by dbsat_user;
— If Database Vault is enabled, connect as DV_ACCTMGR to run this command
grant create session to dbsat_user;
grant select_catalog_role to dbsat_user;
grant select on sys.registry$history to dbsat_user;
— 11g and 12c
grant select on sys.dba_users_with_defpwd to dbsat_user;
— 12c only
grant select on audsys.aud$unified to dbsat_user;
grant audit_viewer to dbsat_user;
— 12c covers sys.dba_priv_captures, sys.priv_capture$, sys.capture_run_log$
grant capture_admin to dbsat_user;
— If Database Vault is enabled, connect as DV_OWNER to run this command
grant DV_SECANALYST to dbsat_user;
استفاده از یوزرهایی با دسترسی DBA مورد قبول میباشد.
به عنوان مثال ایجاد کاربری با استفاده از دستور زیر کارساز نمیباشد:
CREATE USER test IDENTIFIED BY test DEFAULT TABLESPACE users QUOTA UNLIMITED ON users;
GRANT CREATE SESSION, CREATE TABLE, CREATE VIEW, CREATE SEQUENCE, CREATE PROCEDURE, CREATE TYPE, CREATE JOB, CREATE MATERIALIZED VIEW TO test;
Installation:
تنها کاری که نیاز است انجام شود، خارج کردن از حالت فشرده و ذخیره در سرور است:
mkdir -p /home/oracle/dbsat
unzip -o /tmp/dbsat.zip -d /home/oracle/dbsat
cd /home/oracle/dbsat
Basic Usage:
اجرای ابزار dbsat بدون هیچ پارامتری، روش استفاده را نمایش میدهد:
$ ./dbsat
Database Security Assessment Tool version 2.0.2 (May 2018)
Usage: dbsat collect [ -n ]
dbsat report [ -a ] [ -n ] [ -x
]
dbsat discover [ -n ] -c
Options:
-a Report about all user accounts, including locked,
Oracle-supplied users
-n No encryption for output
-x Specify sections to exclude from report (may be repeated for
multiple sections)
-c Configuration file for discoverer
$
همانطور که مشاهده میکنید، 3 عملکرد اصلی وجود دارد. (collect, report و discover)
Collect:
اجرای Collector اطلاعات را از پایگاهداده جمعآوری و یک فایل JSON حاوی تمام اطلاعات ایجاد میکند. Collector باید برروی سرور دیتابیس اجرا شود. ابتدا پسورد دیتابیس بمنظور اتصال به آن، و سپس پسورد برای محافظت از فایل zip ایجاد شده را وارد میکنیم. با استفاده از گزینه -n پسورد برای فایل zip ایجاد شده درخواست نمیشود:
$ ./dbsat collect dbsat_user@pdb1 pdb1_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
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 pdb1_output.json…
Enter password:
Verify password:
updating: pdb1_output.json (deflated 88%)
zip completed successfully.
$
Report:
Reporter فایل خروجی Collector را دریافت و آنرا به فایل HTMP , Excel , JSON و Text تبدیل میکند. نیازی به اجرای Reporter برروی سرور دیتابیس نمیباشد ولی از آنجا که باید Collector را برروی سرور دیتابیس اجرا کنیم، اجرای Reporter را هم برروی سرور انجام میدهیم. توجه داشته باشید که در اینجا از همان پیشوند نام فایل که برای Collector استفاده کردیم برای Reporter نیز استفاده میکنیم. پس از آن درخواست وارد کردن پسورد فایل zip اصلی و پسورد برای فایل zip جدید ارائه میشود:
$ ./dbsat report pdb1_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: pdb1_output.zip
[pdb1_output.zip] pdb1_output.json password:
inflating: pdb1_output.json
DBSAT Reporter ran successfully.
Calling /usr/bin/zip to encrypt the generated reports…
Enter password:
Verify password:
zip warning: pdb1_output_report.zip not found or empty
adding: pdb1_output_report.txt (deflated 78%)
adding: pdb1_output_report.html (deflated 84%)
adding: pdb1_output_report.xlsx (deflated 3%)
adding: pdb1_output_report.json (deflated 82%)
zip completed successfully.
$
با مشاهده به فایل HTML حاصله میتوانیم خلاصهای از یافتهها را ببینیم:
نتایج هر تست درخروجی، نشانهنده سطح ریسک است. در اینجا نمونهای از ریسک بالا (High Risk) نشان داده شده است:
Discover:
Discoverer اساسا یک ابزار مبتنی بر جاوا است که متکی به Collector و Reporter نمیباشد که دیتابیس را برای اطلاعات حساس بررسی میکند. در ابتدا نیاز به ایجاد یک فایل dbsat.config میباشد. شما میتوانید آنرا هر چیزی که میخواهید نامگذاری کنید:
cd /home/oracle/dbsat
cp Discover/conf/sample_dbsat.config Discover/conf/dbsat.config
سپس نسبت به ویرایش موارد فایل “Discover/conf/dbsat.config” اقدام میکنیم. در کمترین حالت نیاز به تنظیم مقادیر زیر میباشد:
[Database]
DB_HOSTNAME = localhost
DB_PORT = 1521
DB_SERVICE_NAME = pdb1
فایل “Discover/conf/sensitive_en.ini” شامل لیست دستهبندی از اطلاعات حساس و دارای الکوی مرتبط برای نام هر ستون میباشد. باید این فایل را بررسی و در صورت لزوم بخش ها یا الگوهای موردنیاز را اضافه کنیم.
پس از انجام تنظیمات میتوان Discoverer را اجرا و فایل کانفیگ و نام فایل خروجی را مشخص کرد. در این مرحله دسترسی برای اتصال به دیتابیس و پسورد برای فایل zip خروجی از شما خواسته میشود:
$ export JAVA_HOME=/u01/jdk1.8.0_181
$ ./dbsat discover -c ./Discover/conf/dbsat.config pdb1_discovery
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.
Enter username: dbsat_user
Enter password:
DBSAT Discover ran successfully.
Calling /usr/bin/zip to encrypt the generated reports…
Enter password:
Verify password:
zip warning: pdb1_discovery_report.zip not found or empty
adding: pdb1_discovery_discover.html (deflated 73%)
adding: pdb1_discovery_discover.csv (deflated 30%)
Zip completed successfully.
$