You are now on my old blog. Please update your bookmarks to my new blog
http://laurentschneider.com




28 December 2005

lock system, restrict dbsnmp

An unlocked user is a security problem. Currently, all my unlocked users have only CREATE SESSION as system privilege, evtl ALTER SESSION.

Except SYS, SYSTEM and DBSNMP

To minimize this security problem, I implemented the following strategy on my test system.

1) delete password file, set remote_login_passwordfile=NONE, O7_DICTIONARY_ACCESSIBILITY=FALSE
2) alter user SYSTEM account lock;
3a) in 10gR2 :
alter user dbsnmp quota 1T on sysaux;
create role secure_oem_role;
grant advisor, analyze any, analyze any dictionary, create job, create procedure, create session, create table, manage any queue, select any dictionary to secure_oem_role;
grant EXECUTE on "SYS"."DBMS_AQ" to secure_oem_role;
grant EXECUTE on "SYS"."DBMS_AQADM" to secure_oem_role;
grant EXECUTE on "SYS"."DBMS_DRS" to secure_oem_role;
grant EXECUTE on "SYS"."DBMS_MONITOR" to secure_oem_role;
grant EXECUTE on "SYS"."DBMS_SERVER_ALERT" to secure_oem_role;
grant EXECUTE on "SYS"."DBMS_SYSTEM" to secure_oem_role;
grant EXECUTE on "SYS"."DBMS_WORKLOAD_REPOSITORY" to secure_oem_role;
exec SYS.DBMS_AQADM.GRANT_QUEUE_PRIVILEGE('DEQUEUE','ALERT_QUE','SECURE_OEM_ROLE')
revoke EXECUTE ON "SYS"."DBMS_SERVER_ALERT" from dbsnmp;
revoke EXECUTE ON "SYS"."DBMS_SYSTEM" from dbsnmp;
revoke UNLIMITED TABLESPACE from dbsnmp;
revoke SELECT ANY DICTIONARY from dbsnmp;
revoke CREATE PROCEDURE from dbsnmp;
revoke CREATE TABLE from dbsnmp;
revoke OEM_MONITOR from dbsnmp;
grant secure_oem_role to dbsnmp;
3b) in other versions, you probably can remove more and grant less, I think only in 10g it is necessary to have "quota". In my other databases, dbsnmp have 0 segments.

Check what system privileges are potentially dangerous to the system :

select path
from
(
select
grantee,
sys_connect_by_path(privilege, ':')||':'||grantee path
from (select grantee, privilege, 0 role from dba_sys_privs union all select grantee, granted_role, 1 role from dba_role_privs)
connect by privilege=prior grantee
start with role=0
)
where
grantee in (
select username from dba_users
where lock_date is null
and password != 'EXTERNAL'
and username != 'SYS')
or grantee='PUBLIC'
/
:ADVISOR:SECURE_OEM_ROLE:DBSNMP
:ANALYZE ANY:SECURE_OEM_ROLE:DBSNMP
:ANALYZE ANY DICTIONARY:SECURE_OEM_ROLE:DBSNMP
:CREATE JOB:SECURE_OEM_ROLE:DBSNMP
:CREATE PROCEDURE:SECURE_OEM_ROLE:DBSNMP
:CREATE SESSION:USER1
:CREATE SESSION:USER2
:CREATE SESSION:SECURE_OEM_ROLE:DBSNMP
:CREATE TABLE:SECURE_OEM_ROLE:DBSNMP
:MANAGE ANY QUEUE:SECURE_OEM_ROLE:DBSNMP
:SELECT ANY DICTIONARY:SECURE_OEM_ROLE:DBSNMP

it sounds better...

3 Comments:

Blogger Laurent Schneider said...

that's why I said "eventually" alter session.

if you have a ulimit, you should get an ORA-4030.

28/12/05 18:50  
Anonymous Anonymous said...

good morning,

I believe that it is not so easy to get an Oracle system "user-proof", where by accident or will a user can not get the instance to slow down dramatically.

We have recently worked quite a lot on resource manager and I believe that it can help quite a lot (in addition to PGA strong limit for example through event 10261).

have a very nice end of year,
eric

29/12/05 09:10  
Blogger Laurent Schneider said...

> We have recently worked quite a lot on resource manager and I believe
> that it can help quite a lot
good hint! I should invest some time in it too

> I don't know if the ulimited command can also prevent the SGA to allocate
> memory, because the shared memory doesn't belongs to a certain process
well, you can set ulimits to the oracle owner...

have a nice 2006

29/12/05 18:12  

Post a Comment

<< Home