数据库的安全问题,一直是企业所关注的重要问题。在之前的文章中我们为大家介绍了Oracle Data Safe对本地和云端的数据库进行安全评估(Oracle Data Safe开始支持本地数据库Oracle Database 20c与DATA SAFE)。Data   Safe是Oracle公有云当中的一项云服务,有些客户因为多种原因,不能或不想让自己的数据库与公有云有任何的联系,但同时也想了解自己数据库的安全情况。您可以通过Oracle  Database Security Assessment  Tool这个只有4.5MB可以运行在本地的小工具对您的数据库进行安全评估以及敏感数据的识别。

今天我们就通过例子为大家讲解如何使用这个小工具对数据库进行安全评估。

1、DBSAT下载及解压

关注公众号,发送DBSAT 获取下载地址(需要MOS登录)。

今天使用的环境如下:

  • 操作系统:Oracle Enterprise Linux 7

  • 数据库:Oracle Database 19c (19.6) 单个实例环境

  • 容器数据库:ORCLCDB

  • 可插拔数据库:ORCLPDB1

下载之后,将这个dbsat.zip文件放入/u01下面:


[oracle@dbsat u01]# ls -lh --block-size=Mtotal 6M-rwxrwxrwx.  1 oracle    oracle       5M Apr  9 16:34 dbsat.zip

然后使用unzip将该文件进行解压。为了该程序能够正常运行,请确保安装了JDK并正确设定JAVA_HOME,同时安装了Python2.7以上的运行环境。


[oracle@dbsat u01]$ unzip dbsat.zip[oracle@dbsat u01]$ lsdbsat  dbsat.bat  dbsat.zip  Discover  sat_analysis.py  sat_collector.sql  sat_reporter.py  xlsxwriter

2、数据库信息收集

在dbsat解压路径下执行 ./dbsat collect system/oracle@localhost:1521/ORCLPDB1 /u01/196  其中system/oracle@localhost:1521/ORCLPDB1为连接数据库的字串,后面的/u01/196为稍后输出压缩文件的名字,系统会生成/u01/196.zip文件。在代码执行过程中,会被询问稍后输出zip文件的解压密码,大家设定一个安全密码即可。


[oracle@dbsat u01]$ ./dbsat collect system/oracle@localhost:1521/ORCLPDB1 /u01/196
Database Security Assessment Tool version 2.2.1 (May 2020)
This tool is intended to assist you in securing your Oracle databasesystem. You are solely responsible for your system and the effect andresults of the execution of this tool (including, without limitation,any damage or data loss). Further, the output generated by this tool mayinclude potentially sensitive system configuration data and informationthat could be used by a skilled attacker to penetrate your system. Youare solely responsible for ensuring that the output of this tool,including any generated reports, is handled in accordance with yourcompany's policies.
Connecting to the target Oracle database...

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Apr 10 05:17:27 2021Version 19.6.0.0.0
Copyright (c) 1982, 2019, Oracle.  All rights reserved.
Last Successful login time: Sat Apr 10 2021 05:16:35 +00:00
Connected to:Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - ProductionVersion 19.6.0.0.0
Setup complete.SQL queries complete.OS commands complete.Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - ProductionVersion 19.6.0.0.0DBSAT Collector completed successfully.
Calling /opt/oracle/product/19c/dbhome_1/bin/zip to encrypt 196.json...
Enter password:Verify password:adding: 196.json (deflated 86%)zip completed successfully.[oracle@dbsat u01]$

代码一般在一分钟内即可完成运行,如果您的数据库比较庞大,所需时间会相应增加。代码执行完毕,将生成文件196.zip


[oracle@dbsat u01]$ ls196.zip  dbsat  dbsat.bat  dbsat.zip  Discover  sat_analysis.py  sat_collector.sql  sat_reporter.py  xlsxwriter


3、生成检查报告

对于刚才生成的zip文件,我们可以将它变成方便阅读的报告,这些报告提供多种格式供大家选择。需要注意的是,我们在使用./dbsat   report的时候,后面给出的路径要与上面的信息采集时给出的路径相同,比如上面给出的是/u01/196,这里也要给出相同的信息,脚本将去访问/u01/196.zip文件。在访问时,需要给出在上一步设定的密码。

生成报告时,也会要求大家为这个报告文件设定密码。


[oracle@dbsat u01]$ ./dbsat report /u01/196
Database Security Assessment Tool version 2.2.1 (May 2020)
This tool is intended to assist you in securing your Oracle databasesystem. You are solely responsible for your system and the effect andresults of the execution of this tool (including, without limitation,any damage or data loss). Further, the output generated by this tool mayinclude potentially sensitive system configuration data and informationthat could be used by a skilled attacker to penetrate your system. Youare solely responsible for ensuring that the output of this tool,including any generated reports, is handled in accordance with yourcompany's policies.
Archive:  196.zip[196.zip] 196.json password:inflating: 196.jsonDBSAT Reporter ran successfully.
Calling /usr/bin/zip to encrypt the generated reports...
Enter password:Verify password:zip warning: 196_report.zip not found or emptyadding: 196_report.txt (deflated 77%)adding: 196_report.html (deflated 83%)adding: 196_report.xlsx (deflated 3%)adding: 196_report.json (deflated 81%)zip completed successfully.

我们可以将这个报告文件下载到本地进行阅读,解压文件时,需要输入上一步设定的密码。



我们查看一下html格式的报告。在报告中可以显示当前数据库的基本信息以及安全风险。





4、侦测数据库中的敏感信息

在为开发人员提供测试数据库时,总是担心将含有敏感信息的数据提供出去。但因为现在数据库一般比较庞大、数据表的结构复杂,工作人员在编写数据表说明文档时难免存在疏漏,于是对数据库中敏感信息的检查变得非常棘手。现在,我们可以通过DBSAT轻松解决这个问题。

使用DBSAT的“发现”功能,只需要做简单的配置即可对数据库进行数据敏感性检查。

这里将使用到两个文件:

  • 配置文件:例如196.config,这个文件对连接的数据库及下面要用到的敏感信息说明文件的位置进行配置。压缩包中已经为大家提供了模板,大家只要对该模板简单修改就可以,该模板的位置为DBSAT解压路径下的Discover/conf/sample_dbsat.config,我们将它复制为196.config,修改196.config中如下信息:

     DB_SERVICE_NAME =ORCLPDB1

    SENSITIVE_PATTERN_FILES = 196.ini

  • 敏感信息说明文件:例如196.ini,这个文件也可以通过模板来创建,比如:cp  sensitive_en.ini  196.ini。这个文件当中指定了对怎样的信息进行检查,并且设定风险级别。比如,我们将个人地址信息设定为高风险,将个人姓名信息设定为中等风险等等。现在直接将sensitive_en.ini文件复制为196.ini,并不对其中的内容进行修改,如果大家感兴趣,可以对里面的内容进行调整,告诉系统怎样的信息是敏感的。


在执行“发现”时,我们要给出配置文件的路径以及要被检查的数据库服务名,在脚本运行期间,需要提供连接数据库的用户名和密码,比如我们给出system用户的相关信息。最后,检查报告生成时,也会要求大家提供解压报告文件的密码确保安全。


[oracle@dbsat u01]$  ./dbsat discover -c Discover/conf/196.config orclpdb1
Database Security Assessment Tool version 2.2.1 (May 2020)
This tool is intended to assist you in securing your Oracle databasesystem. You are solely responsible for your system and the effect andresults of the execution of this tool (including, without limitation,any damage or data loss). Further, the output generated by this tool mayinclude potentially sensitive system configuration data and informationthat could be used by a skilled attacker to penetrate your system. Youare solely responsible for ensuring that the output of this tool,including any generated reports, is handled in accordance with yourcompany's policies.
Enter username: systemEnter password:DBSAT Discover ran successfully.Calling /usr/bin/zip to encrypt the generated reports...
Enter password:Verify password:zip warning: orclpdb1_report.zip not found or emptyadding: orclpdb1_discover.html (deflated 82%)adding: orclpdb1_discover.csv (deflated 74%)Zip completed successfully.[oracle@dbsat u01]$

接下来,我们看看我们的数据库中是否包含敏感信息。将生成的orclpdb1_report.zip下载到本地,并利用刚才设定的密码打开这个压缩文件。里面有2个文件,一个是html的,一个是csv的。我们看看html文件中的内容。




通过观察,我们发现按照默认的敏感信息配置文件来检查,找到14个表当中43个字段940行信息包含敏感数据。您可以使用Oracle的数据遮蔽及相关技术对这些敏感信息进行处理。



©著作权归作者所有:来自51CTO博客作者mob604756ec7b7c的原创作品,如需转载,请注明出处,否则将追究法律责任

更多相关文章

  1. 简述MySQL提供的可执行程序
  2. Oracle数据库安全管理
  3. mysql必知必会第一节
  4. 【体系结构】有关Oracle SCN知识点的整理--补充内容
  5. windows从linux拷贝下载文件的两种方式
  6. Oracle dblink介绍
  7. java解压压缩包工具类
  8. python异常处理
  9. DenyHosts阻止SSH暴力***

随机推荐

  1. Find常用语法
  2. 用原生 JavaScript 实现十大 jQuery 函数
  3. 怎样通过读源码提高你的 JavaScript 知识
  4. Mount挂载
  5. 用纯 JavaScript 撸一个 MVC 框架[每日前
  6. Node.js 12中的ES模块[每日前端夜话0x9E]
  7. 那些最受欢迎的 Node.js 视图引擎[每日前
  8. 人生第一次写博客,就先当作日记写了
  9. Node.js 事件循环完整指南[每日前端夜话0
  10. JavaScript 进阶问题列表[每日前端夜话0x