zoukankan      html  css  js  c++  java
  • Managing Privileges

    image

    System : 一些特定的数据库动作,和具体的object 没有关系

    object : 和具体的 object 有关系,操作或访问该对象等等。

    image

    System privileges

    image

    System Privileges:

    The privileges can be classified as follows:

    • Privileges enabling system wide operations: for example create session, create tablespace
    • Privileges enabling management of objects in a user’s own schema; for example, create table
    • Privileges enbaling management of objects in any scnema; for example create any table

    Privileges can be controlled with the DDL commands GRANT and REVOKE (这两个命令是 DDL 的)


    image

    image

    image

    image

    image

    image

    select any table 这个权限,也不能去查看数据字典的内容,在 oracle 7 以前是可以的。

    image

    image

    show parameter o7 , 可以看到相应的内容是 false, 如果调整成 true的话,那么select any table权限就可以访问数据字典了。

    o7_DICTIONARY_ACCESSIBILITY ( 以上 o7 的全称 ) ( 默认是 false )

    REVOKE CREATE TABLE FROM emi ; ( SYSTEM PRIVILEGE 是不能够 级联撤销的 ) 换句话说, A 将系统权限给B, B又将系统权限给C, 这时, A撤销了B的系统权限, 但是此时C还是有该系统权限. 除非显示的将C的系统权限另外撤销.

    小心 hacker ( 黑客 )

    TOM 大师说了。只要有 create session,  权限,再加上 CREATE ANY PROCEDURE, EXECUTE ANY PROCEDURE 就可以做任何事

    例如 : procedure

       1:  CREATE PROCEDURE system.h1( h1_str in varchar2 ) as
       2:  begin
       3:  execute immediate h1_str;
       4:  end;
       5:  /

    这样,你传递给这个 procedure 什么参数,这个 procedure 就会执行什么

    execute system.h1( ‘grant dba to hacker’);   // hacker 是个用户

    因为这个procedure 是创建在 system 这个用户下,而 system 这个用户也有分配 dba 的权限。

    image

    image

    with admin option 不要轻易使用,因为撤消时,不能级连撤消

    image

    Object privileges

    image

    image

    image

    image

    image

    case constraints : 是级联约束一起撤销.(比如一个表创建了check 约束)

    object privilege 撤消 ( revoke ) 也具有传递性,但是,system privilege 撤消不具备传递性

    image

    image

    image

    DBA_SYS_PRIVS  lists system privileges granted to users and roles

    SESSION_PRIVS  lists the priveleges that are currently available to the user

    DBA_TAB_PRIVS  lists all grants on all objects in the database

    DBA_COL_PRIVS  decribes all object column grants in the database

    session_privs , 这个 session_privs 所对应的系统特权

    Auditing( 审计 )

    image

    • Auditing is the monitoring of selected user database actions
    • Used to
      • Investigate suspicious database activity
      • Gather information about specific database activities

    对 特定用户对数据库操作行为的监控

    - 用户在数据库里做了什么事

    - 搜集特定的数据库里的信息

    分两种 ( session , access )

    session : 同类型的语句只记录一条

    access  : 所有的语句都要记录

    Auditing Guidelines

    Pestrict auditing by first identifying the auditing requirements, and setting minimal auditing options that will cater to the requirements. Object auditing must be used where possible to reduce the number of entries generated. If statement or privilege auditing needs to be used, the following setting can minimize audit generation:

    image

    类型

    - 标准审计,最常见,对特定的SQL语句,privileges, schemas, objects, network . 记录在 SYS.AUD$ system table. 或者 Operation system file. ( 重点 )

    - 细粒度审计, 比如申请某个 SQL statment 并且指定了 where,更进一步限制审计条件。记录在 SYS.FGA_LOG$

    - Administrator auditing. 数据库管理员进行审计。记录 syslog audit trail. 类似操作系统文件。(只有操作系统管理员可以看到内容 )

    • Define what you want to audit
      • Audit users, statements, or objects
      • Statement executions
      • Successful statement executions, unsuccessful statement executions or both
    • Manage your audit trail ( 审计结果记录 )
      • Monitor the growth of the audit trail ( 记录会越来越多 )
      • Protect the audit trail from unauthorized access ( 哪些用户可以看 )

    分类:

    image

    不管 oracle 是否启动了审计功能, oracle 总是记录一些数据库的操作在 audit trail. 以下操作会被记录: instance startup, instance shutdown, Administrator privileges.

    If an unauthorized user is deleting data, the DBA might decide to audit all connections to the database and all successful and unsuccessful deletions from all tables in the database. The DBA can gather statistics about which tables are being updated, how many logical I/O are performed, and how many concurrent users connect at peak times

    image

    首先要设置是否需要审计功能, 参数 AUDIT_TRAIL 是用来设置的, 如果这个参数值是 none, 那么就关闭审计功能, 如果是DB那么就是将审计内容放到数据库保存, 如果是os 就是放到操作系统保存.

    0. 首先开启还是关闭审计功能. AUDIT_TRAIL 参数.

    1. DBA 设置 Audit options, 准备, 设置一些参数

    2. 执行 auditting 命令, 等待, 如果用户连接上 database, 就可以执行审计

    3. 某个用户 Execute command ( 已经被审计 )

    4. 将审计结果返回给 DBA

    Enabling and Disbaling Database Auditing

    AUDIT_TRAIL ( initialization parameter to enable auditing for the instance )

    AUDIT_TRAIL = value ( value 可以是 DB, OS, NONE 这个是默认值即 disable )

    image

    image

    audit session by u1 ( u1 是一个用户 )

    noaudit 可以撤销审计命令. noaudit session by u1

    image

    Fine-Grained Auditing: 就是利用 DBMS_FGA 包(oracle提供)来进行审计的设置. 支持 database access based on content.

    image

    image

    数据字典

    image

    以下是查看审计后的结果:

    image

  • 相关阅读:
    当在服务器或者云端发布程序的时候,注意事项
    Oracle 在使用pivot时,注意事项
    当采用datagrid自带的方法加载列表时,当在后台遇到错误时,如何在前台提示错误
    Oracle 在分组的同时,取每个分组的前几条PARTITION BY
    带有res资源文件的项目 需要导成jar包 供别人使用的解决方法
    java乱码问题
    网络通信框架Volley使用详细说明
    深刻的理解Fragment生命周期 都在做什么,fragment生命周期
    ScrollView中嵌套ListView时,listview高度显示的问题
    关于一个app中数据库的问题
  • 原文地址:https://www.cnblogs.com/moveofgod/p/2862358.html
Copyright © 2011-2022 走看看