DBS Unit 2 Notes
DBS Unit 2 Notes
2.1
Unit – II Notes
2.2
SYLLABUS
UNIT II : ADMINISTRATION OF USERS & PROFILES, PASSWORD POLICIES, PRIVILEGES
AND ROLES
Administration of Users: Introduction, Authentication, Creating Users; SQL Server: User
Removing: Modifying Users, Default Users, Remote Users; Database Links - Linked Servers -
Remote Servers; Practices for Administrators and Managers: Best Practices
Profiles, Password Policies, Privileges and Roles: Introduction - Defining and Using Profiles -
Designing and Implementing Password Policies - Granting and Revoking User Privileges -
Creating, Assigning and Revoking User Roles- Best Practices
2.3
A detailed document should describe guidelines for every task that is required for all common administrative
situations.
2. Security Procedures:
This is an outline of a step-by-step process for performing administrative task according to company
policies.
3. Procedures implementation scripts and programs:
This is documentation of any script or program used to perform an administrative task. This includes user’s
manual and operational manual
4. Predefined roles description:
This provides the full description of all predefined roles, outlining all tasks for which the role is
responsible and the role’s relationship to other roles
5. Administration staff and management:
This is usually a detailed description of each administration staff and management position. This
document includes an organizational chart.
Many companies develop procedures and forms used to perform any security-related process. The following figure
presents a sample process of creating a database user account that you can customize per your business requirements
and company policies.
Document Completion DBA Completes all the paper work and documentation for new employees
DBA provides list of access operations that are necessary for employees to
Access Identification
perform their jobs
2.4
Operating System Authentication:
What?
When a computer user wants to log into a computer system, the operating system (OS) installed on that
computer system generally wants to determine or check who the user is.
OS – Gateway to DB Access
Many DBMS depends on OS to authenticate users.
5 Common Authentication Types:
• Password-based authentication. Passwords are the most common methods of authentication.
• Multi-factor authentication.
• Certificate-based authentication.
• Biometric authentication.
• Token-based authentication.
How OS authenticate users?
Authentication. Username / Password − User need to enter a registered username and password with
Operating system to login into the system. User card/key − User need to punch card in card slot, or enter
key generated by key generator in option provided by operating system to login into the system.
Why DB vendors rely on OS for user authentication and bypass authentication?
Once intruder gets control of OS, it takes very little knowledge or effort to access the DB.
CREATING USERS:
Creating users is one of the main tasks you will perform as a database operator or DBA.
In most organization, this process is standardized, well documented, and surely managed.
The DBA had written a script to create a user for every developer working on the project.
This script granted privileges to read and write data to the database scheme.
Regardless of the database you use, creating the user is generally an easy task once a policy is documented and
followed:
2.5
Creating an ORACLE 10g User:
CREATING USERS:
User:
Specify the name of the user to be created. This name can contain only characters from your
database character set and must follow the rules described in the section "Schema Object
Naming Rules". Oracle recommends that the user name contain at least one single-byte
character regardless of whether the database character set also contains multi-byte
characters.
IDENTIFIED Clause:
The IDENTIFIED clause lets you indicate how Oracle Database authenticates the user.
BY password:
The BY password clause lets you creates a local user and indicates that the user must specify password to
log on to the database. Passwords are case sensitive. Any subsequent CONNECT string used to connect
this user to the database must specify the password using the same case (upper, lower, or
mixed) that is used in this CREATE USER statement or a subsequent ALTER USER statement.
Passwords can contain any single-byte, multi-byte, or special characters, or any combination of these,
from your database character set.
EXTERNALLY Clause:
Specify EXTERNALLY to create an external user. Such a user must be authenticated by an external service,
such as an operating system or a third-party service. In this case, Oracle Database relies on authentication
by the operating system or third-party service to ensure that a specific external user has access to a specific
database user.
AS 'certificate_DN':
2.6
This clause is required for and used for SSL-authenticated external users only. The certificate_DN
is the distinguished name in the user's PKI certificate in the user's wallet.
GLOBALLY Clause:
The GLOBALLY clause lets you create a global user. Such a user must be authorized by the
enterprise directory service (Oracle Internet Directory).
DEFAULT table space Clause:
Specify the default table space for objects that the user creates. If you omit this clause, then the
user's objects are stored in the database default table space. If no default table space has been specified for
the database, then the user's objects are stored in the SYSTEM table space.
Restriction on Default Table spaces: You cannot specify a locally managed temporary table space, including an
undo table space, or a dictionary-managed temporary table space, as a user’s default table space.
TEMPORARY table space Clause:
Specify the table space or table space group for the user's temporary segments. If you omit this
clause, then the user's temporary segments are stored in the database default temporary table space or, if
none has been specified, in the SYSTEM table space.
Specify table space to indicate the user's temporary table space.
Specify table space_group_name to indicate that the user can save temporary segments in any table space in
the table space group specified by table space_group_name.
Restrictions on Temporary table space: This clause is subject to the following restrictions: The table space must be
a temporary table space and must have a standard block size.
The table space cannot be an undo table space or a table space with automatic segment-space management.
QUOTA Clause:
Use the QUOTA clause to specify the maximum amount of space the user can allocate in the table space.
A CREATE USER statement can have multiple QUOTA clauses for multiple table spaces.
UNLIMITED lets the user allocate space in the table space without bound.
Restriction on the QUOTA Clause You cannot specify this clause for a temporary table space.
PASSWORD EXPIRE Clause:
Specify PASSWORD EXPIRE if you want the user's password to expire. This setting forces the user or the
DBA to change the password before the user can log in to the database.
ACCOUNT Clause:
Specify ACCOUNT LOCK to lock the user's account and disable access. Specify ACCOUNT
UNLOCK to unlock the user's account and enable access to the account.
Syntax to create the user:
CREATE USER username IDENTIFIED {BY Password l Externally l Globally As ‘external name’}
[DEFAULT tablespace table space]
[TEMPORARY table space {tablespace l table space_group_name}]
[QUOTA {integer{K l M} ON tablespace l Unlimited]
[PROFILE profile]
[PASSWORD EXPIRE]
[ACCOUNT {LOCK l UNLOCK} ]
2.7
Example:
The following create user statement implements the creation of user called shalom
SQL> CREATE USER shalom IDENTIFIED BY shalom23
DEFAULT tablespace users
TEMPORARY tablespace temp
QUOTA 25M ON users
PROFILE default
PASSWORD EXPIRE
ACCOUNT UNLOCK
/
User created
Once the user is created you can modify a user account with an ALTER USER statement using clause listed in the
previous example
Creating an ORACLE 10g User using Database Authentication:
The graphical interface of Oracle Enterprise Manager also provides a function for creating a user. This function is
called Security Management.
1. Select User node under the Security function and Click Create button on toolbar.
2. Create User dialog box appears – Enter user account details.
3. Click OK button.
The user is created and a message is displayed confirming successful creation of a user.
Creating an ORACLE 10g User using External Authentication:
1. The windows operating system account that you want Oracle 10g to use for external authentication must
belong to ORA_DBA group. It can be verified by using Computer Management tool under Administrative
tools in Control Panel. In this case, you are using an operating system account called EXTERNAL_USER.
2. You must set the Windows registry string OSAUTH_PREFIX_DOMAIN to FALSE. To locate this parameter,
navigate to HKEY_LOCAL_MACHINE. SOFTWARE, ORACLE, HOME1 where HOME1 is the home of
Oracle10g.
If this parameter does not exist, create one.
Right click in detail pane -> Click New -> Click String Value on context menu -> Enter new parameter.
3. View the setting of OS_AUTHENT_PREFIX initialization parameter. The Default Value is OPS$.
View the value:
SQL> SHOW PARAMETER
PREFIX NAME TYPE VALUE
os_authent_prefix string OPS$
4. Change the OS_AUTHENT_PREFIX initialization parameter value to NULL in the spfile or parameter
file(pfile).
os_authent_prefix = ‘ ‘
5. Now, create an Oracle user, EXTERNAL_USER, with the same user name as the Windows user name that is
used for external_authentication.
2.8
SQL> CREATE USER EXTERNAL_USER IDENTIFIED EXTERNALLY;
User Created.
DBA_USERS VIEW:
DBA_USERS describes all users of the database.
Column Datatype NULL Description
USER NAME VARCHAR2(30) NOT NULL Name of the user
USER_ID NUMBER NOT NULL ID number of the user
PASSWORD VARCHAR2(30) This column is deprecated in favor of the
AUTHENTICATION_TYPE column
ACCOUNT_ VARCHAR2(32) NOT NULL Account status:
STATUS OPEN
EXPIRED
EXPIRED(GRACE)
LOCKED(TIMED)
LOCKED
EXPIRED & LOCKED(TIMED)
EXPIRED(GRACE) & LOCKED(TIMED)
EXPIRED & LOCKED
EXPIRED(GRACE) & LOCKED
2.9
LOCK_DATE DATE Date the account was locked if accountstatus was
LOCKED
EXPIRY_DATE DATE Date of expiration of the account
DEFAULT_ table VARCHAR2(30) NOT NULL Default table space for data
space
TEMPORARY_ table VARCHAR2(30) NOT NULL Name of the default table space for temporary tables or
space the name of a table space group
CREATED DATE NOT NULL User creation date
PROFILE VARCHAR2(30) NOT NULL User resource profile name
INITIAL_RSRC VARCHAR2(30) Initial resource consumer group for the user
_CONSUMER_
GROUP
EXTERNAL_NAME VARCHAR2(4000) User external name
PASSWORD_ VARCHAR2(8) Database version in which the password was created or
VERSIONS changed
EDITIONS_ VARCHAR2(1) Indicates whether editions have been enabled for the
ENABLED corresponding user (Y) or not (N)
AUTHENTICATI VARCHAR2(8) Indicates the authentication mechanism for the
ON_TYPE user: EXTERNAL - CREATE
USER user1 IDENTIFIED EXTERNALLY;
GLOBAL - CREATE
USER user2 IDENTIFIED GLOBALLY;
PASSWORD - CREATE
USER user3 IDENTIFIED BY user3;
The login syntax is the fully qualified name of the Windows user account in the form of
machine_name\user_name for local Windows users.
domain\username for Windows domain accounts.
Windows integrated login can also be associated can also be associated with windows groups on either the local
server or domain
For example,
If you have a local windows account named ‘shalom’ on the SQL Server itself where
2.9
exec sp_grantlogin ‘myserver\shalom’
the server name is myserver, you enter the following:
For windows domain account named ‘charish’ in the mydomain, you are entering the
following:
NOTE : A login must be between 1 to 128 characters in length and cannot contain any spaces.
To create a new login associated with a Windows account (Windows Integrated) in Enterprise Manager,take the
following steps:
5. Click Logins.
2.10
7. Type the name of user.
8. Depending on the type of Windows account you are creating , select either the local server name
or the domain name from the domain drop-down list. Enterprise Manager automatically fills in
the machine or domain name in front of the username.
9. Select the default database for the login from the Database drop-down list.
10. Select the default language for the login from the language drop-down list.
11. Click OK.
To create a SQL Server login from the Query analyzer , you use the SP_ADDLOGIN system stored procedure.
The syntax is as follows :
2.11
@loginame – choose for the login.
@defdb – Name of the default database for the user. The default is NULL.
@deflanguage – The default language for the user. The default is the current default language of the SQL Server
Instance.
@sid – Security Identification Number (SID). The default is NULL, if it is NULL SQL Server automatically
generates SID for the login.
@encryptopt – Specifies whether or not to encrypt the password in the database.
For example,
To create a SQL Server login named ‘shalom’ with password ‘shalom23’you issue the following command
2.12
REMOVING USERS:
Dropping a user is simple.
2.13
From the Enterprise Manager:
To drop the login in Enterprise Manager simply highlight the desired login and choose delete from the action
menu.
Modifying Users:
Modification can involve changing a password& its profile, locking an account, or increasing a storage quota,
database, table space, account by the DBA.
Modifying an Oracle User:
Using SQL *Plus you can issue an ALTER USER statement as shown below:
SQL > ALTER USER SCOTT IDENTIFIED BY LION;
User Altered
Using Oracle Enterprise Manager, the default table space for the SCOTT account can be changed from USERS to
EXAMPLES.
Modifying SQL Server:
Modifying Windows Integrated Login Attributes:
From the Command Line:
The default database for the user initially set to master, to change the database SP_DEFAULTDB system stored
procedure is used.
sp_default [ @loginame = ] ‘login’ ,[ @defdb =] ‘database’
To change the default database to the login mydomain\shalom , issue the following statement
exec sp_defaultdb ‘mydomain \shalom’ ,’Northwind’
DEFAULT USERS:
ORACLE default users, will be created at the time of ORACLE software installation.
SQL server default users, will be created at the time of SQL Server software installation
REMOTE USERS:
All the DB user accounts are created and stored in the DB regardless of
whether they are connected locally or remotely.
When a user logs on to the DB through the machine where the DB is located , called as Local user.
When a user logs on to the DB through the machine where the DB is not located , called as remote user.
2.14
SQL Server does not support this type of remote user authentication.
DATABASE LINKS:
Both be ORACLE10g
A DB link enables a user to perform Data Manipulation Language (DML) or any other valid SQL statements on a DB.
Authentication Methods: Authentication methods for connecting ORACLE10g DB using DB link mechanism.
2.15
Authentication Method 2: FIXED USER
This authentication method orders ORACLE10g to use the user password provided in this clause for
authentication to the DB to which the user is trying to link.
LINKED SERVERS:
Microsoft SQL Server 2000 also uses the concept of linked servers.
Linked servers allow you to connect to almost any object Linking Embedding Database (OLEDB) or Open Database
Connectivity(ODBC) .
OLEDB is a Microsoft component that allows Windows applications to connect and access different database systems.
ODBC is a Microsoft protocol used for connecting Windows applications to different DB systems
The following figure represents the Linked server architecture using SQLServer
Linked Server
2.16
Creating a new linked server with SQL Server:
Remote Server:
Along the same line as Linked Servers, you can communicate with another SQL server by creating remote server.
Instead of using OLEDB, communications occurs across a Remote Procedure Call (RPC).
DBA is constantly performing other administrative tasks such as backup, recovery and
performance tuning.
To make wise decisions DBA have the sizable responsibility of keeping up with database
practices, database technology and database security issues.
These are the best practices for administrating users, privileges, and roles.
2.17
Keep abreast (up-to date) of database and security technology. Should be aware of all
new vulnerabilities that may increase database security risks.
Constantly review and modify the procedures as necessary to be in line up with the company’s
policies and procedures. Keep procedures up to date with the dynamic nature of database and
security technology.
PROFILES,PASSWORD POLICIES, PRIVILEGES AND ROLES
Introduction:
The key to the house is the password
Put the scenario into the context of computer passwords.
For home security, in addition to changing the key, you might install an alarm, motion detector, camera, etc.,
A company’s user accounts should have equal protection.
The company needs to protect its assets and enforce stringent (strict, precise, and exacting) guidelines to
protect the keys to computer accounts.
This key is the password
DEFINING AND USING PROFILES:
A profile is a security concept that describes the limitation of database resources that are granted database uses.
- A profile is a way of defining database user behaviour to prevent users from wasting resources such as memory
and CPU consumption
- For this reason, some DBMS s have implemented the profile concept.
- Not every DBMS offers profile concept.
ORACLE does and Microsoft SQL Server 2000 doesn’t.
Restrictions on Resources
PROFILE
PASSWORD RESOURCES
CPU
Aging
Usage Memory
Verification Connections
2.18
ORACLE allows you to create a profile using the CREATE PROFILE statement.
The full syntax of the statement follows:
Create Profile:
2.19
In this syntax:
First, specify the name of the profile that you want to create.
Second, specify the LIMIT on either database resources or password
Resource Parameters:
SESSIONS_PER_USER – specify the number of concurrent sessions that a user can have when connecting to
the Oracle database.
CPU_PER_SESSION – specify the CPU time limit for a user session, represented in hundredth of seconds.
CPU_PER_CALL – specify the CPU time limit for a call such as a parse, execute, or fetch, expressed in
hundredths of seconds.
CONNECT_TIME – specify the total elapsed time limit for a user session, expressed in minutes.
IDLE_TIME – specify the number of minutes allowed periods of continuous inactive time during a user
session. Note that the long-running queries and other operations will not subject to this limit.
LOGICAL_READS_PER_SESSION – specify the allowed number of data blocks read in a user session,
including blocks read from both memory and disk.
LOGICAL_READS_PER_CALL – specify the allowed number of data blocks read for a call to process a SQL
statement.
PRIVATE_SGA – specify the amount of private memory space that a session can allocate in the shared pool
of the system global area (SGA).
COMPOSITE_LIMIT – specify the total resource cost for a session, expressed in service units. The total
service units are calculated as a weighted sum of CPU_PER_SESSION CONNECT_TIME,
LOGICAL_READS_PER_SESSION,
Password_Parameters:
You use the following clauses to set the limits for password parameters:
PASSWORD_LIFE_TIME – specify the number of days that a user can use the same
password for authentication. The default value is 180 days.
PASSWORD_REUSE_TIME – specify the number of days before a user can reuse a password.
PASSWORD_LOCK_TIME – specify the number of days that Oracle will lock an account after a
specified number of a consecutive failed login. The default is 1 day if you omit this clause.
PASSWORD_GRACE_TIME – specify the number of days after the grace period starts during which a
warning is issued and login is allowed. The default is 7 days when you omit this clause.
Note that to create a new profile, your user needs to have the CREATE PROFILE system privilege.
2.20
Setting Profile Resourc e Limits: Example
The following statement creates the profile app_user:
SQL> CREATE PROFILE app_user2
LIMIT
SESSIONS_PER_USER UNLIMITED
CPU_PER_SESSION UNLIMITED
CPU_PER_CALL 3000
CONNECT_TIME 45
IDLE_TIME 15
LOGICAL_READS_PER_SESSION DEFAULT
LOGICAL_READS_PER_C ALL 1000
PRIVATE_SGA 15K
COMPOSITE_LIMIT 5000000;
/
Profile created
To view all profiles created in the database, query the data dictionary view, DBA_P ROFILES
16 rows selected.
2.21
LIMIT IDLE_TIME 30;
Profile altered
To assign a profile, use ALTER USER as follows:
SQL> ALTER USER SHALOM PROFILE APP_USER
/
User altered
2.22
ORACLE has invested heavily in providing mechanism to enforce security , including implementation of password
policies.
Whereas a Microsoft SQL Server depends on the OS to implement password policies.
Password Policies in ORACLE:
CREATE PROFILE PASSWORD _POLICYLIMIT
{{
|PASSWORD_LIFE_TIME 365
|PASSWORD_GRACE_TIME 10
|PASSWORD_REUSE_TIME UNLIMITED
|PASSWORD_REUSE_MAX 0
|FAILED_LOGIN_ATTEMPTS 3
|PASSWORD_LOCK_TIME UNLIMITED;
}
{ expr | UNLIMITED | DEFAULT }
|PASSWORD_VERYFY_FUNCTION
{function | NULL | DEFAULT }
}
Oracle password security profile parameters
Here are the password security parameters:
failed_login_attempts - This is the number of failed login attempts before locking the Oracle user account. The
default in 11g is 10 failed attempts.
password_grace_time - This is the grace period after the password_life_time limit is exceeded.
password_life_time - This is how long an existing password is valid. The default in 11g forces a password
change every 180 days.
password_lock_time - This is the number of days that must pass after an account is locked before it is
unlocked. It specifies how long to lock the account after the failed login attempts is met. The default in 11gis one day.
password_reuse_max - This is the number of times that you may reuse a password and is intended to prevent
repeating password cycles (north, south,east, west).
password_reuse_time - This parameter specifies a time limit before a previous password can be re-entered. To allow
unlimited use of previously used passwords, set password_reuse_time to UNLIMITED.
password_verify_function - This allows you to specify the name of a custom password verification function.
Profile creation using ORACLE Enterprise Manager Security Tools:
2.23
Password Policies in SQL Server:
Microsoft SQL Server 2000 as a stand-alone product, does not provide for password policy enforcement when
logging on a SQL Server.
Microsoft architecture follows a model known as an Integrated Server System.
In this method all the server applications and the resources they provide are tightly integrated with the Windows
server system and its security architecture.
Password policy enforcement in a SQL Server environment handled by implementing SQL server in Windows
authentication mode and applying polices within the Windows Server System
There are two authentication protocols supported by Windows
NTLM (Network LAN Manager)
Kerberos 5
NTLM:
NTLM authenticates using a challenge / response methodology
When the user attempt to access a resource , the server hosting the resource “challenges” , user to prove his / her
identity.
User then issue a “response” to that challenge. If the response is correct then the user is authenticated to the server.
The server goes through an authorization process for the requested resource.
Authentication process consists of three messages
Message 1 : Sent from the client to the server and is the initial request for authentication
Message 2 : Sent from the server to client, contains challenge ( Eight bytes of Random Data)
Message 3 : Sent from client to server , contains response to the challenge
Workstation Server
Message 1
Message 2
Message 3
The response is a 24-byte DES encrypted hash of the 8 byte challenge that can be decrypted only by a set of DES
keys created using the user’s password.
The benefit to NTLM is that password is verified without ever actually sending the password across the Web.
Kerberos:
Kerberos authentication differs from NTLM in many ways.
Instead of using password encrypt / decrypt challenge / response messages, a secret key,known only to the server and
client and also unique to the session, used to encrypt the handshake data.
2.24
This allows not only for the server to validate the authenticity of client , but for the client to validate the authenticity of
the server.
This is an important difference and is one the reason Kerberos is more secure than NTLM.
Kerberos authentication requires a trusted third resource known as Key Distribution Center (KDC).
The KDC generates the secret key for each session established.
The new session ticket , containing the new key, has a time-out value associated with
it. Once the secret key is obtained from the KDC
The client encrypts its request fora resource with the secret key.
The server decrypts the message using the same key, decrypts just on time stamp on the message and send back to client.
This tells the server and the client has the same key for the session which is established.
The following figures explain the authentication process in Kerberos:
Workstation Server
Clients wants to access a Server
KDC issues key : Kclient {Scs for Server} , ticket = Kserver {Scs for Client}
Workstation Server
Scs { Client Credentials , time}, ticket = Kserver { Scs for Client }
Scs { time }
2.25
2.26
2.27
Granting and Revoking User Privileges:
Privilege is a method to permit or deny access to data or to perform database operations (Data Manipulation)
Privileges in ORACLE:
System Privileges – Privileges granted only by DBA or users who have been granted the administration option.
Object Privileges – Privileges granted to an ORACLE user by the scheme owner of a database object or a user who
has been granted the GRANT option.
2.28
System_privilege is one of the listed system privileges.
All privileges – is all system privilege granted to the user. You should never use this clause.
user_name is the name of the user to whom an access right is being granted.
PUBLIC is used to grant access rights to all users.
ROLES are a set of privileges grouped together.
WITH ADMIN OPTION - allows a user to grant access rights to other users.
Example :
SQL > Grant select any table to shalom;
Grant succeeded
SQL > Grant select on emp to shalom;
Grant succeeded
The schema owner of emp object gave select privilege to user shalom
Example :
SQL > Revoke select any table from shalom;
Revoke succeeded
SQL > Revoke select on emp from shalom;
Revoke succeeded
The schema owner of emp object get back the select privilege to user shalom.
You can also use the Oracle Enterprise Manager Security tool to grant and revoke system privileges by the following
steps:
1. Open Enterprise Manager and select the database to which you want to connect.
2. Click the Users link and locate the user to whom you want to grant a privilege.
3. Click the System privileges link, then click Modify, and apply the privilege you want to grant the user. You
may grant as many privileges as you want.
4. When ready, click the OK button to apply these privileges.
Oracle provides several useful data dictionary views as follows:
DBA_SYS_PRIVS
2.29
ALL_SYS_PRIVS
USER_SYS_PRIVS
2.30
Example :
SQL > Revoke select on emp from shalom;
Revoke succeeded
You can also use the Oracle Enterprise Manager Security tool to grant and revoke object privileges by the following
steps:
1. Open Enterprise Manager and select the database to which you want to connect.
2. Click the Users link and locate the user to whom you want to grant a privilege.
3. Click the Object privileges link and apply the privilege you want to grant the user. You may grant as many
privileges as you want.
4. When ready, click the OK button to apply these privileges.
Oracle provides several useful data dictionary views as follows:
USER_TAB_PRIVS
USER_TAB_PRIVS_MADE
USER_TAB_PRIVS_RECD
ALL_TAB_PRIVS
ALL_TAB_PRIVS_MADE
ALL_TAB_PRIVS_RECD
DBA_ TAB_PRIVS
2.31
Privileges in SQL Server:
Database Privileges – Fixed Database Roles
db_owner – Have complete access to the database
db_accessadmin – Can add or remove users
db_securityadmin – Can change all permissions, object ownership, roles and role membership
db_ddladmin – Can execute all DDL statements
db_backupoperator – Can execute DBCC statements (DBCC is a SQL Server tool used for DB performance)
db_datareader – Can issue SELECT and READTEXT statements
db_datawriter – Can issue INSERT, UPDATE, DELETE and UPDATENEXT statements
db_denydatareader – Explicitly denied SELECT and READTEXT statements
db_denydatawriter – Explicitly denied INSERT, UPDATE, DELETE and UPDATENEXT statements
2.32
SQL Command:
Revoke all permission: SQL>REVOKE ALL FROM public
Grant to create table & view: REVOKE CREATE VIEW, CREATE TABLE FROM shalom, cherish
Denying Statement Permissions:
To deny statement permission using Query Analyzer, you use the DENY statement.
Syntax: DENY { ALL | statement [ ,…n] }
TO security_account [ ,… n]
SQL Command:
Deny all permission: SQL> DENY ALL TO public
Grant to create table & view: DENY CREATE VIEW, CREATE TABLE TO shalom, cherish
2.33
[AS {group | role } ]
SQL Command: REVOKE SELECT ON sales FROM shalom CASCADE
Denying Object Permissions:
You can use DENY statements to prevent users from gaining permissions through a GRANT to their user
accounts.
Syntax: DENY
{ ALL [PRIVILEGES ] | permission [,…n] } ON object
TO security_account [ ,… n]
[CASCADE]
SQL Command: DENY SELECT ON sales TO shalom
2.34
{ ALL [PRIVILEGES] | permission [,…n] }
{
[ (column [, … n ] ) ] ON {table | view}
| ON { table | view } [ (column [ ,..n] ) ]
}
TO security_account [ ,… n]
[CASCADE]
SQL Command:
Deny all permission: DENY ALL ON emp TO general_users
NOT IDENTIFIED Clause - Specify NOT IDENTIFIED to indicate that this role is authorized by the database and
that no password is required to enable the role.
IDENTIFIED Clause - Use the IDENTIFIED clause to indicate that a user must be authorized by the specified
method before the role is enabled with the SET ROLE statement.
Creating role with ORACLE:
Example
The following statement creates the role dw_manager:
Users who are subsequently granted the dw_manager role will inherit all of the privileges that have been granted to
this role.
You can add a layer of security to roles by specifying a password, as in the following example:
Users who are subsequently granted the dw_manager role must specify the password warehouse to enable the role with
2.35
the SET ROLE statement.
The following statement creates global role warehouse_user:
Grant succeeded
use northwind
exec sp_addrolem
‘saelm
esb’ er ‘sales’ , ‘shalom’
2.36
DROP ROLE dw_manager;
use northwind
Should report to security any violation of company guidelines like roles, profiles, privileges,
passwords, etc.,
Use Kerberos
When Configuring Policies: Require complex passwords, Set an account lockout threshold,
2.37