Adaptive Server Enterprise: Security Administration Guide
Adaptive Server Enterprise: Security Administration Guide
Upgrades are provided only at regularly scheduled software release dates. No part of this publication may be reproduced, transmitted, or
translated in any form or by any means, electronic, mechanical, manual, optical, or otherwise, without the prior written permission of
Sybase, Inc.
Sybase trademarks can be viewed at the Sybase trademarks page at http://www.sybase.com/detail?id=1011207. Sybase and the marks listed
are trademarks of Sybase, Inc. ® indicates registration in the United States of America.
SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of
SAP AG in Germany and in several other countries all over the world.
Java and all Java-based marks are trademarks or registered trademarks of Oracle and/or its affiliates in the U.S. and other countries.
Unicode and the Unicode Logo are registered trademarks of Unicode, Inc.
All other company and product names mentioned may be trademarks of the respective companies with which they are associated.
Use, duplication, or disclosure by the government is subject to the restrictions set forth in subparagraph (c)(1)(ii) of DFARS 52.227-7013
for the DOD and as set forth in FAR 52.227-19(a)-(d) for civilian agencies.
Index............................................................................................................................................ 411
Topic Page
Introduction to security 1
What is “information security?” 1
Information security standards 2
Introduction to security
Information is possibly your company's greatest asset. Information needs
protection just like any other asset. As a system administrator, determine
how best to protect the information contained in company databases, and
who may access the information. Individual database servers need strong,
yet flexible, security support.
Users and the data they access may be located anywhere in the world,
connected by untrusted networks. Ensuring the confidentiality and
integrity of sensitive data and transactions in this environment is critical.
Information is useful only if it gets to the people who need it, when they
need it. With complex and dynamically changing business relationships,
it is critical that information gets only to authorized users.
• The system should enforce integrity – the server should enforce rules and
constraints to ensure that information remains accurate and complete.
• The information should be available – even with all the safeguards in
place, anybody who needs access to the information should have it
available when the information is needed.
Identify what is it that your organization wants to protect, and what the outside
world requires from your organization:
• Identify the information assets and the security risks associated with them
if they become vulnerable or compromised.
• Identify and understand any laws, statutes, regulations, and contractual
agreements that apply to your organization and the information assets.
• Identify your organization’s business processes and the requirements they
impose on information assets, to balance practical considerations with the
security risks.
Security requirements change over time. Periodically reassess security
requirements to make sure they still reflect your organization’s needs.
Next, set up a series of controls and policies that meet the company's security
objectives, the result of which is an information security policy document that
clarifies decisions made for information security.
Adaptive Server® contains a set of security features that help you enforce your
company’s security policies. For more information about security features in
Adaptive Server, see Chapter 2, “Getting Started with Security Administration
in Adaptive Server.”
Note A Security and Directory Services license is required to use SSL and to
enable the FIPS login password encryption parameter. If the parameter is not
enabled, OpenSSL security provider is used to perform login password
encryption.
Note You must have an encrypted columns license to use the Adaptive Server
encrypted columns feature.
Topic Page
General process of security administration 5
Recommendations for setting up security 6
An example of setting up security 7
Security features in Adaptive Server 8
3 Set up logins, database users and roles – Add user logins to the server and
assign login profiles to them. Create user defined roles, define role
hierarchies and mutual exclusivity of roles, and assign roles to logins. Add
users to databases. See Chapter 3, “Managing Adaptive Server Logins and
Database Users.”
4 Administer permissions for users, groups, and roles – Grant and revoke
permissions for certain SQL commands, executing certain system
procedures, and accessing databases, tables, particular table columns, and
views. Create access rules to enforce fine-grained access control. See
Chapter 6, “Managing User Permissions.”
5 Configure encryption in your database to encrypt sensitive data in tables.
Encrypt sensitive data – Configure Adaptive Server to use column-level
encryption, decide which columnar data to encrypt, perform a one-time
key creation operation, and use alter table to perform initial data
encryption. See Users Guide for Encrypted Columns.
6 Establish integrity controls over data – Add check constraints, domain
roles, and referential constraints to validate incoming data. See
Transact-SQL Users guide and Reference Manual: Commands.
7 Set up and maintain auditing – Determine what is to be audited, audit the
use of Adaptive Server, and use the audit trail to detect penetration of the
system and misuse of resources. See Chapter 10, “Auditing,” and the
Adaptive Server installation and configuration documentation for your
platform.
8 Set up your installation for advanced authentication mechanisms and
network security – Configure the server to use services, such as LDAP,
PAM, or Kerberos- based user authentication, data confidentiality with
encryption, data integrity. See Chapter 5, “External Authentication” and
Chapter 9, “Confidentiality of Data.”
Use the “sa” login only during initial setup. Instead of allowing several
users to use the “sa” account, establish individual accountability by
assigning specific roles to individual administrators.
• Changing the “sa” login password – the “sa” login is configured initially
with a “NULL” password. Use alter login to change the password
immediately after installation.
Table 2-2 shows the sequence of commands you might use to set up a secure
operating environment for Adaptive Server, based on the role assignments
shown in Table 2-1. After logging in to the operating system, issue these
commands using the initial “sa” account.
Note Before you enable auditing, set up a threshold procedure for the audit trail and determine how to handle the
transaction log in sybsecurity. See Chapter 10, “Auditing.”
Note Do not lock the “sa” login until you have granted individual users the sa_role and sso_role roles and have
verified that the roles operate successfully.
External authentication
Security is often enhanced in large, heterogeneous applications by
authenticating logins with a central repository. Adaptive Server supports a
variety of external authentication methods:
Predicated Privileges
With predicated privileges, the table owner provides row-level access to users,
groups or roles by specifying a SQL where on the grant statement. You use the
full power of SQL, including access to other tables, to implement a
comprehensive row-level security policy. See “Granting Predicated
Privileges” on page 251.
Division of roles
The roles supported by Adaptive Server enable you to enforce and maintain
individual accountability. Adaptive Server provides system roles, such as
system administrator and system security officer, and user-defined roles, which
are created by a system security officer.
Roles are collections of privileges that allow the role assignee to do their job.
Roles provide individual accountability for users performing operational and
administrative tasks, and allow you to audit and attribute actions to these users.
Role hierarchy
A system security officer can define role hierarchies such that if a user has one
role, the user automatically has roles lower in the hierarchy. For example, the
“chief_financial_officer” role might contain both the “financial_analyst” and
the “salary_administrator” roles. The chief financial officer can perform all
tasks and see all data that can be viewed by salary administrators and financial
analysts.
Mutual exclusivity
You can define roles to be mutually exclusive either at the membership level,
or at the activation level. For example:
• You may not want to grant both the “payment_requestor” and
“payment_approver” roles to the same user.
• A user might be granted both the “senior_auditor” and the
“equipment_buyer” roles, but you may not want to permit the user to have
both roles enabled at the same time.
You can define system roles, as well as user-defined roles, to be in a role
hierarchy or to be mutually exclusive. For example, you might want a
“super_user” role to contain the system administrator, operator, and technical
support roles. Additionally, you may want to define the system administrator
and system security officer roles to be mutually exclusive for membership; that
is, a single user cannot be granted both roles.
See “Creating and assigning roles to users” on page 91.
When you install auditing, you can specify the number of audit tables that
Adaptive Server uses for the audit trail. If you use two or more tables to store
the audit trail, you can set up a smoothly running audit system with no manual
intervention and no loss of records.
A system security officer manages the audit system and is the only user who
can start and stop auditing, set up auditing options, and process the audit data.
As a system security officer, you can establish auditing for events such as:
• Server-wide, security-relevant events
• Creating, dropping, and modifying database objects
• All actions by a particular user or all actions by users with a particular role
active
• Granting or revoking database access
• Importing or exporting data
• Logins and logouts
• All actions related to encryption keys
Auditing functionality is discussed in Chapter 10, “Auditing.”
Confidentiality of data
Adaptive server allows you to maintain the confidentiality of data by
encrypting client-server communications using the Secure Sockets Layer
(SSL) standard or using Kerberos. You can protect the confidentiality of data
by using column-level encryption in the database and encrypting backups for
offline data The dump and load database commands include a password
parameter that allows you to password-protect your database dumps.
For more information see:
.
Topic Page
Introduction to logins and login profiles 16
Managing login accounts 16
Changing login accounts 19
Dropping login accounts 20
Choosing and creating a password 21
Establishing a password and login policy 53
Login failure 54
Locking Adaptive Server login accounts and roles 55
Managing login profiles 59
Adding users to databases 67
Creating groups 71
Using aliases in databases 73
Getting information about users 75
Changing user information 79
Dropping users and groups 83
Monitoring license use 84
Number of user and login IDs 87
Getting information about usage: chargeback accounting 89
After this statement is executed, “maryd” can log in to Adaptive Server. She is
automatically treated as a “guest” user in master, with limited permissions,
unless she has been specifically given access to master.
The following statement sets up a login account “omar_khayyam” and
password “rubaiyat” and makes “pubs2” the default database for this user:
create login omar_khayyam with password rubaiyat
default database pubs2
You cannot drop the last remaining System Security Officer's or System
Administrator's login account.
The with override clause drops the login even if there are non-available
databases that cannot be checked for login references.
This example creates “intern_role” with the password “temp244”, and sets the
maximum failed logins for “inter_role” to 20:
Sybase strongly recommends that you change the password for the login or role
when the server restarts.
Note Adaptive Server uses a default value of 6 for minimum password length.
Sybase recommends that you use a value of 6 or more for this parameter.
This example creates the new login “joe” with the password “Djdiek3”, and
sets the minimum password length for “joe” to 8:
create login joe Djdiek3 with password @minpwdlen min
password length 8
See create login in Reference Manual: Commands.
This example creates the new role “intern_role” with the password “temp244”
and sets minimum password length for “intern_role” to 0:
create role intern_role with passwd "temp244", min
passwd length 0
The original password is seven characters, but the password can be changed to
one of any length because minimum password length is set to 0.
See create role in Reference Manual: Commands.
Login password complexity checks are also extended to role passwords. See
“Login password policy checks to role passwords” on page 111.
See Reference Manual: Procedures for the complete sp_passwordpolicy syntax.
• password exp warn interval – the number of days before a password expires
that the password expiration warning messages displays. These messages
display with every successful login until the password is changed or it
expires. This value must be less than or equal to the password expiration.
Disabled by default.
Valid values are 0 to 365.
• maximum failed logins – the maximum number of failed logins that can
occur before the login is locked. Specify this value globally. Disabled by
default. Valid values are:
• 0 – logins are never locked, regardless of the number of failed login
attempts.
• 1 through 32767 – the number of failed logins that can occur before
the login is locked.
• expire login changes the login status to expired when a system security
officer creates or resets a login. The login is then required to change the
password on the first login. Disabled by default. Valid values are:
• 0 – new or reset logins will not expire.
• 1 – new or reset logins expire; you must reset your password at the
first login.
See sp_passwordpolicy in the Reference Manual: Procedures.
• min alpha in password must be at least the sum of min upper char in
password and min lower char in password.
Examples Example 1 Creates a new login and sets the minimum password length for
“johnd” to 6:
create login johnd with password complex_password min
password length '6'
These global options for login “johnd” create two minimum password length
requirements for login “johnd”, and sets restrictions about digits in the
password:
sp_configure 'minimum password length', '8'
sp_configure 'check password for digit', 'true'
sp_passwordpolicy 'set', 'min digits in password', '2'
If you then try to alter the password for login “johnd”:
alter login johnd with password complex_password modify
password 'abcd123'
Adaptive Server checks the password in the following order:
1 Per-login existing options check: minimum password length must be
greater than 6. This is true and the check passes.
2 New options: minimum digits in password must be greater than 2. This is
true and the check passes.
3 Existing global options: minimum password length specified here is not
checked because there is already a per-login check for the login “johnd”.
4 The check password for digit option is redundant because it is already
checked when the minimum number of digits is turned on and set to 2.
Once Adaptive Server checks the designated sequence, and the new password
for login “johnd” passes these checks, the password is successfully change.
Example 2 If you enter the following for user “johnd”, Adaptive Server first
checks the per-login existing options, and determines the minimum password
length is set to 6, but that you have attempted to alter the password to use only
4 characters:
alter login johnd with password complex_password modify
password abcd
The check fails, and Adaptive Server prints an error message. Once one
password complexity check fails, no additional options are checked.
Example 3 Creates a new login with the following password configuration
options and sets the minimum password length for login johnd to 4:
create login johnd with password complex_password min
password length 4
This is a per-login, existing option. When you add the following, you have
created a global requirement that the minimum number of digits for a password
must be 1:
sp_passwordpolicy 'set', 'min digits in password', '1'
If you then attempt to alter the password for login johnd as follows:
alter login johnd with password complex_password modify
password abcde
Adaptive Server performs the checks in the following order:
1 Per-login existing options check: the minimum password length of a new
password is 4. The password “abcde” is greater than 4, so this check
passes.
2 New global requirement check: the minimum digits in a password is set to
1, globally. This check fails.
Adaptive Server does not change the password and prints an error message.
To alter a password, all the checks must pass.
begin
declare @current_time datetime,
@encrypted_pwd varbinary(30),
@salt varchar(8),
@changedby varchar(30),
@cutoffdate datetime
delete master..pwdhistory
where name = @loginame
and pwdate < @cutoffdate
begin
select @salt = substring(hash(password_random(), 'sha1'), 1, 8)
end
begin
raiserror 22001 --user defined error message
end
end
go
Use sp_addmessage to add the user-defined message 22001. A raiserror
22001 indicates a custom password-complexity check error.
The following user-defined stored procedure (sp_cleanpwdchecks) can be used
to clean-up the password history using sp_extrapwdchecks.
create proc sp_cleanpwdchecks
(
@loginame varchar(30)
-- user to change password on
)
as
begin
delete master..pwdhistory
where name = @loginame
end
go
Once the two procedures above are defined and installed in the master
database, they are called dynamically during the password complexity checks.
Adaptive Server supports two versions of the login protocol using RSA
asymmetric encryption. One ensures a unique keypair per login session and the
second employs a random number during the login protocol. When there are
many user connections using network password encryption, the unique keypair
per session may cause computation peaks due to computation of new keypairs.
The second approach is less computationally demanding. The second approach
requires a recompiled client program that supports the newer login protocol
that uses RSA asymmetric encryption with a random number.
Generating an For RSA asymmetric encryption with random number, Adaptive Server
asymmetric key pair generates a new key pair:
• At each server start-up,
• Automatically at 24-hour intervals using the Adaptive Server housekeeper
mechanism, and
• When an administrator with sso_role requests key pair regeneration.
The key pair is kept in memory. A message is recorded in the error log and in
the audit trail when the key pair is regenerated.
For RSA asymmetric encryption without random number, by default, a key
pair is generated for each connection.
Procedure sp_passwordpolicy option unique keypair per session may be used to
turn on or off the generation of a key pair for each connection with this login
protocol. However this should only be used in environments where network
password security is not a concern because the key pair is reused without the
benefit of the random number component.
To generate the key pair on demand, use:
sp_passwordpolicy "regenerate keypair"
Note Depending on the system load, there may be a delay between the time
this command is executed and the time the key pair is actually generated. This
is because the housekeeper task runs at a low priority and may be delayed by
higher priority tasks.
For example, a datetime string of “Jan 16, 2007 11:00PM” generates the key
pair at the specified time. The datetime string can also just be a time of day,
such as “4:07a.m.”. When only time of day is specified, key-pair regeneration
is scheduled for that time of day in the next 24-hour period.
sp_passwordpolicy lets you configure the frequency of key-pair regeneration,
as well as what Adaptive Server should do when a key pair generation fails:
• ‘keypair regeneration period’, { ([keypair regeneration frequency], datetime of
first generation) | (keypair regeneration frequency, [datetime of first
generation]) }
Adaptive Server uses either RSA or Sybase proprietary algorithms when this
server option is set to true. The command to enable net password encryption is:
sp_serveroption server, "net password encryption",
"true"
The setting is stored in master..sysservers and you can display the value of
server options using the sp_helpserver stored procedure.
The default value for net password encryption is true for any new server added
using sp_addserver. During upgrade, Adaptive Server sets net password
encryption to true for sysservers entries with an ASEnterprise class value. No
other server classes are modified. This improves password security between
two communicating Adaptive Servers.
Note The administrator can optionally reset net password encryption to false if
you encounter problems establishing a connection to a server. However, if the
option is set to false, passwords are transmitted in clear text on the network.
Backward • Sybase recommends that you use the RSA algorithm to protect passwords
compatibility on the network.
• To use the RSA algorithm with random number, you must have Adaptive
Server version 15.7 ESD #1 or later and use new Connectivity SDK clients
version 15.7 ESD #1 or later.
• To use the RSA algorithm, without random number, you must have
Adaptive Server version 15.0.2 and new Connectivity SDK clients version
15.0 ESD #7 and later.
• Sybase provides the net password encryption reqd configuration parameter
and the net password encryption server option to allow settings equivalent
to versions earlier than 15.0.2 and maintain backward compatibility with
older clients and older servers.
• Older clients that do not support the RSA algorithm can set the property to
encrypt passwords using the Sybase proprietary algorithm, which has been
available version 12.0. Adaptive Server then uses the Sybase proprietary
algorithm.
• New clients that support both RSA and Sybase proprietary algorithms can
set properties for both algorithms. When communicating with such clients,
Adaptive Server 15.0.2 and later uses RSA encryption. A pre-15.0.2
Adaptive Server uses the Sybase proprietary algorithm.
For example, a client connects to Adaptive Server using isql and establishes a
new password. Regardless of the character set used in the client, characters are
always converted to the server’s default character set for processing within
Adaptive Server. Assuming the Adaptive Server default character set is
“iso_1,” consider the command:
alter login loginName with password oldPasswd modify password
newPasswd
The password parameters are varchar, and are expressed as a quoted string and
stored with “iso_1” encoding before encryption. If the Adaptive Server default
character set changes later, the encrypted password remains an encrypted string
of characters encoded with the original default character set. This may result in
authentication failure due to mismatched character mapping. Although
changing the default character set is a rare occurrence, it becomes more
important when migration occurs between platforms.
Adaptive Server converts the clear text password to canonical form before
encryption so that the password can be used across platforms, chip
architectures, and character sets.
To use canoncial form for storage in syslogins:
1 Convert the clear text password string to UTF-16.
2 Convert the UTF-16 string to network byte order.
3 Append a small buffer (the salt) with random bytes to the password.
4 Apply the SHA-256 hash algorithm.
5 Store digest, salt, and version in the password column.
At authentication time:
1 Convert the clear text password string to UTF-16.
2 Convert the UTF-16 string to network byte order.
3 Append the salt from the password column in syslogins to the password.
4 Apply the hash algorithm.
5 Compare results with password column in syslogins, if they match then
authentication is successful.
Note Review this section if you are upgrading to Adaptive Server version 15.7
or later from a version 15.0.
• The value of each password column in syslogins is rewritten to use only the
new password on-disk structure.
• The logins that have not transitioned to the new algorithm have the
password reset to a new server-generated password in SHA-256 format,
and the login is locked. The generated password is displayed only to the
administrator executing the sp_passwordpolicy procedure above. The lock
reason is set to 3 (“Login or role not transitioned to SHA-256”).
After the sp_passwordpolicy procedure completes:
• Login authentication uses only SHA-256.
• Only the new password on-disk structure for the password column is used.
• Attempts to use the locked logins fail authentication. To use the locked
logins, you must unlock the login with sp_locklogin and the user must use
the password generated by sp_passwordpolicy. Alternatively, you may
prefer to assign a new password instead of the generated password for
locked login accounts.
Example 1 This example prepares an upgraded server to use only SHA-256. Examine
login accounts to determine which encryption is used by the account using
sp_displaylogin.
The value SYB-PROP from the line Login Password Encryption: SYB-PROP
indicates that only the Sybase-proprietary encryption is used for this account.
This login has not been used before the upgrade to Adaptive Server version
15.0.2 and later, and will be locked, and its password reset if sp_passwordpolicy
'set', 'allow password downgrade', ‘0’ is executed.
After the first login to the account after upgrading to Adaptive Server 15.0.2,
the line changes to show that both old and new encryption is used:
Login Password Encryption: SYB-PROP,SHA-256
This is the desired state for all active login accounts, so that executing
sp_passwordpolicy 'set', 'allow password downgrade', ‘0’ does not lock and reset
the password for accounts.
After you execute sp_passwordpolicy 'set', 'allow password downgrade', ‘0’, only
SHA-256 encryption is used, and you see:
Login Password Encryption: SHA-256
Login accounts that show this value are now using the stronger, on-disk
encryption algorithm.
When all passwords have been changed to use the new algorithm, re-executing
sp_passwordpolicy shows no accounts reset or locked:
Note The login name, suid, and generated password appear to the
administrator executing the procedure. The output of the command shows all
10 accounts that have not transitioned are reset (and locked).
Note Running sp_downgrade, shutting down the server, then restarting the
same version of Adaptive Server from which you downgraded removes the
changes made by sp_downgrade. You must re-run sp_downgrade to redo the
changes. See the Installation Guide for information about running
sp_downgrade.
For example, if Adaptive Server 15.0.1 has 1,000 login accounts, and the
data fits into 59 pages, the same number of login accounts may require
approximately 19 additional pages in Adaptive Server 15.0.2 on a new
master database, or 33 additional pages if you upgraded from 15.0.1 (with
allow password downgrade set to 1).
The transaction log requires additional space for the updated password column.
When users first log in, Adaptive Server requires about 829 2K pages per 1,000
logins, and about 343 pages per 1,000 logins for password changes users make
during the upgrade and downgrade. To ensure there is sufficient log space,
verify that there is approximately one 2K page of free log space per login
before starting the password upgrade or downgrade, and when users first login
to Adaptive Server version 15.0.2 and later.
Downgrading
Adaptive Server supports downgrading from version 15.0.2 or later to version
15.0 or 15.0.1. If you are downgrading to an earlier version of Adaptive Server,
you may need to perform additional actions.
If allow password downgrade is 0 or NULL, or if a password has been stored in
syslogins with only the SHA-256 algorithm, use sp_displaylogin on login
accounts to determine which algorithm is used, or sp_downgrade "prepare" to
determine which accounts are reset.
The prepare option reports whether the server is ready to be downgraded. If the
prepare option fails, it reports errors that must be fixed. If a downgrade is
performed on the server before the errors are fixed, the downgrade fails. For
login passwords, prepare reports which passwords are reset during the
downgrade.
Run sp_downgrade "prepare" to verify whether you should run sp_downgrade:
sp_downgrade 'prepare','15.0.1',1
Checking databases for downgrade readiness.
New password encryption algorithm found for login name user103, suid 103.
Resetting password to 'ZdSuFpNkBxAbW9'.
sp_downgrade makes catalog changes, and modifies password data. The server
must be in single user mode to successfully execute sp_downgrade. To start the
server in single user mode, and to allow only the System Administrator to log
in, use the -m command line option to start the server.
After running sp_downgrade, shut down the 15.0.2 server to avoid new logins
or other actions that may modify data or system catalogs. If you restart
Adaptive Server at version 15.0.2 after running sp_downgrade, the earlier
version shuts down and you are again upgraded to the version 15.0.2 or later
level.
value message
-------- -----------------------------------------------------
NULL New master database.
(1 row affected)
High-availability configuration
The primary and companion servers must have equivalent allow password
downgrade values before you configure them for high availability. The allow
password downgrade quorum attribute checks whether the value of allow
password downgrade is the same on both primary, and secondary servers.
(1 row affected)
(return status = 1)
A value of 2 in the Advisory column indicates that the user cannot proceed with
the cluster operation unless the values on both companions match.
sp_companion do_advisory also lists the difference in the value of allow
password downgrade on both servers.
Login failure
Adaptive Server must successfully authenticate a user before he or she can
access data in Adaptive Server. If the authentication attempt fails, Adaptive
Server returns the following message and the network connection is
terminated:
isql -U bob -P badpass
Msg 4002, Level 14, State 1:
Server 'ACCOUNTING'
Login failed.
CT-LIBRARY error:
ct_connect(): protocol specific layer: external error:
The attempt to connect to the server failed
This message is a generic login failure message that does not tell the
connecting user whether the failure resulted from a bad user name or a bad
password.
Although the client sees a generic message for a login failure to avoid giving
information to a malicious user, the system administrator may find the reason
for the failure to be important to help detect intrusion attempts and diagnose
user authentication problems.
Adaptive Server provides the reason for the login failure in the
Errornumber.Severity.State of the Other Information section of
sysaudits.extrainfo column. Login failure audits have event number 45 and
eventmod 2.
Set the sp_audit login parameter to on or fail to enable auditing for login failure:
sp_audit "login", "all", "all", "fail"
sp_audit "login", "all", "all", "on"
See “Auditing login failures.”
Warning! Adaptive Server may reuse the server user ID (suid) of a dropped
login account when the next login account is created. This occurs only when
the dropped login holds the highest suid in syslogins; however, it can
compromise accountability if execution of drop login is not being audited. Also,
it is possible for a user with the reused suid to access database objects that were
authorized for the old suid.
If the enable last login updates password policy option is set to 1, the
lastlogindate column is set to the datetime of the login, and the previous value
of the column is stored in the process status structure of the login session. The
update to syslogins and the process status structure can occur at each login to
Adaptive Server. The default value for enable last login updates a new master
database or an upgraded database is 1. To disable this option execute the
procedure using administrator privileges:
sp_passwordpolicy 'set', 'enable last login updates',
'0'
@@lastlogindate is specific to each user login session, and can be used by that
session to determine the date and time of the previous login to the account. If
the account has not been previously used or if enable last login updates is 0, the
value of @@lastlogindate is NULL.
The transaction log does not log updates to syslogins..lastlogindate.
Administrators with sso_role can lock login accounts that are inactive for a
given number of days, using:
sp_locklogin 'all', 'lock', [@except], 'number of inactive days'
This command has no effect if enable last login updates is set to 0 or the value
of the lastlogindate column is NULL. The range of values for number of inactive
days is 1 – 32767 (days).
The lockreason column specifies the reason a login was locked. The value of
the lockdate column is set to the current datetime.
When an account is unlocked, columns lockreason, lockdate, and locksuid are
reset to NULL.
The lockdate, locksuid, and lockreason columns are set internally by Adaptive
Server. Table 3-3 provides lockreason values and descriptions, and the value of
locksuid.
Values for
lockreason Values for locksuid Description of lockreason account
3 suid of caller of sp_passwordpolicy Account locked by locksuid as the password downgrade
set, "allow password downgrade", 0 period has ended, and login or role has not transitioned to
SHA-256.
4 NULL Account locked due to account inactivity.
• lockreason – gives a reason why it was locked. This is in the form of codes:
The attributes of login profiles are associated with login accounts using the
following precedence:
1 Attribute values from a login profile bound to the login
2 Attribute values from a default login profile
3 Values which have been specified using sp_passwordpolicy under the
following circumstances:
• A default login profile does not exit
• A login profile has not been defined and bound to the account
• The login profile is set to be ignored (the parameter with login profile
ignore is specified for the command create login)
The login profile name can also be displayed using sp_displaylogin. If a login
profile is not directly associated with the login account and a default login
profile exist, the name of the default login profile is displayed.
Note A non-privileged login account can only display the attributes of a login
profile that it is directly associated with, or the attributes of the default login
profile. System security officer role is required to see attributes and bindings
of all login profiles.
The following example removes the login script attribute from the login profile
mgr_lp. If a login script is specified for the default login profile, it will be
invoked on login, otherwise no login script will be invoked.
alter login profile mgr_lp drop login script
See alter login profile in the Reference Manual: Commands for complete syntax.
Note Although more than one individual can be a guest user in a database,
Adaptive Server can still use the user’s server user ID, which is unique within
the server, to audit each user’s activity. See Chapter 10, “Auditing.”
sp_adduser guest
revoke all on titles from guest
• create table, create view, create rule, create default, and create procedure
permissions
Warning! A visitor user account is not the same as the “guest” user account.
All users of the visitor account have the same server user ID; therefore, you
cannot audit individual activity. Each “guest” user has a unique server ID, so
you can audit individual activity and maintain individual accountability.
Sybase recommends that you do not set up a visitor account to be used by more
than one user because you cannot maintain individual accountability.
You can use create login to add a visitor user account named “guest” to
master..syslogins. This “guest” user account takes precedence over the system
“guest” user account. If you add a visitor user named “guest” with sp_adduser,
this impacts system databases such as sybsystemprocs and sybsystemdb, which
are designed to work with system “guest” user in them.
Creating groups
Groups let you grant and revoke permissions to more than one user in a single
statement, as well as allow you to provide a collective name to a group of users.
They are especially useful if you administer an Adaptive Server installation
that has a large numbers of users.
Create groups before adding users to a database, since sp_adduser can assign
users to groups as well as add them to the database.
You must have the system administrator or system security officer role, or be
the database owner to create a group with sp_addgroup. The syntax is:
sp_addgroup grpname
The group name, a required parameter, must adhere to the rules for identifiers.
The system administrator, system security officer, or the database owner can
use sp_changegroup to assign or reassign users to groups.
For example, to set up the Senior Engineering group, use this command while
using the database to which you want to add the group:
sp_addgroup senioreng
sp_addgroup adds a row to sysusers in the current database. Therefore, each
group in a database, as well as each user, has an entry in sysusers.
Groups are represented by an entry in the sysusers table. You cannot use the
same name for creating a group and a user in the database (for example, you
cannot have both a group and a user named “shirley”).
Note Although more than one individual can use the alias in a database, you
can still maintain individual accountability by auditing the database operations
performed by each user. See Chapter 10, “Auditing.”
The collective user identity from using aliases implies set-ownership for
database objects. For example, if user “loginA” is aliased to dbo in in database
db1, all objects created by “loginA” in db1 are owned by dbo. However,
Adaptive Server concretely records an object’s ownership in terms of the login
name and the creator’s database user ID. See “Concrete identification” on page
185. An alias cannot be dropped from a database if he or she concretely owns
objects in that database.
Note You cannot drop the alias of a login if that login created objects in the
database. In most cases, use aliases only for users who do not own tables,
procedures, views, or triggers.
Adding aliases
To add an alias for a user, use sp_addalias:
sp_addalias loginame, name_in_db
where:
• loginame – is the name of the user who wants an alias in the current
database. This user must have an account in Adaptive Server but cannot be
a user in the current database.
• name_in_db – is the name of the database user to whom the user specified
by loginame is to be linked. The name_in_db must exist in sysusers in the
current database.
Executing sp_addalias maps the user name specified by loginame to the user
name specified by name_in_db. It does this by adding a row to the system table
sysalternates.
When a user tries to use a database, Adaptive Server checks for the user’s
server user ID number (suid) in sysusers. If it is not found, Adaptive Server
then checks sysalternates. If the user’s suid is found there, and it is mapped to
a database user’s suid, the first user is treated as the second user while the first
user is using the database.
For example, suppose that Mary owns a database. She wants to allow both Jane
and Sarah to use the database as if they were its owner. Jane and Sarah have
logins on Adaptive Server but are not authorized to use Mary’s database. Mary
executes the following commands:
sp_addalias jane, dbo
exec sp_addalias sarah, dbo
Warning! Users who are aliased to the database owner have all the permissions
and can perform all the actions that can be performed by the database owner,
with respect to the database in question. A database owner should carefully
consider the implications of vesting another user with full access to a database.
Dropping aliases
Use sp_dropalias to drop the mapping of an alternate suid to a user ID. Doing
this deletes the relevant row from sysalternates. The syntax is the following,
where loginame is the name of the user specified by loginame when the name
was mapped with sp_addalias:
sp_dropalias loginame
After a user’s alias is dropped, the user no longer has access to the database.
You cannot drop an alias if the aliased login created any objects or thresholds.
Before using sp_dropalias to remove an alias that has performed these actions,
remove the objects or procedures. If you still need them after dropping the
alias, re-create them with a different owner.
(1 row affected)
Users aliased to user.
Login_name
----------------------
andy
christa
howard
linda
For each process run, sp_who reports the security-relevant information for the
server process ID, its status, the login name of the process user, the real login
name (if login_name is an alias), the name of the host computer, the server
process ID of a process that is blocking this one (if any), the name of the
database, and the command being run.
If you do not provide a login name or spid, sp_who reports on processes being
run by all users.
The following example shows the security-relevant results from executing
sp_who without a parameter:
fid spid status loginame origname hostname blk_spid dbname
tempdbname cmd block_xloid threadpool
--- ---- --------- --------- --------- --------------- -------- -----------
----------- ----------------- ----------- -----------------
0 1 running sa sa sunbird 0 pubs2
tempdb SELECT 0 syb_default_pool
0 2 sleeping NULL NULL 0 master
tempdb NETWORK HANDLER 0 syb_default_pool
0 3 sleeping NULL NULL 0 master
tempdb MIRROR HANDLER 0 syb_default_pool
0 4 sleeping NULL NULL 0 master
tempdb AUDIT PROCESS 0 syb_default_pool
0 5 sleeping NULL NULL 0 master
sp_who reports NULL for the loginame for all system processes.
The arguments for these system functions are optional. If you do not provide
one, Adaptive Server displays information about the current user.
This example shows how to find the server user ID for the user “sandy:”
select suser_id("sandy")
------
3
This example shows how a system administrator whose login name is “mary”
issues the commands without arguments:
select suser_name(), suser_id()
------------------------------ ------
mary 4
To find a user’s ID number or name inside a database, use user_id and
user_name.
Table 3-8: System functions user_id and user_name
To find Use With the argument
User ID user_id ([“db_user_name”])
User name user_name ([db_user_ID])
The arguments for these functions are optional. If you do not provide one,
Adaptive Server displays information about the current user. For example:
select user_name(10)
----------------------------------------------------
NULL
(1 row affected)
select user_name( )
----------------------------------------------------
dbo
(1 row affected)
select user_id("joe")
----------------------------------------------------
NULL
(1 row affected)
Changing passwords
All users can change their passwords at any time using alter login. The system
security officer can use alter login to change any user’s password.
For example, to the password of the login account named ron, enter:
alter login ron with password watsMypaswd modify
password 8itsAsecret
See alter login in Reference Manual: Commands.
Null passwords
Do not assign a null password. When Adaptive Server is installed, the default
“sa” account has a null password. This example shows how to change a null
password to a valid one:
alter login sa with password null modify password 8M4LNC
Sybase strongly recommends that you change the password when the server
restarts. For example, to reset the password for user rsmith who has sa_role:
dataserver -prsmith
• host_name – is the name of the host from which the client is connecting.
For example, if a user logs in to Adaptive Server as “client1,” you can assign
them an individual client name, host name, and application name using
commands similar to:
set clientname 'alison'
set clienthostname 'money1'
set clientapplname 'webserver2'
This user now appears in the sysprocesses table as user “alison” logging in
from host “money1” and using the “webserver2” application. However,
although the new names appear in sysprocesses, they are not used for
permission checks, and sp_who still shows the client connection as belonging
to the original login (in the case above, client1). set clientname does not
perform the same function as set proxy, which allows you to assume the
permissions, login name, and suid of another user.
You can set a client name, host name, or application name for only your current
client session (although you can view the connection information for any client
connection). Also, this information is lost when a user logs out. These
parameters must be reassigned each time a user logs in. For example, the user
“alison” cannot set the client name, host name, or application name for any
other client connection.
Use the client’s system process ID to view their connection information. For
example, if the user “alison” described above connects with a spid of 13, issue
the following command to view all the connection information for this user:
select * from sysprocesses where spid = 13
To view the connection information for the current client connection (for
example, if the user “alison” wanted to view her own connection information),
enter:
select * from sysprocesses where spid = @@spid
Dropping users
A database owner, system security officer, or a system administrator can use
sp_dropuser to deny an Adaptive Server user access to the database in which
sp_dropuser is executed. (If a “guest” user is defined in that database, the user
can still access that database as “guest.”)
The following is the syntax, where name_in_db is usually the login name,
unless another name has been assigned with sp_adduser:
sp_dropuser name_in_db
You cannot drop a user who owns objects. Since there is no command to
transfer ownership of objects, you must drop objects owned by a user before
you drop the user. To deny access to a user who owns objects, use sp_locklogin
to lock his or her account.
You also cannot drop a user who has granted permissions to other users. Use
revoke with cascade to revoke permissions from all users who were granted
permissions by the user to be dropped, then drop the user. You must then grant
permissions to the users again, if appropriate.
Dropping groups
The system security officer, the system administrator, or the database
administrator uses sp_dropgroup to drop a group. The syntax is:
sp_dropgroup grpname
You cannot drop a group that has members. If you try to do so, the error report
displays a list of the members of the group you are attempting to drop. To
remove users from a group, use sp_changegroup, discussed in “Changing a
user’s group membership” on page 72.
The housekeeper chores task runs during Adaptive Server idle cycles. Both the
housekeeper free write percent and the license information configuration
parameter must be set to values greater than or equal to 1 for the License Use
Monitor to track license use.
For more information about the housekeeper chores task, see Chapter 3, “Using
Engines and CPUs,” in the Performance and Tuning Series:Basics.
In this example, the number of user licenses used exceeded the limit on July
19, 1998.
If Adaptive Server is shut down, License Use Monitor updates syblicenseslog
with the current maximum number of licenses used. Adaptive Server starts a
new 24-hour monitoring period when it is restarted.
The second row for July 21, 1998 was caused by a shutdown and restart of the
server.
Figure 3-1 illustrates the limits and ranges for logins, users, and groups.
Figure 3-1: Users, groups, and logins available in Adaptive Server
-32768 2 billion
(@@minsuid) 0 1 2 16383 1048576 (@@maxsuid)
sa
suid
probe
User IDs suid Group or role IDs
16384 1048576
(@@mingroupid) (@@maxgroupid)
Note Before Adaptive Server can have more than 64K logins and
simultaneous connections, you must first configure the operating system
for more than 64K file descriptors. See your operating system
documentation for information about increasing the number of file
descriptors.
select @@minuserid
-----------
-32768
System-defined roles
Table 4-1 lists the system roles, the value to use for the role_granted option of
the grant role or revoke role command, and the tasks usually performed by a
person with that role.
Note sa_role is grantable by a user who has sa_role. All other system role are
grantable by a user with sso_role. If a user defined role has been granted both
sa_role and other system roles, that role may be granted only by a user who has
both sa_role and sso_role.
Operator privileges
Users who have been granted the operator role can back up and restore
databases on a server-wide basis without having to be the owner of each
database. The operator role allows a user to use these commands on any
database:
• dump database
• dump transaction
• load database
• load transaction
• checkpoint
• online database
Replication role
The user maintaining Replication Server and ASE Replicator requires the
replication role. See the Replication Server Administration Guide and the ASE
Replicator Users Guide for information about this role.
The create role command can only be used in the master database.
If a password is used, any user activating the role must specify the password.
Roles with passwords cannot be used if the role is to be activated during login
as the login's default role or as an automatically activated role granted to a login
profile.
For example, to create the intern_role without a password, enter:
create role intern_role
To create the doctor_role and assign the password “physician”, enter:
create role doctor_role with passwd "physician"
Only the system security officer can create user-defined roles.
Note When you assign a password to a role, any user granted the role must
specify the password to Adaptive Server at the time of activating the role.
Note If a role requires a password to be contained within another role, the user
with the role that contains the other does not need to use the password for the
contained role. In the example above, assume that the “doctor” role usually
requires a password. The user who has the “specialist” role does not need to
enter the “doctor” password because “doctor” is contained within “specialist.”
Role passwords are only required for the highest level role.
specialist
doctor
consultant intern
• You cannot grant a role to another role that is contained by the first role.
This prevents “loops” within the hierarchy.
For example, in Figure 4-2, you cannot grant the “specialist” role to the
“consultant” role; “consultant” is already contained in “specialist.”
consultant intern
• When the system security officer grants to a user a role that contains other
roles, the user implicitly gets membership in all roles contained by the
granted role. However, a role can be activated or deactivated directly only
if the user has explicit membership in that role.
• The system security officer cannot grant one role to another role that is
explicitly or implicitly mutually exclusive at the membership level with
the first role.
For example, in Figure 4-3, if the “intern” role is defined as mutually
exclusive at the membership level with the “consultant” role, the system
security officer cannot grant “intern” to the “doctor.”
Figure 4-3: Mutual exclusivity at membership
specialist
doctor
consultant
intern
Revoking roles from other roles is similar to granting roles to other roles.
It removes a containment relationship, and the containment relationship
must be a direct one.
For example:
• If the system security officer revokes the “doctor” role from “specialist,”
“specialist” no longer contains the “consultant” role or the “intern” role.
• The system security officer cannot revoke the “intern” role from
“specialist” because “intern” is not directly contained by “specialist.”
When a user logs in to Adaptive Server, the user’s roles are not necessarily
active, depending upon how the role is set up as a default role. If a role has a
password associated with it, the user must use the set role command to activate
the role.
The system security officer determines whether to activate roles granted by
default at login and uses the auto activated roles attribute of alter login profile or
alter login to set the default status of user roles individually for each user.
Individual users can change only their own default settings. auto activated roles
only affects user roles, not system roles.
By default, user-defined roles that are granted are not activated at login, but
system roles that are granted are automatically activated, if they do not have
passwords associated with them.
The following example shows how to automatically activate roles on login if
they are not password protected.
alter login mgr add auto activated roles
mgr_role, eng_role
The following example shows how to use the login profile to automatically
activate roles on login if they are non password protected. The mgr_role and
eng_role must be granted to mgr_lp:
If the role was granted using an activation predicate, Adaptive Server evaluates
the predicate at this time. If the predicate evaluates to true, the role is enabled;
otherwise, the role remains inactive and the server returns an error message.
Activate roles only when you need them, and deactivate them when the roles
are no longer necessary. Keep in mind that, when the sa_role is active, you
assume the identity of database owner within any database that you use.
Any user can execute role_id. If the role is valid, role_id returns the server-wide
ID of the role (srid). The syssrvroles system table contains an srid column with
the role ID and a name column with the role name. If the role is invalid, role_id
returns NULL.
To find a role name when you know the role ID, use: role_name:
role_name(role_id)
Any user can execute role_name.
Note The show_role function does not include information about user-defined
roles.
Granting roles
To grant roles to users, roles, or login profiles, use:
grant role role_name
[where pred_expression]
to {username | rolename | login_profile_name }
where:
Revoking roles
Use revoke role to revoke roles from users, other roles, and login profiles:
revoke role role_name [{, role_name}...]from grantee [{, grantee}...]
where:
• role_name – is the role being revoked. You can specify any number of roles
to be revoked.
• grantee – is the name of the user or role. You can specify any number of
grantees.
All roles listed in the revoke statement are revoked from all grantees.
• lockreason – indicates why the role was locked. lockreason is coded into
an integer that can be represented with an internationalized message. Each
reason has a message in the MSGDB database added to identify the reason
in the local language.
Adaptive Server resets these to NULL when a role is unlocked.
The values and descriptions are:
Values for lockreason Value for locksuid Description of lockreason of role
NULL NULL Role has not been locked
1 suid of caller of alter role Role locked by suid by manually executing
alter role rolename lock
2 suid of user whose last attempted role Role locked by Adaptive Server due to
activation led to the role getting locked failed-role activation attempts reaching
maximum number of failed logins
Note If you are using high availability functionality, both the primary and
companion servers are updated when you update the syssrvroles columns.
• expire login
• expire login
A value of 2 set in the advisory column of the output indicates that the user
cannot proceed with the cluster operation unless the values on both the
companions match.
The output of sp_companion do_advisory also indicates the inconsistency in
any of the particular password policy checks on both servers.
Installing
Before using the role functionality, make sure Adaptive Server has additional
disk space in the master database and transaction log for the columns added to
the syssrvroles table. A database administrator can use the alter database
command to add the additional space.
To identify the density of roles per page and log space you need for role
password changes, use sp_help syssrvroles and sp_helpdb. You can then
compare the values of:
• The values of the log space from before and after a specific number of
password changes
• The specific number of set role with passwd commands that update
syssrvroles with dates
...
(return status = 0)
Additional messages appear in the error log to identify steps that occurred
during sp_downgrade and any system errors that may occur, such as in this
example of error log output for the example downgrade procedure:
00:0006:00000:00006:2011/06/28 06:21:23.95 server Preparing ASE downgrade from 15.7.0.0
to 15.5.0.0.
00:0006:00000:00006:2011/06/28 06:21:24.12 server Starting downgrading ASE.
00:0006:00000:00006:2011/06/28 06:21:24.12 server Downgrade : Marking stored procedures
to be recreated from text.
00:0006:00000:00006:2011/06/28 06:21:26.13 server Downgrade : Removing full logging
modes from sysattributes.
00:0006:00000:00006:2011/06/28 06:21:26.13 server Downgrade : Downgrading data-only
locked table rows.
00:0006:00000:00006:2011/06/28 06:21:26.13 server Downgrade : Removing full logging
modes from sysattributes.
00:0006:00000:00006:2011/06/28 06:21:26.13 server Downgrade : Removing column
sysoptions.number.
00:0006:00000:00006:2011/06/28 06:21:26.13 server Downgrade : Removing srvprincipal
column from sysservers system table
00:0006:00000:00006:2011/06/28 06:21:26.14 server Downgrade : Removing 'automatic master
key access' configuration parameter.
00:0006:00000:00006:2011/06/28 06:21:26.14 server Downgrade : Removing DualControl
sysattribute rows
00:0006:00000:00006:2011/06/28 06:21:26.14 server Downgrade : Downgrading sysattributes
system table.
00:0006:00000:00006:2011/06/28 06:21:26.16 server Downgrade : Downgrading syscomments
system table.
00:0006:00000:00006:2011/06/28 06:21:26.19 server Downgrade : Truncated role password,
locked role and removed columns locksuid, lockreason, lockdate from syssrvroles
00:0006:00000:00006:2011/06/28 06:21:26.21 server Downgrade : Removing catalog changes
for RSA Keypair Regeneration Period and Login Profile
00:0006:00000:00006:2011/06/28 06:21:26.21 server Downgrade : Turning on database
downgrade indicator.
00:0006:00000:00006:2011/06/28 06:21:26.21 server Downgrade : Resetting database version
indicator.
00:0006:00000:00006:2011/06/28 06:21:26.21 server ASE downgrade completed.
After running sp_downgrade, shut down the server to avoid new logins or other
actions that may modify data or system catalogs.
If you restart Adaptive Server at version 15.7:
• After successfully executing sp_downgrade and shutting down the server,
Adaptive Server performs internal upgrade actions again, and any changes
to system tables are upgraded to version 15.7.
• Before starting an earlier version of Adaptive Server to which you are
reverting, you must execute sp_downgrade again.
You can enable locked roles and truncated password. In this example, the
output of sp_displayroles shows that the downgrade process has locked
“doctor_role” and truncated its password:
select srid,status,name,password from syssrvroles
go
suid status name password
This chapter describes the Adaptive Server features that enable you to
authenticate users with authentication data stored in repositories that are
external to Adaptive Server.
Topic Page
Configuring Adaptive Server for network-based security 118
Concurrent Kerberos authentication 147
Configuring Adaptive Server for LDAP user authentication 148
LDAPS user authentication enhancements 165
Automatic LDAP user authentication and failback 166
Configuring Adaptive Server for authentication using PAM 168
Enhanced login controls 172
Security mechanism
connection
3 Upon receiving the data packet, Adaptive Server uses the security
mechanism to perform any required decryption and validation.
4 Adaptive Server returns results to the client, using the security mechanism
to perform the security functions that were requested; for example,
Adaptive Server may return the results in encrypted form.
Note The security mechanism you are using may not employ all of these
services. See “Getting information about available security services” on
page 134.
For a detailed description of the configuration files, see the Open Client/Server
Configuration Guide for your platform.
Note The dsedit tool, which helps you create entries for either the
interfaces file or a Directory Service, is available on UNIX platforms.
However, it does not support the creation of secmech entries for security
mechanisms.
For more information about dscp, see the Open Client/Server Configuration
Guide for UNIX.
Desktop tools for To provide information about the servers for your installation in the sql.ini file
specifying server or a Directory Service, use the dsedit utility. This utility provides a graphical
attributes
user interface for specifying server attributes such as the server version, name,
and security mechanism. For the security mechanism attribute, you can specify
one or more object identifiers for the security mechanisms you plan to use. For
information about using dsedit, see the Open Client/Server Configuration
Guide for Desktop Platforms.
Note If you do not specify a network driver, an appropriate driver for your
application and platform is automatically used. For example, for UNIX
platforms, a driver that can handle threads is automatically chosen when
security services are being used.
Entries for Directory Directory Services entries apply if you want to use a Directory Service instead
Services of the interfaces file. See the configuration documentation for your platform,
and the Open Client/Server Configuration Guide for your platform.
Entries for security The syntax for a security driver entry is:
drivers
provider=driver init-string
where:
• provider – is the local name for the security mechanism. The mapping of
the local name to a global object identifier is defined in objectid.dat.
The default local names are:
• “csfkrb5” – for the CyberSAFE or MIT Kerberos security
mechanism.
• “LIBSMSSP” – for Windows LAN Manager on Windows NT or
Windows 95 (clients only).
If you use a local mechanism name other than the default, change the local
name in the objectid.dat file (For an example, see “The objectid.dat file”
on page 125).
• driver – is the name of the security driver. The default location of all drivers
for UNIX platforms is $SYBASE/$SYBASE_OCS/lib. The default location
for Windows platform is %SYBASE%\%SYBASE_OCS%\dll.
• init-string – is an initialization string for the driver. This element is optional.
The value for init-string varies by driver:
• Kerberos driver – the following is the syntax for init-string, where
realm is the default Kerberos realm name:
secbase=@realm
• Windows NT LAN Manager – init-string is not applicable.
UNIX platform No special tools for editing the libtcl.cfg file are available. Use your favorite
information editor to comment and uncomment the entries that are already in place after
you install Adaptive Server.
After you install Adaptive Server on a UNIX platform, the libtcl.cfg file
already contains entries for the three sections of the file:
• [DRIVERS]
• [DIRECTORY]
• [SECURITY]
The sections do not have to be in a specific order.
Make sure that the entries you do not want to use are commented (begin with
“;”) and the entries you want are uncommented (do not begin with “;”).
For more information, see the Open Client/Server Configuration Guide for
UNIX
Sample libtcl.cfg for
Sun Solaris
[DRIVERS]
;libtli.so=tcp unused ; This is the non-threaded tli driver.
;libtli_r.so=tcp unused ; This is the threaded tli driver.
[SECURITY]
csfkrb5=libsybskrb.so secbase=@MYREALM libgss=/krb5/lib/libgss.so
This file does not use Directory Services because all [DIRECTORY] section
entries are commented.
Because all entries in the [DRIVERS] section for network drivers are also
commented, appropriate drivers are automatically chosen by the system.
Adaptive Server automatically chooses a threaded driver when you use
security services, and chooses an unthreaded driver for applications that cannot
work with threaded drivers. For example, Backup Server does not support
security services and does not work with a threaded driver.
Desktop platform The ocscfg utility automatically creates section headings for the libtcl.cfg file;
information you can also use osccfg to edit the libtcl.cfg file.
This is a sample libtcl.cfg file for desktop platforms:
[NT_DIRECTORY]
ntreg_dsa=LIBDREG ditbase=software\sybase\serverdsa
[DRIVERS]
NLWNSCK=TCP Winsock TCP/IP Net-Lib driver
NLMSNMP=NAMEPIPE Named Pipe Net-Lib driver
NLNWLINK=SPX NT NWLINK SPX/IPX Net-Lib driver
NLDECNET=DECNET DecNET Net-Lib driver
[SECURITY]
NTLM=LIBSMSSP
See the Open Client/Server Configuration Guide for Desktop Platforms.
Note You can specify only one local name per security mechanism.
Note In a production environment, control access to files that contain the keys
of the servers and users. If users can access the keys, they can create a server
that impersonates your server.
See the documentation available from the third-party provider of the security
mechanism for detailed information about how to perform required
administrative tasks.
Note More than one user can assume the suid associated with the secure
default login. Therefore, you might want to activate auditing for all
activities of the default login. You may also want to consider using create
loign to add all users to the server.
Therefore, consider whether you want to allow only those users who are
defined as valid logins to use Adaptive Server, or whether you want users to be
able to log in with the default login. To define the default, add the default login
in master..syslogins and use sp_configure. See “Establishing a secure default
login” on page 127.
For remote server logins through Adaptive server for RPC execution, one
physical connection is established between the two servers. The servers use the
physical connection to establish one or more logical connections—one logical
connection for each RPC.
Adaptive server supports end-to-end Kerberos authentication for Kerberos
logins that attempt remote server connections through CIS using the credential
delegation feature provided by Kerberos version 5.
The credential delegation or ticket forwarding allows a Kerberos client to
delegate the credential when connecting to a server, thereby allowing the server
to initiate Kerberos authentication for further connections to other servers on
behalf of Kerberos client.
A Kerberos client connected to Adaptive server can request a Remote
Procedure Call (RPC) to Adaptive Server, and for general distributed query
processing requests to a remote Adapter Server through CIS by using the
Kerberos credential delegation feature. The Kerberos authentication feature
used for connections to remote Adaptive servers is not supported for remote
server logins. For information about configuring CIS Kerberos Authentication,
see “Configuration for Component Integration Services Remote Procedure
Calls,” in Chapter 2, “Understanding Component Integration Services” in the
Component Integration Services User Guide.
• -V security_options
• -Z security_mechanism
Using Kerberos
Kerberos is a network authentication protocol that uses secret-key
cryptography so that a client can prove its identity to a server across a network
connection. User credentials are obtained when the user logs in to the operating
system, or by executing an authentication program. Each application uses these
credentials to perform authentication. Users only have to log in once, instead
of having to log in to each application.
Kerberos assumes the key distribution center (KDC) is running and properly
configured for your realm, and the client libraries are installed under or on each
client host in your realm. For configuration information, consult the
documentation and the reference pages that come with the Kerberos software.
Adaptive Server supports Kerberos through:
• CyberSafe Kerberos libraries
• MIT Kerberos libraries, version 1.3.1
• Native libraries
Note To enable Kerberos security options, you must have ASE_SECDIR, the
“Security and directory services” package.
Kerberos compatibility
Table 5-5 shows which variation of Kerberos is supported on which platforms.
Table 5-5: Adaptive Server Kerberos interoperability
Hardware platforms KDC server Generic security standard (GSS) client
Solaris 32 CSF, AD, MIT CSF, MIT, Native
Solaris 64 CSF, AD, MIT CSF, MIT, Native
Linux 32 CSF, AD, MIT MIT, Native
Windows 32 CSF, AD CSF
AIX 32 CSF CSF
Configuring Kerberos
The configuration process is similar, regardless of which variety of Kerberos
you use.
1 Set up Kerberos third-party software and create a Kerberos administrative
user. To do this, you must:
a Install Kerberos client software on machines where Open Client
Server clients or Adaptive Server will run. The following client
packages have been verified to work with:
• CyberSafe TrustBroker 4.0
• MIT Kerberos version 1.3.1
b Install the Kerberos KDC server on a separate, dedicated machine.
Extracting the keytab file for use with Adaptive Server requires an
optional tool called ktpass, which is included in the Microsoft Support
Tools package.
With Active Directory, extracting the keytab with ktpass is a separate step
from creating the principal. The keytab file on Windows for Adaptive
Server is located with the CyberSafe program files. For example,
c:\Program Files\CyberSafe\v5srvtab is the expected location of the
Adaptive Server keytab file when CyberSafe software is installed on the
C: drive.
4 Add a Kerberos principal for the user “sybuser1” as
“sybuser1@MYREALM”.
5 Start Adaptive Server and use isql to log in as “sa”. The following steps
configure Adaptive Server parameters to use Kerberos security services,
and create the user login account. These are the same on both Windows or
UNIX machines:
• Change configuration parameter use security services to 1:
sp_configure 'use security services', 1
• Add a new login for user, “sybuser1” and then add the user:
create login sybuser1 with password password
6 Shut down Adaptive Server and modify administrative files and
connectivity configuration files.
• On UNIX platforms – the interfaces file is under $SYBASE/ and has
an entry that looks similar to:
ase120srv
master tli tcp myhost 2524
query tli tcp myhost 2524
secmech 1.3.6.1.4.1.897.4.6.6
On Windows platforms – the sql.ini file is in %SYBASE%\ini, and has
an equivalent server entry that looks like:
[ase120srv]
master=TCP,myhost,2524
query=TCP,myhost,2524
secmech=1.3.6.1.4.1.897.4.6.6
Use either the setenv command or the -k dataserver option to set the principal
name.
By default, the principal name is the name of Adaptive Server. To specify a
different name, set SYBASE_PRINCIPAL before starting Adaptive Server to
use Kerberos:
setenv SYBASE_PRINCIPAL <name of principal>
Once you have set an Adaptive Server principal name, Adaptive Server uses
the value of this variable to authenticate itself to Kerberos.
To specify an Adaptive Server principal name when starting Adaptive Server,
use:
-k <server principal name>
When you start an Adaptive Server with the Kerberos security mechanism
enabled, Adaptive Server first uses the principal name specified with the -k
option for Kerberos authentication. If the -k option is not specified, Adaptive
Server looks for the principal name in the environment variable
SYBASE_PRINCIPAL. If neither is specified, Adaptive Server uses the server
name for authentication.
Adaptive Server accepts Kerberos Open Client connections that use different
server principal names if the entry for the principal name is present in the
keytab file. To allow connections with different principal names:
• Pass an empty string as a parameter for the -k option, or
• Set the SYBASE_PRINCIPAL environment variable to "". For example:
export SYBASE_PRINCIPAL=""
Example In this example, the Adaptive Server name is “secure_ase” and the realm name
is “MYREALM.COM.” The Adaptive Server name is specified on the
command line with -s parameter to the dataserver. The current realm is
specified in libtcl.cfg by a secbase attribute value:
[SECURITY]
csfkrb5=libskrb.so libgss=/krb5/lib/libgss.so [email protected]
The default Adaptive Server principal name is
“[email protected].” If the principal name defined in the
Adaptive Server keytab file is “[email protected],” you can
override the default Adaptive Server principal name by setting a server
principal name using options 1 or 2 below:
• Option 1, specify -k '':
%
$SYBASE/$SYBASE_ASE/bin/dataserver -dmaster.dat
-s secure_ase -k [email protected]
The Adaptive Server principal name used to authenticate with Kerberos is
“[email protected].”
• Option 2, set SYBASE_PRINCIPAL:
setenv SYBASE_PRINCIPAL [email protected]
$SYBASE/$SYBASE_ASE/bin/dataserver –dmaster.dat
-s secure_ase
The Adaptive Server principal name used to authenticate with Kerberos is
“[email protected],” the value of $SYBASE_PRINCIPAL.
• Option 3, neither -k nor SYBASE_PRINCIPAL is set:
% $SYBASE/$SYBASE_ASE/bin/dataserver –dmaster.dat
-s secure_ase
The Adaptive Server principal name used to authenticate with Kerberos is
“[email protected].”
Use the sybmapname shared object to perform the custom mapping between
the user principal name and the Adaptive Server login name. This shared object
is optionally loaded at server start-up, and the function syb__map_name
contained in the shared object is called after a successful Kerberos
authentication and just before the user principal is mapped to a login in the
syslogins table. This function is useful when the user principal name and the
login name to be mapped are not identical.
syb__map_name(NAMEMAPTYPE *protocol, char *orig,
int origlen, char *mapped, int *mappedlen)
where:
• NAMEMAPTYPE *protocol – refers to a structure reserved for usage of this
function.
• char *orig – is an input buffer that is not null-terminated.
• int origlen – is the input buffer length, which should be less than or equal
to 255 characters.
• char *mapped – is an output buffer that should not be null-terminated.
Note Sybase recommends that only the “sybase” user is allowed read and
execute permissions, and that all other access should be denied.
Verifying your login to To verify your login to Adaptive Server using Kerberos authentication, assume
Adaptive Server using that:
Kerberos
authentication • $SYBASE refers to your release and installation directory.
• $SYBASE_ASE refers to the Adaptive Server version directory that
contains your server binary.
• $SYBASE_OCS refers to the Open Client/Server version directory.
Example 1 If a client’s principal name is user@REALM, and the
corresponding entry in syslogins table is user_REALM, you can code
sybmapname to accept the input string user@realm and to convert the input
string to the output string user_REALM.
Example 2 If the client principal name is user, and the corresponding entry
in syslogins table is USER, then sybmapname can be coded to accept the input
string user and convert this string to uppercase string USER.
sybmapname is loaded by Adaptive Server at runtime and uses its logic to do
the necessary mapping.
The following actions and output illustrate the sybmapname function described
in Example 2. The sybmapname.c file containing the customized definition for
syb__map_name() should be compiled and built as a shared object (or DLL),
and finally placed in the appropriate path location. Start Adaptive Server with
the Kerberos security mechanism enabled.
To initialize the Ticket Granted Ticket (TGT), which is a encrypted file that
provides identification:
$ /krb5/bin/kinit johnd@public
Password for johnd@public:
$
To list the TGT:
$ /krb5/bin/klist
Cache Type: Kerberos V5 credentials cache
Cache Name: /krb5/tmp/cc/krb5cc_9781
• base | one | sub – qualifies the search criteria. base specifies a search of
the base node; one specifies a search of the base node and one sublevel
below the base node; sub specifies a search of the base node and all node
sublevels.
• filter – specifies the attribute or attributes to be authenticated. The filter can
be simple, such as uid=*, or compound, such as (uid=*)(ou=group).
Composed DN algorithm
This is the login sequence when you use the composed DN algorithm:
1 Open Client connects to an Adaptive Server listener port.
2 The Adaptive Server listener accepts the connection.
3 Open Client sends an internal login record.
4 Adaptive Server reads the login record..
5 Adaptive Server binds to the LDAP server with a DN composed from the
primary URL and the login name from the login record. This bind also
uses the password from the login record.
6 The LDAP server authenticates the user, returning either a success or
failure message.
7 If the Primary URL specifies a search, then Adaptive Server sends the
search request to the LDAP server.
8 The LDAP server returns the results of the search.
9 Adaptive Server accepts or rejects the login, based on the search results.
Searched DN algorithm
This is the login sequence when you use the searched DN algorithm:
1 Open Client connects to an Adaptive Server listener port.
2 The Adaptive Server listener accepts the connection.
3 Open Client sends an internal login record.
4 Adaptive Server reads the login record.
5 Adaptive Server binds to the LDAP server with a directory server access
account.
The connection established in steps 5 and 6 may persist between
authentication attempts from Adaptive Server to reuse connections to DN
searches.
6 The LDAP server authenticates the user, returning either a success or
failure message.
7 Adaptive Server sends search requests to the LDAP server based on the
login name from the login record and the DN lookup URL.
8 The LDAP server returns the results of the search.
9 Adaptive Server reads the results to obtain an a value of attribute from the
DN lookup URL.
10 Adaptive Server uses the value of attribute as the DN and the password
from the login record to bind to the LDAP server.
11 The LDAP server authenticates the user, returning either a success or
failure message.
12 If the primary URL specifies a search, Adaptive Server sends the search
request to the LDAP server.
13 The LDAP server returns the results of the search.
14 Adaptive Server accepts or rejects the login, based on the search results.
Adaptive Server reports a generic login failure to the client if any of these
authentication criteria are not met.
You may skip steps 12 and 13 by not specifying search criteria in the primary
or secondary URL strings. The authentication completes, displaying the
success or failure returned by step 11.
Configuring LDAP
You can configure Adaptive Server for LDAP authentication and migrate
existing Adaptive Servers to LDAP.
• The Adaptive Server login name is the same as the short user name for
example, a UNIX user name.
• The DN uses the short user name rather than a full name with embedded
spaces or punctuation. For example, jqpublic meets the restriction for a DN,
but “John Q. Public” does not.
iPlanet example LDAP vendors may use different object names, schema, and attributes than
those used in these examples. There are many possible LDAP URL search
strings, and valid sites may also extend schemas locally or use them in ways
that differ from each other:
• This example uses the uid=* filter. To compose the DN, Adaptive Server
replaces the wildcard with the Adaptive Server login name to be
authenticated, and appends the resulting filter to the node parameter in the
LDAP URL. The resulting DN is:
uid=myloginname,ou=People,dc=mycomany,dc=com
• After a successful bind operation, Adaptive Server uses the connection to
search for attribute names, such as uid, that are equal to the login name:
sp_ldapadmin set_primary_url,
'ldap://myhost:389/ou=People,dc=mycompany,dc=com??sub?uid=*'
• This example uses the schema defined in OpenLDAP 2.0.25, with an
attribute name of cn.
The composed DN is cn=myloginname,dc=mycompany,dc=com:
sp_ldapadmin set_primary_url,
'ldap://myhost:389/dc=mycompany,dc=com??sub?cn=*'
Searched DN Use the searched DN to use an Active Directory server or other LDAP server
examples environment that does not meet the restrictions to use the composed DN
algorithm.
• Perform these steps for an Active Directory server using a commercially
available user schema from a Windows 2000 Server.
a Set the access account information:
sp_ldapadmin set_access_acct,
'cn=Admin Account, cn=Users, dc=mycompany, dc=com',
'Admin Account secret password'
b Set the primary URL:
sp_ldapadmin set_primary_url, 'ldap://hostname:389/
c Set the DN lookup URL search string:
sp_ldapadmin set_dn_lookup_url,
'ldap://hostname:389/cn=Users,dc=mycompany,dc=com?distinguishedName
?one?samaccountname=*'
On Windows 2000, the short name is typically referred to as the “User Logon
Name” and is given the attribute name samaccountname in the default schema.
This is the attribute name used to match the Adaptive Server login name. The
DN for a user contains a full name with punctuation and embedded spaces (for
example, cn=John Q. Public, cn=Users, dc=mycomany, dc=com. The
DN on Windows does not use the short name, so the searched DN algorithm is
appropriate for sites using the Active Directory schema (the default) as the
LDAP server. The primary URL does not specify a search. Instead, it relies on
the bind operation for authentication.
Examples using You can use LDAP URL search strings to restrict access to groups of users on
search filters to LDAP servers. For example, to restrict logins to users in an accounting group.
restrict Adaptive
Server access use a compound filter to restrict access to the group of users where attribute
group=accounting.
• The following LDAP URL string uses the composed DN algorithm for an
iPlanet server:
sp_ldapadmin set_primary_url,
'ldap://myhost:389/ou=People,dc=mycompany,
dc=com??sub?(&(uid=*)(group=accounting))'
Adaptive Server binds with DN
uid=mylogin,ou=People,dc=mycompany,dc=com. After successfully
binding with this identity, it searches for:
"ou=People,dc=mycompany,dc=com??sub?(&(uid=mylogin)(group=accounting))"
Authentication succeeds if this search returns any objects.
• These examples use LDAP URL strings with compound filters:
sp_ldapadmin set_primary_url,
'ldap://myhost:389/ou=people,dc=mycompany,dc=com??s
ub?(&(uid=*)(ou=accounting) (l=Santa Clara))'
sp_ldapadmin, set_primary_url,
'ldap://myhost:389/ou=people,dc=mycompany,dc=com??s
ub?(&(uid=*)(ou=Human%20Resources))'
Failover support
When a major failure occurs in the LDAP directory server specified by the
primary URL, and the server no longer responds to network requests, Adaptive
Server attempts to connect to the secondary LDAP directory server specified
by the secondary URL. Adaptive Server uses the LDAP function ldap_init to
determine if it can open a connection to the LDAP directory server. A null or
invalid primary URL string causes Adaptive Server to attempt to fail over to a
secondary URL. Failures returned by LDAP bind or search operations do not
cause Adaptive Server to fail over to the secondary URL.
Note Once Adaptive Server has failed over to the secondary LDAP server, a
database administrator must manually activate the primary LDAP server
before it can be used again.
• To display details about the primary and secondary LDAP server settings
and status, enter:
sp_ldapadmin list
Table 5-7 shows the state transitions when you execute sp_ldapadmin set_URL,
where set_URL represents one of these commands:
• set_dn_lookup_url
• set_primary_url
• set_secondary_dn_lookup_url
• set_secondary_url
Table 5-7: State transitions when sp_ldapadmin set_URL is executed
Initial state Final state
INITIAL RESET
RESET RESET
READY READY
ACTIVE RESET
FAILED RESET
SUSPENDED RESET
Table 5-8 shows the state transitions when you execute sp_ldapadmin suspend.
Table 5-8: State transitions when sp_ldapadmin suspend is executed
Initial state Final state
INITIAL Error
RESET SUSPENDED
READY SUSPENDED
ACTIVE SUSPENDED
FAILED SUSPENDED
SUSPENDED SUSPENDED
Table 5-9 shows the state transitions when you execute sp_ldapadmin activate.
Table 5-9: State transitions when sp_ldapadmin activate is executed
Initial state Final state
INITIAL Error
RESET READY
READY READY
ACTIVE ACTIVE
FAILED READY
SUSPENDED READY
The following tables show the LDAP server state transitions carried out
implicitly by Adaptive Server.
Table 5-10 shows the state transitions when Adaptive Server is restarted:
Table 5-10: State transitions when Adaptive Server is restarted
Initial state Final state
INITIAL INITIAL
RESET RESET
Table 5-12 shows the state transitions when an LDAP login fails:
Table 5-12: State transitions when an LDAP login fails
Initial state Final state
READY FAILED
ACTIVE FAILED
Use these sp_ldapadmin options to configure the LDAP server for better
performance:
• set_max_ldapua_desc – manages the concurrency of the LDAPUA
connection requests. If you are using a distinguished name algorithm,
setting set_max_ldapua_desc to a larger number expedites the LDAPUA
connections Adaptive Server is processing.
• set_num_retries – sets the number of attempts. Tune this number according
to the number of transient errors between Adaptive Server and the LDAP
server. You can nullify transient errors by configuring the number of
retries.
• set_log_interval – controls the number of messages sent to the Adaptive
Server error log for diagnostic purposes. Using a low number clutters the
error log may be helpful in identifying specific errors. Using a large
number sends fewer messages to the error log, but does not have the same
investigative value. Tune set_log_interval according to your error log size.
Only users with sso_role can create or modify login mappings using
sp_maplogin.
Example 2 Uses both PAM and LDAP to map users to application logins. A
company has adopted both PAM and LDAP authentication but for different
purposes. The company security policy defines LDAP as the authentication
mechanism for general user accounts, and PAM for special users, such as for a
middle-tier application. A middle-tier application may establish a pool of
connections to Adaptive Server to handle requests on behalf of users of the
middle-tier application.
Configure Adaptive Server for both LDAP and PAM user authentication:
sp_configure 'enable ldap user auth', 2
go
sp_configure 'enable pam user auth', 2
go
Establish an Adaptive Server login appX locally with permissions that are
appropriate for the middle-tier application:
create login appX with password myPassword
go
alter login appX authenticate with PAM
go
Instead of hard-coding a simple password in “appX” and maintaining the
password consistently in several different Adaptive Servers, develop a custom
PAM module to authenticate the application in a centralized repository using
additional facts to verify the middle-tier application.
Client application login “appY” requires LDAP authentication of the user with
its LDAP identity and password. Use sp_maplogin to map all LDAP
authenticated users to login “appY,”
create login appY with password myPassword
go
sp_maplogin LDAP, NULL, 'appY'
go
Users of “appY” are authenticated with their company identity and password,
then mapped to a local Adaptive Server login “appY” to execute database
actions. Authentication has occurred with the identity of the LDAP user, which
is recorded in the audit trail, and executes with permissions appropriate to the
application login “appY.”
After you define the trusted servers, Adaptive Server configures a secure
connection, where servername is the name of the current Adaptive Server.
If you:
• Have defined $SYBASE_CERTDIR, Adaptive Server loads
certificates from $SYBASE_CERTDIR/servername.txt (for UNIX) or
%SYBASE_CERTDIR%\servername.txt (for Windows).
• Have not defined $SYBASE_CERTDIR, Adaptive Server loads
certificates from
$SYBASE/$SYBASE_ASE/certificates/servername.txt (for UNIX) or
%SYBASE%\%SYBASE_ASE%\certificates\servername.txt (for
Windows).
2 Restart Adaptive Server to change the trusted root certificate file.
3 Use sp_ldapadmin, specifying ldaps:// URLs instead of ldap:// URLs, to
establish a secure connection to a secure port of the LDAP server.
4 Establish a TLS session over a plain TCP connection:
sp_ldapadmin 'starttls_on_primary', {true | false}
or
sp_ldapadmin 'starttls_on_secondary', {true | false}
Note LDAP server connections do not have a connect timeout option; if the
LDAP server stops responding, all login connections also stop responding.
Examples
This example sets the LDAP failback time interval to 60 minutes:
sp_ldapadmin 'set_failback_interval' 60
This example sets the LDAP failback
time interval to the default, 15 minutes:
sp_ldapadmin 'set_failback_interval' -1
This example displays the value to which the failback interval is set:
sp_ldapadmin 'set_failback_interval'
The LDAP property 'set_failback_interval' is set to '15
minutes'.
Authentication syslogins
Account management
Password management
Session management
LDAP Server
Authentication
PAM
Account management
Integrated
PAM API PAM SPI login, Kerberos
and so on
Custom
authentication
Adaptive Server passes the login name and credentials obtained from the login
packet to the PAM API. PAM loads a service provider module as specified in
the operating system configuration files and calls appropriate functions to
complete the authentication process.
Note PAM modules you create should comply with RFC 86.0 “Unified Login
With Pluggable Authentication Modules (PAM).” Adaptive Server supports
the authentication management module of the RFC. It does not support the
account management, session management, or password management
modules.
$ ls /usr/lib/security/sparcv9/pam_sec.so.1
pam_sec.so.1 -> /SYBASE/pam_sec_64bits.so.1
Forcing authentication
You can force a login to use a specific authentication process by using these
parameters for alter login and create login:
• ASE – use Adaptive Server internal authentication using passwords from
syslogins table.
1 LDAP.
2 Pluggable Authentication Modules (PAM). If both LDAP and PAM are
enabled, PAM authentication is never attempted for a user.
3 If neither PAM nor LDAP is enabled, Adaptive Server uses syslogins to
authenticate the login.
Login accounts such as “sa” continue to be validated using the syslogins
catalog. Only the SSO role can set authenticate for a login.
For example, the following authenticates the login with alter login:
alter login nightlyjob modify authenticate with ASE
sp_displaylogin "nightlyjob"
Displays output similar to:
Suid: 1234
Loginname: nightlyjob
Fullname: Batch Login
Default Database: master
. . .
Date of Last Password Change: Oct 2 2003 7:38 PM
Password expiration interval: 0
Password expired: N
Minimum password length:
Maximum failed logins: 0
Current failed login attempts:
Authenticate with: ASE
This example maps external user “jsmith” to the Adaptive Server user “guest.”
Once authenticated, “jsmith” has the privileges of “guest.” The audit login
record shows both the client_username and the Adaptive Server user name:
sp_maplogin NULL, "jsmith", "guest"
This example tells Adaptive Server to create a new login for all external users
authenticated with LDAP, if a login does not already exist:
sp_maplogin LDAP, NULL, "create login"
Overview
Discretionary access controls (DACs) allow you to restrict access to
objects and commands based on a user’s identity, group membership and
active roles. The controls are “discretionary” because a user with a certain
access permission, such as an object owner, can choose whether to pass
that access permission on to other users.
grant and revoke can also be used to set permissions on system tables.
Note You cannot change the ownership of the master, model, tempdb, or
sybsystemprocs databases and should not change the ownership of any other
system databases.
• checkpoint
• dbcc
• alter database
• online database
• drop database
• dump database
• dump transaction
• load database
• load transaction
• setuser
Database owners can grant permission to use create database, set tracing,
and connect if they have the sa_role and are in the master database.
• all – if you are the database owner, all grants permissions for all create
commands except create database, create trigger and create encryption key.
• default permissions on system tables
• Use dbcc commands:checkalloc, checkcatalog, checkdb, checkindex,
checkstorage, checktable, checkverify, fix_text, indexalloc, reindex,
tablealloc, textalloc, tune
Initially, object access permissions on new_authors belong only to Joe. Joe can
grant or revoke object access permissions for this table to other users.
The following object altering permissions default to the owner of a table and
cannot be transferred to other users:
• alter table
• drop table
• create index
Permission to use the grant and revoke commands to grant specific users select,
insert, update, delete, references, decrypt, truncate table, update statistics, delete
statistics, and execute permissions on specific database objects can be
transferred, using the grant with grant option command.
Permission to drop an object—a table, view, index, stored procedure, rule,
encryption key, trigger, or default—defaults to the object owner and cannot be
transferred.
You can grant select, update and delete permission using a where clause that
can restrict access on a row by row basis based on the condition in the where
clause. See “Granting Predicated Privileges” on page 251.
Concrete identification
Adaptive Server identifies users during a session by login name. This
identification applies to all databases in the server. When the user creates an
object, the server associates both the owner’s database user ID (uid) and the
creator’s login name with the object in the sysobjects table. This information
concretely identifies the object as belonging to that user, which allows the
server to recognize when permissions on the object can be granted implicitly.
If an Adaptive Server user creates a table and then creates a procedure that
accesses the table, any user who is granted permission to execute the procedure
does not need permission to access the object directly. For example, by giving
user “mary” permission on proc1, she can see the id and descr columns from
table1, though she does not have explicit select permission on the table:
create table table1 (id int,
amount money,
descr varchar(100))
create procedure proc1 as select id, descr from table1
grant execute on proc1 to mary
There are, however, some cases where implicit permissions are only useful if
the objects can be concretely identified. One case is where aliases and
cross-database object access are both involved.
Permissions required:
set ansi_permissions off Permissions required: set ansi_permissions on
delete delete permission on the table delete permission on the table from which rows are being deleted
and
select permission on all columns appearing in the where clause
Since roles are automatically added as users in a database on their first grant in
a database, there are no additional requirements when roles are granted dbcc
privileges. Logins must be valid users in the database where permissions are
granted. Valid users include “guest.”
For server-wide dbcc commands, the login must be a valid user in master, and
the system administrator must be in master when granting the permission.
For database-specific dbcc commands the login should be a valid user in the
target database.
Default permissions applies select to public on all system tables, with these
exceptions:
• Revokes select on syscolumns(encrkeyid) from public
• Revokes select on syscolumns(encrkeydb) from public
• Grants select on syscolumns to sso_role
• Revokes sysobjects(audflags) permissions from public
• Grants permissions for sysobjects to sso_role
• Revokes select on all columns of sysencryptkeys from public
• Grants select on all columns of sysencryptkeys to sso_role
If you run this command from the master database, default permissions for the
following system tables are granted or revoked:
syscharsets syslanguages sysmessages sysservers
sysconfigures syslisteners sysmonitor syssessions
syscurconfigs syslocks sysprocesses syssrvroles
sysdatabases syslogin sysremotelogins systimeranges
sysdevices sysloginrole sysresourcelimits systransactions
sysengines syslogshold syssecmechs sysusages
Note Under SQL rules, you must use the grant command before using the
revoke command, but the two commands cannot be used within the same
transaction. Therefore, when you grant “public” access to objects, and then
revoke that access from an individual, there is a short period of time during
which the individual has access to the objects in question. To prevent this
situation, use the create schema command to include the grant and revoke
clauses within one transaction.
Using setuser
A database owner may use setuser to:
• Access an object owned by another user
• Grant permissions on an object owned by another user
• Create an object that will be owned by another user
• Temporarily assume the DAC permissions of another user for some other
reason
While the setuser command enables the database owner to automatically
acquire another user’s DAC permissions, the command does not affect the
roles that have been granted.
setuser permission defaults to the database owner and cannot be transferred.
The user being impersonated must be an authorized user of the database.
Adaptive Server checks the permissions of the user being impersonated.
System administrators can use setuser to create objects that will be owned by
another user. However, system administrators operate outside the DAC
permissions system; therefore, they need not use setuser to acquire another
user’s permissions. The setuser command remains in effect until another
setuser command is given, the current database is changed, or the user logs off.
A user executing set proxy or set session authorization operates with both the
login name and server user ID of the user being impersonated. The login name
is stored in the name column of master..syslogins and the server user ID is
stored in the suid column of master..syslogins. These values are active across
the entire server in all databases.
Note set proxy and set session authorization are identical in function and can
be used interchangeably. The only difference between them is that set session
authorization is ANSI-SQL92-compatible, and set proxy is a Transact-SQL
extension.
For example, this grants set proxy to user “joe” but restricts him from switching
identities to any user with the sa, sso, or admin roles (however, if he already
has these roles, he can set proxy for any user with these roles):
grant set proxy to joe
restrict role sa_role, sso_role, admin_role
When “joe” tries to switch his identity to a user with admin_role (in this
example, Our_admin_role), the command fails unless he already has
admin_role:
set proxy Our_admin_role
Msg 10368, Level 14, State 1:
Server 's', Line 2:Set session authorization permission
denied because the target login has a role that you do
not have and you have been restricted from using.
After “joe” is granted the admin_role and retries the command, it succeeds:
grant role admin_role to joe
set proxy Our_admin_role
For more information about the set proxy command, see the Reference
Manual: Commands.
If you have a login that has been granted permission to use set proxy or set
session authorization, you can set proxy to impersonate another user. The
following is the syntax, where login_name is the name of a valid login in
master..syslogins:
set proxy login_name
or
set session authorization login_name
Enclose the login name in quotation marks.
For example, to set proxy to “mary,” execute:
set proxy "mary"
After setting proxy, check your login name in the server and your user name in
the database. For example, assume that your login is “ralph” and that you have
been granted set proxy authorization. You want to execute some commands as
“sallyn” and as “rudolph” in pubs2 database. “sallyn” has a valid name
(“sally”) in the database, but Ralph and Rudolph do not. However, pubs2 has a
“guest” user defined. You can execute:
set proxy "sallyn"
go
use pubs2
go
select suser_name(), user_name()
go
------------------------------ -------------------
sallyn sally
To change to Rudolph, you must first change back to your own identity. To do
so, execute:
set proxy "ralph"
select suser_name(), user_name()
go
------------------------------ --------------------
ralph guest
Notice that Ralph is a “guest” in the database.
Then execute:
set proxy "rudolph"
go
select suser_name(), user_name()
go
------------------------------ --------------------
rudolph guest
Rudolph is also a guest in the database because Rudolph is not a valid user in
the database.
Now, impersonate the “sa” account. Execute:
set proxy "ralph"
go
set proxy "sa"
go
select suser_name(), user_name()
go
--------------------------- --------------------
sa dbo
Tom, Sue, and John establish sessions The application server (“appl”) on
with the Application Server: Adaptive Server executes:
Tom Sue John
set proxy "tom"
Application Server (SQL command for Tom)
logs in as “appl”
with set proxy set proxy "sue"
permission. (SQL command for Sue)
• Check constraints
• Reference constraints
• Partition conditions
• Computed columns
Authorization
• System security officers have authorization to transfer ownership of all
objects for which ownership transfer is supported.
• Database owners have authorization to transfer ownership of objects, other
than encryption keys, with these restrictions:
• The database object owner cannot transfer the ownership of objects
concretely owned by the database owner.
An object is identified as concretely owned by a database owner if it
carries the database owner user ID as sysobjects.uid, and null or the
database owner’s user name as sysobjects.loginame.
• A user aliased to the database owner cannot transfer the ownership of
objects created by the database owner or concretely owned by the
user.
Database owner-created objects have a null value in
sysobjects.loginame. Objects concretely owned by a user carries the
user’s username in sysobjects.loginame.
Use sp_helpuser to search for and list objects and corresponding owners.
Transferring ownership
Ownership transfer can be specific to an individual object, or multiple objects
can be transferred in one command. Use preserve permissions to preserve
explicitly granted permissions of an object.
For syntax, see alter...modify owner in Reference Manual: Commands.
In this example, the database owner transfers a table owned by john to eric.
alter table john.table_audit modify owner eric
To transfer the ownership of all tables owned by john to eric, a system security
officer can execute:
alter table john.* modify owner eric
To transfer the ownership of all objects owned by john to eric, a system security
officer can execute:
alter all john.* modify owner eric
For example, bill owns table bill.encr_table which has encrypted columns and
the restricted decrypt permission configure option is set to 1. If the system
security officer explicitly granted decrypt permission on bill.encr_table to bill,
bill has the permissions alter, delete, insert, references, select, and update
which he accrued through his ownership. He also has decrypt permission
which he accrued through explicit granting by the system security officer. After
the system security officer transfers the ownership on bill.encr_table to eric with
preserve permissions, bill loses all permissions on the table except the decrypt
permission.
When preserve permissions is not specified, after the ownership transfer, the
previous owner loses permissions on the object, that are implicitly accrued
through ownership. The new implicitly accrues permissions by being given
ownership of the object.
Security issues
The system security officer or database owner should be aware of possible
security issues.
For example, alice is a user in the Accounting database and has no access to the
payroll data. She could create the procedure alicep that selects name and salary
from Accounting.dbo.payroll, and then grant execute on alicep to public. If the
system security officers accidentally changes the ownership of alicep to bill, a
privileged user with access to the payroll data with preserve permissions
option, all users can access the payroll information by executing the malicious
procedure alicep because all the permissions are set to be preserved after the
ownership change.
To avoid unauthorized usage, the system security officers or database owner
can check existing permissions on an object using sp_helprotect.
For information about the alter encryption key command, see Reference
Manual: Commands.
Reporting on permissions
Table 6-3 lists the system procedures for reporting information about proxies,
object creation, and object access permissions:
Table 6-3: System procedures for reporting on permissions
To report information on Use
Proxies system tables
Users and processes sp_who
Permissions on database objects or users sp_helprotect
Permissions on specific tables sp_helprotect
• 2 for revoke
For more information about the sysprotects table, see the Reference Manual:
Building Blocks.
set session authorization statement is not allowed inside the procedure created
with execute as owner even if the statement is in a nested procedure which is
not defined as execute as owner.
See Executing a procedure with execute as owner or execute as caller. For
syntax see, create procedure in Reference Manual: Commands.
return -1
end
else
print "You have SA role"
return 0
See “System Functions” in Reference Manual: Building Blocks for more
information about has_role.
Ordinarily, a user who creates a view needs to worry only about granting
permissions on that view. For example, say Mary has created a view called
auview1 on the authors table, which she also owns. If Mary grants select
permission to Sue on auview1, Adaptive Server allows Sue to access it without
checking permissions on authors.
However, a user who creates a view or stored procedure that depends on an
object owned by another user must be aware that any permissions he or she
grants depend on the permissions allowed by those other owners.
Adaptive Server checks the permissions on auview2 and auview1, and finds that
Sue can use them. Adaptive Server checks ownership on auview1 and authors
and finds that they have the same owner. Therefore, Sue can use auview2.
Taking this example a step further, suppose that Joe’s view, auview2, depends
on auview1, which depends on authors. Mary decides she likes Joe’s auview2
and creates auview3 on top of it. Both auview1 and authors are owned by Mary.
The ownership chain looks like this:
Figure 6-3: Ownership chains and permission checking for views, case
2
To execute proc4, Sue must have permission to execute proc4, proc2, and proc1.
Permission to execute proc3 is not necessary because proc3 and proc4 have the
same owner.
Adaptive Server checks Sue’s permissions on proc4 and all objects it references
each time she executes proc4. Adaptive Server knows which referenced objects
to check: it determined this the first time Sue executed proc4, and it saved the
information with the procedure’s execution plan. Unless one of the objects
referenced by the procedure is dropped or redefined, Adaptive Server does not
change its initial decision about which objects to check.
This protection hierarchy allows every object’s owner to fully control access to
the object. Owners can control access to views and stored procedures, as well
as to tables.
Permissions on triggers
A trigger is a special kind of stored procedure used to enforce integrity,
especially referential integrity. Triggers are never executed directly, but only as
a side effect of modifying a table. You cannot grant or revoke permissions for
triggers.
Only an object owner can create a trigger. However, the ownership chain can
be broken if a trigger on a table references objects owned by different users.
The protection hierarchy rules that apply to procedures also apply to triggers.
While the objects that a trigger affects are usually owned by the user who owns
the trigger, you can write a trigger that modifies an object owned by another
user. If this is the case, any users modifying your object in a way that activates
the trigger must have permission on the other object as well.
If Adaptive Server denies permission on a data modification command because
a trigger affects an object for which the user does not have permission, the
entire data modification transaction is rolled back.
See Chapter 19, “Triggers: Enforcing Referential Integrity,” in the
Transact-SQL User’s Guide.
• All access control checks are based on the procedure owner's permission,
his group, his system roles, his default user-defined roles, and those roles
granted to the owner that are activated in the procedure body. Roles
granted to the owner's login profile are also considered. Only those roles
activated by the procedure owner during execution of the procedure are
considered.
• Procedures defined with execute as owner, execute as caller, or with no
execute as clause, can be nested inside procedures defined with execute as
owner. Similarly procedures defined with execute as owner can be nested
inside procedures defined without the execute as clause.
Procedures called from an execute as owner procedure are executed as the
owner of the calling procedure unless the nested procedure is defined as
execute as owner.
• Temporary tables created outside the procedure are available inside the
procedure.
• Object references by the procedure are not entered into sysdepends as the
objects are resolved according to each caller of the procedure.
• select * is not expanded in syscomments.
• Plans in the procedure cache for the same procedure are not shared across
users as the objects in the procedure must be resolved to the user executing
the procedure. Because of this, procedure cache usage may increase if
many users are executing the procedure.The plan for a particular user is
reused when the user executes the procedure again.
• Audit records of statements executed within the procedure show the
procedure caller's name and execute as caller clause.
In the following example, the procedure created by user Jane has no execute as
clause. The procedure selects from jane.employee into an intermediate table
named emp_interim.:
create procedure p_emp
select * into emp_interim
from jane.employee
grant execute on p_emp to bill
Bill executes the procedure:
exec jane.p_emp
• Bill is not required to have select permission on jane.employee because
Jane owns p_emp and employee. By granting execute permission on
p_emp to Bill, Jane has implicitly granted him select permission on
employee.
• Bill must have been granted create table permission. The emp_interim table
will be owned by Bill.
In the following example, Jane creates a procedure with an identical body using
the execute as owner clause and Bill executes the procedure:
create procedure p_emp
with execute as owner as
select * into emp_interim
from jane.employee
grant execute on p_emp to bill
• Bill requires only execute permission to run the procedure successfully.
• emp_interim table is created on behalf of Jane, meaning Jane is the owner.
If Jane does not have create table permission, the procedure will fail.
In the following example, Jane creates the same procedure with the execute as
caller clause:
• If jim.p_child has been created with no execute as clause, then p_child will
be executed on behalf of Bill.
• If jim.p_child has been created with execute as owner then p_child will be
executed on behalf of Jim.
• If jim.p_child has been created with execute as caller then p_child will
execute on behalf of Bill.
Access rules
To use the row-level access control feature, add the access option to the
existing create rule syntax. Access rules restrict any rows that can be viewed or
modified.
Access rules are similar to domain rules, which allow table owners to control
the values users can insert or update on a column. The domain rule applies
restrictions to added data, functioning on update and insert commands.
Access rules apply restrictions to retrieved data, enforced on select, update, and
delete operations. Adaptive Server enforces the access rules on all columns that
are read by a query, even if the columns are not included in the select list. In
other words, in a given query, Adaptive Server enforces the domain rule on the
table that is updated, and the access rule on all tables that are read.
For example:
insert into orders_table
select * from old_orders_table
In this query, if there are domain rules on the orders_table and access rules on
the old_orders_table, Adaptive Server enforces the domain rule on the
orders_table, because it is updated, and the access rule on the old_orders_table,
because it is read.
Using access rules is similar to using views, or using an ad hoc query with
where clauses. The query is compiled and optimized after the access rules are
attached, so it does not cause performance degradation. Access rules provide a
virtual view of the table data, the view depending on the specific access rules
bound to the columns.
Access rules can be bound to user-defined datatypes, defined with sp_addtype.
Adaptive Server enforces the access rule on user tables, which frees the table
owner or database owner from the maintenance task of binding access rules to
columns in the normalized schema. For instance, you can create a user-defined
type, whose base type is varchar(30), call it username, and bind an access rule
to it. Adaptive Server enforces the access rule on any tables in your application
that have columns of type username.
Application developers can write flexible access rules using Java and
application contexts, described in “Access rules as user-defined Java
functions” on page 227, and “Using the Application Context Facility” on page
230.
Creating a table A table owner creates and populates table T (username char(30), title char(30),
classified_data char(1024)):
AA, "Administrative Assistant","Memo to President"
AA, "Administrative Assistant","Tracking Stock
Movements"
VP1, "Vice President", "Meeting Schedule"
VP2, "Vice President", "Meeting Schedule"
Creating and binding The table owner creates access rule uname_acc_rule and binds it to the
access rules username column on table T.
create access rule uname_acc_rule
as @username = suser_name()
-----------
sp_bindrule uname_acc_rule, "T.username"
Querying the table When you issue the following query:
select * from T
Adaptive Server processes the access rule that is bound to the username
column on table T and attaches it to the query tree. The tree is then optimized
and an execution plan is generated and executed, as though the user had
executed the query with the filter clause given in the access rule. In other
words, Adaptive Server attaches the access rule and executes the query as:
select * from T where T.username = suser_name().
The condition where T.username = suser_name() is enforced by the server. The
user cannot bypass the access rule.
The result of an Administrative Assistant executing the select query is:
AA, "Administrative Assistant","Memo to President"
AA, "Administrative Assistant","Tracking Stock
Movements"
Dropping an access Before you drop an access rule, you must unbind it from any columns or
rule datatypes, using sp_unbindrule, as in the following example:
sp_unbindrule "T.username",
NULL, "all"
sp_unbindrule unbinds any domain rules attached to the column by default.
1 2 jones 9999
(2 rows affected)
(return status = 0)
Example 2 Returns information from four rows:
/* return rows when deptno = 2 and ( name = "smith"
or phone = "9999" )*/
select * from testtab1
empno deptno name phone
----------- ----------- ---------- -----
1 2 smith 8282
2 2 smith 9999
3 2 smith 8888
1 2 jones 9999
(4 rows affected)
(return status = 0)
Example 3 Returns information from six rows:
/* return the rows when name = "smith" or phone = "9999"
*/
pstmt = null;
Class.forName("sybase.asejdbc.ASEDriver");
con = DriverManager.getConnection(_url);
if (con == null)
{
return (-1);
}
if (pstmt == null)
{
return (-1);
}
pstmt.setInt(1, c1);
rs = pstmt.executeQuery();
rs.next();
pno_val = rs.getInt(1);
rs.close();
pstmt.close();
con.close();
return (pno_val);
}
catch (SQLException sqe)
{
return(sqe.getErrorCode());
}
catch (ClassNotFoundException e)
{
return (-1);
}
catch (Exception e)
{
System.out.println("Unexpected exception : " +
e.toString());
e.printStackTrace();
return (-1);
}
}
}
After compiling the Java code, you can run the same program from isql, as
follows.
For example:
javac sec_class.java
jar cufo sec_class. jar sec_class.class
installjava -Usa -Password -
f/work/work/FGAC/sec_class.jar -
-D testdb
From isql:
/*to create new user datatype class_level*/
sp_addtype class_level, int
/*to create the sample secure data table*/
create table sec_data (c1 varchar(30),
c2 varchar(30),
c3 varchar(30),
clevel class_level)
/*to create the classification table for each user*/
create table sec_tab (userid int, clevel class-level
int)
The attributes that enable this coding comprise an application context. The
Application Context Facility (ACF) consists of three built-in functions that
provide a secure environment for data access, by allowing access rules to
compare against the intrinsic values assigned to users in a session.
An application context consists of context_name, attribute_name, and
attribute_value. Users define the context name, the attributes, and the values
for each context. You can use the default read-only application context that
Sybase provides, SYS_SESSION, to access some session-specific information.
This application context is shown as Table 6-4 on page 237. You can also
create your own application contexts, as described in “Creating and using
application contexts” on page 233.
The user profile, combined with the application profile, which is defined in a
table created by the system administrator, permits cumulative and overlapping
security schemes.
ACF allows users to define, store, and retrieve:
• User profiles (the roles authorized to a user and the groups to which the
user belongs)
• Application profiles currently in use
Any number of application contexts per session are possible, and any context
can define any number of attribute/value pairs. ACF context rows are specific
to a session, and not persistent across sessions; however, unlike local variables,
they are available across nested levels of statement execution. ACF provides
built-in functions that set, get, list, and remove these context rows.
------------------------
1
For more information on these functions and on list_appcontext and
rm_appcontext, see “Creating and using application contexts” on page 233.
Granting and revoking Grant and revoke privileges to users, roles, and groups in a given database to
access objects in that database. The only exceptions are create database, set
session authorization, and connect. A user granted these privileges should be a
valid user in the master database. To use other privileges, the user must be a
valid user in the database where the object is located.
Using of functions means that unless special arrangements are made, any
logged-in user can reset the profiles of the session. Although Adaptive Server
audits built-in functions, security may be compromised before the problem is
noticed. To restrict access to these built-in functions, use grant and revoke
privileges. Only users with the sa_role can grant or revoke privileges on the
built-in functions. Only the select privilege is checked as part of the
server-enforced data access control checks performed by the functions.
Valid users Functions do not have an object ID and they do not have a home database.
Therefore, each database owner must grant the select privilege for the
functions to the appropriate user. Adaptive Server finds the user’s default
database and checks the permissions against this database. With this approach,
only the owner of the users’ default database needs to grant the select privilege.
If other databases should be restricted, the owner of those databases must
explicitly revoke permission from the user in those databases.
Only the application context built-in functions perform data access control
checks on the user when you grant and revoke privileges on them. Granting or
revoking privileges for other functions has no effect in Adaptive Server.
Privileges granted to public affect only users named in the table created by the
system administrator. For information about the table, see “Using login
triggers” on page 239. Guest users have privileges only if the sa_role
specifically grants it by adding them to the table.
A system administrator can execute the following commands to grant or revoke
select privileges on specific application context functions:
• get_appcontext
• list_appcontext
• rm_appcontext
set_appcontext
Sets an application context name, attribute name, and attribute value, defined
by the attributes of an application, for a specified user session.
set_appcontext ("context_name", "attribute_name", "attribute_value")
Parameters • context_name – a row that specifies an application context name, saved as
the datatype char(30).
• attribute_name – a row that specifies an application context name, saved as
the datatype char(30)
• attribute_value – a row that specifies an application attribute value, saved
as the datatype char(255).
Examples Example 1 Creates an application context called CONTEXT1, with an
attribute ATTR1 that has the value VALUE1:
select set_appcontext ("CONTEXT1", "ATTR1", "VALUE1")
---------------
0
Example 2 Shows an attempt to override the existing application context.
The attempt fails, returning -1:
select set_appcontext("CONTEXT1", "ATTR1", "VALUE1")
--------------
-1
Example 3 Shows how set_appcontext can include a datatype conversion in
the value:
declare@val numeric
select @val = 20
select set_appcontext ("CONTEXT1", "ATTR2",
convert(char(20), @val))
------------
0
Example 4 Shows the result when a user without appropriate permissions
attempts to set the application context. The attempt fails, returning -1:
select set_appcontext("CONTEXT1", "ATTR2", "VALUE1")
--------------
-1
Usage • set_appcontext returns 0 for success and -1 for failure.
• If you set values that already exist in the current session, set_appcontext
returns -1.
• set_appcontext cannot override the values of an existing application
context. To assign new values to a context, remove the context and re-
create it using the new values.
• set_appcontext saves attributes as char datatypes. If you create an access
rule that must compare the attribute value to another datatype, the rule
should convert the char data to the appropriate datatype.
• All arguments in this function are required.
get_appcontext
Returns the value of the attribute in a specified context.
get_appcontext ("context_name", "attribute_name")
Parameters • context_name – a row specifying an application context name, saved as
datatype char(30).
• attribute_name – a row specifying an application context attribute name,
saved as datatype char(30).
Examples Example 1 Shows VALUE1 returned for ATTR1:
select get_appcontext ("CONTEXT1", "ATTR1")
-----------
VALUE1
Example 2 ATTR1 does not exist in CONTEXT2:
select get_appcontext("CONTEXT2", "ATTR1")
------------
NULL
Example 3 Shows the result when a user without appropriate permissions
attempts to get the application context:
select get_appcontext("CONTEXT1", "ATTR2")
• If the attribute you require does not exist in the application context,
get_appcontext returns “null.”
list_appcontext
Lists all the attributes of all the contexts in the current session.
list_appcontext ("context_name")
Parameters • context_name – names all the application context attributes in the session.
list_appcontext has a datatype of char(30).
Examples Example 1 Shows the results of a user with appropriate permissions listing
the application contexts:
select list_appcontext ("*", "*")
Context Name: (CONTEXT1)
Attribute Name: (ATTR1) Value: (VALUE2)
Context Name: (CONTEXT2)
Attribute Name: (ATTR1) Value: (VALUE!)
-----------
0
Example 2 Shows a user without appropriate permissions attempting to list
the application contexts. The attempt fails, returning -1.
select list_appcontext()
Select permission denied on built-in
list_appcontext, database DBID
---------
-1
Usage • list_appcontext returns 0 for success and -1 for failure.
• Since built-in functions do not return multiple result sets, the client
application receives list_appcontext returns as messages.
Permissions To use list_appcontext, the user must have appropriate permissions. For more
information, see “Setting permissions for using application context functions”
on page 231.
rm_appcontext
Removes a specific application context, or all application contexts.
rm_appcontext ("context_name", "attribute_name")
Parameters • context_name – a row specifying an application context name, saved as
datatype char(30).
• attribute_name – a row specifying an application context attribute name,
saved as datatype char(30).
Examples Example 1 Uses an asterisk ("*") to remove all attributes in the specified
context.
select rm_appcontext("CONTEXT1", "*")
---------
0
Example 2 Uses an asterisk ("*") to remove all the contexts and attributes.
select rm_appcontext("*", "*")
---------
0
Example 3 Shows a user attempting to remove a nonexistent context. The
attempt fails, returning -1.
select rm_appcontext("NON_EXISTING_CTX", "ATTR2")
---------
-1
Example 4 Shows the result of a user without appropriate permissions
attempting to remove an application context.
select rm_appcontext("CONTEXT1", "ATTR2")
---------
-1
Usage • rm_appcontext returns 0 for success, -1 for failure.
Note Some information in this section is from the article "Login Triggers in ASE
12.5" at http://www.sypron.nl/logtrig.html. Copyright 1998–2002, Rob
Verschoor/ Sypron B.V.
Login triggers execute a specified stored procedure every time a user logs in.
The login trigger is an ordinary stored procedure, except it executes in the
background. It is the last step in a successful login process, and sets the
application context for the user logging in.
Only the system security officer can register a login trigger to users in the
server.
To provide a secure environment, the system administrator must:
1 Revoke select privilege on the set_appcontext function. The owner of a
login trigger must have explicit permission to use set_appcontext, even if
the owner has sa_role.
2 Configure a login trigger from a stored procedure for each user, and
register the login trigger to the user.
3 Provide execute privilege to the login trigger that the user executes.
While (@@sqlstatus = 0)
begin
select f@retval =
set_appcontext (rtrim (@appname),
rtrim(@attr), rtrim(@value))
fetch apctx into @appname, @attr, @value
end
go
Grant permission to execute loginproc to public:
grant execute on loginproc to public
To associate the login trigger with a specific user, run alter login in the user’s
default database.
shiftstart time,
shiftend time)
2 As system administrator, insert the following rows in table access_times.
These rows indicate that user “bob” is allowed to log into Adaptive Server
on Mondays between 9:00am and 5:00pm, and user “mark” is allowed to
login to Adaptive Server on Tuesdays between 9:00am and 5:00pm.
insert into access_times
select suser_id(‘bob’), 1, ‘9:00’, ‘17:00’
go
insert into access_times
select suser_id(‘mark’), 2, ‘9:00’, ‘17:00’
go
3 As system administrator, create the limit_access_time stored procedure,
which references the access_time table to determine if login access should
be granted:
create procedure limit_access_time as
declare @curdate date,
@curdow tinyint,
@curtime time,
@cnt int,
@loginname varchar(32)
if @cnt = 0
begin
select @loginname = suser_name()
print "Aborting login [%1!]: login attempt past
normal working hours", @loginname
go
For example, dividing by zero aborts the login trigger stored procedure,
terminates the session, and causes a message to appear.
Note If the login trigger returns a negative number, the login fails.
• arithignore [overflow]
• colnames
• format
• statistics io
• procid
• rowcount
• altnames
• nocount
• quoted_identifier
• forceplan
• fmtonly
• close on endtran
• fipsflagger
• self_recursion
• ansinull
• dup_in_subquery
• or_strategy
• flushmessage
• ansi_permissions
• string_rtruncation
• prefetch
• triggers
• replication
• sort_resources
• transactional_rpc
• cis_rpc_handling
• strict_dtm_enforcement
• raw_object_serialization
• textptr_parameters
• remote_indexes
• explicit_transaction_required
• statement_cache
• command_status_reporting
• proc_return_status
• proc_output_params
Topic Page
Introduction to predicated privileges 251
Commands used for predicated privileges 252
Configuring Adaptive Server to use predicated privileges 253
Granting predicated privileges 254
Revoking predicated privileges 257
How Adaptive Server saves predicated privileges in sysprotects 258
Predicated role activation 259
Combining predicates to enforce row-level privileges 260
Understanding SQL behavior with predicated privileges 264
Chain-of-ownership effect on predicated privileges 265
ansi_permissions and predicated privileges 266
Permissions on accesses made by predicates 268
Using triggers with predicated privileges 269
Recompiling predicated privileges 269
Disallowing recursive predicate processing 271
Information leakage through predicates 271
A predicate may access other objects, such as tables, SQL functions, or built-
in functions. Access to these other objects is checked against the permissions
and roles of the predicate owner (the grantor of the predicated privilege). The
user who executes the select, update, or delete command on the object targeted
by the grant does not require explicit permission on the objects referenced by
the predicate.
Predicated privileges allow a service provider to store data in a single database,
and share the same tables for multiple customers instead of requiring separate
views and instead of triggers for each customer. Adaptive Server filters the data
for specific users according to the predicated privileges granted directly to the
user, or granted indirectly through the user’s groups or roles.
Table 7-1 compares the advantages of predicated privileges over the access
rules provided by versions of Adaptive Server earlier than 15.7, ESD #2:
Table 7-1: Differences between access rules and predicated privileges
Access rules Predicated privileges
Predicate scope Can refer only to the column to which the Can refer to any column in the table or, using
rule is bound. Multiple access rules are a sub-select, any other table or function in the
required to reference more than one current database or in other databases.
column.
Statement scope All rules apply to select, update, and Grantor specifies which predicate applies to
delete. Does not allow different which access. For example, stricter access
restrictions across different kinds of control may be imposed for updating and
access. deleting rows than for selecting rows.
Combining predicates Gives a way to combine individual rules A predicated privilege can construct an
using and or or, but does not give a way to arbitrarily complex Boolean expression. You
express precedence grouping; for may combine multiple privileges against the
example, ((rule1 and rule2) or rule3). same object based on well-defined rules.
Restricting the scope Any restriction directed at a specific You can apply a predicate to selected users,
to a subject subject must be expressed as part of the groups, or roles without the administrator
rule, such as where name = user. needing to introduce complicated logic into
the predicate.
Integration with Decoupled from SQL authorization. Strongly enforced through Adaptive Server
permissions system Requires rule analysis to understand how permission system. Diagnostic commands
users are restricted from some action. allow an application developer to predict how
the predicates modify a query .
The statement filters rows on the select command (including selects that are
part of compound commands such as select into, insert select, and update from,
and select commands wrapped by a view), as well as on select, update, and
delete commands that reference the salary column in their where clauses. The
predicate, effectively, restricts workers from seeing another worker’s salary.
Adaptive Server applies the where clause from the grant statement when a
query against the table is processed, and evaluates the conditions when a query
is executed.
Use a column or column list with the grant ... update statement to filter rows
that update only specific columns. This example allows all administrative and
medical staff to update patients’ addresses, but restricts modifications to the
medical status to only the patient’s physician:
grant update on patients (address, phone)
to public
grant update on patients (medical_status)
where USER = primary_md
to doctor_role
The update command raises a permissions error if any user other than one with
doctor_role attempts to update a patient’s medical status. It also restricts the
rows and columns that a doctor may update.
• Use with cause to revoke all predicates, name predicates, or remove only
unpredicated grants for the given access from the named grantee. If the
with clause is omitted, both predicated and non-predicated grants are
revoked. This example revokes all predicated row-level privileges granted
to user1.
revoke select on t1 with all predicates
from user1
The following omits the with clause and revokes all non-predicated select
access non-predicated grants granted to user1.
revoke select on t1 with no predicates
See the Reference Manual: Commands.
to user2
grant select on t1
where col1 = 4
to user2
The first grant is not removed because it gives user2 unconditional access on
column col1, which is stronger than the conditional access on col1 from the
second grant.
Note You must be in the master database to grant a role with an activation
predicate.
Note Although you can reference a view with an activation predicate, you
cannot reference a view with a row-filtering predicate.
For example, user Ben, a sale manager, has been granted these permissions on
the employee table:
grant select on employee
where edept = "sales"
to sales_mgr_role
grant select on employee (eid, ename, eaddr,
ezip)
where ezip like "97%"
to ben
When Ben with sales_manager_role active, executes this statement, Adaptive
Server notices that columns eid and ename are affected by the two predicated
grant commands:
to ben
When Ben executes this statement, Adaptive Server notices that columns
ename and esalary are affected by the different grant commands:
update employees
set esalary = esalary + (esalary * 0.05)
Adaptive Server internally executes:
update employees
set esalary = esalary + (esalary * 0.05)
where ezip like "97%"
and esalary < $100000
Adaptive Server then updates the row as:
eid ename esalary
1009 Sally $52500
text
---------------------------------------------------
---
grant select on tab1 where col1 = 5 as pred1 to
robert
sp_helptext only displays results not previously hidden by sp_hidetext.
This example displays the predicate with the source text hidden by
sp_hidetext:
However, if the owner of the employee table creates the following procedure
and grants execute access to priscilla, Adaptive Server detects the ownership
chain between employee and employee_addresses:
create procedure employee_addresses as
select name, phone from employee
Priscilla is given implicit access to all rows in employee in the context of the
procedure without restrictions from the predicate on the previous grant.
Note Either one or both of the predicates from the grant commands in the
examples above are applied.
If the procedure cache contains plans compiled for Bob and Joe, Adaptive
Server chooses a copy of the plan that is less likely to require compiling.
The initial choice of a plan that uses predicates from the cache depends on
matching the protection “profile” of the user with that of the plan, which
consists of:
• the user ID for whom the plan was compiled. The user ID is saved in the
plan's protection profile only if one or more predicated privileges on tables
accessed by the procedure are granted directly to the user.
• the group ID if one or more predicated privileges are granted to a group.
• a list of role IDs if one or more predicated privileges are granted to a role.
the user ID for whom the plan was compiled, and the IDs of roles and groups
that authorized the various accesses made by the procedure.
Choosing a plan that matches the user’s profile does not guarantee the plan is
up to date with the required predicates for the current user’s accesses. Adaptive
Server verifies that each select, update, and delete command in the procedure
has been compiled with where clauses that reflect the current user’s predicated
grants.
Otherwise, the procedure must be recompiled. Predicated privileges introduces
protection checking as a new decision point for plan recompilation during the
execution phase.
For efficient use of the procedure cache and the sharing of stored procedure
plans, you should use a role-based privacy policy. Predicated access to the
objects referenced by a stored procedure should be granted to a small number
of roles that can be activated by the end users.
Role activation predicates have similar restrictions. For example, this situation
returns an error when a user attempts to set role r1 on:
• table1 is protected by a predicated grant.
In the following example, the column cust_name is a foreign key on the table
t_orders that is constrained by the values of customer.name:
An employee in the orders department has select and update permission on the
t_orders table for those orders shipped to customers in the state of Iowa.
grant select, update on t_orders
where state = 'IO'
to procure_role
The employee in the orders department may not have access to the customer
table, which lists customers of the company nation-wide. The employee wants
to know whether a certain customer from New York buys from this company.
Using the customer name of the New York customer, the employee enters the
following command to update an order placed in Iowa:
update orders set cust_name = 'Ronald Crump'
where ordernum = 345
If above statement does not return a foreign key constraint violation, the
employee knows that Ronald Crump is a customer of the company.
Topic Page
Introduction to granular permissions 273
Configuring Adaptive Server to use granular permissions 274
System privileges 274
Effect of privileges as part of system-defined roles 275
Permission management 276
Privileges granted to system-defined roles 284
Privileges assigned to the database owner 288
Roles added with granular permissions 290
Default roles granted to the system administrator 292
Limiting the power of the system administrator and database owner 293
Enable granular permissions and sybsecurity 294
Logging in to a locked-out Adaptive Server 295
General use scenarios 296
System table master.dbo.sysprotects 298
Database user usedb_user 299
Grantable system privileges 300
System privileges
Granular permissions define server-wide and database-wide privileges.
You must grant or revoke server-wide privileges in the master database. The
grantees must be roles, users, or groups in the master database. Adaptive Server
stores the permission information for server-wide privileges in
master.dbo.sysprotects. See Table 8-15 on page 301 for a list of server-wide
privileges.
You must grant or revoke database-wide privileges in the database for which
the command requiring the privilege is intended. The grantees can be users,
groups, or roles in the database. Adaptive Server stores the permission
information for database-wide privileges in database_name.dbo.sysprotects.
See Table 8-16 on page 315 for a list of database-wide privileges.
Use the grant or revoke commands to grant or revoke server- and database-wide
privileges. For example, to allow user Joe to dump any database, a user with
the proper privilege issues this command from the master database:
grant dump any database to joe
To allow Joe to create any object on behalf of himself and on behalf of other
users in database db2, a user with the proper privilege issues this command
from db2:
grant create any object to joe
Permission management
All system privileges are managed by users with manage server permissions,
manage security permissions, or manage database permissions privileges.
Object permissions are managed by the object owners or users with manage
any object permission privilege.
• Any user with own any database privilege or own database privilege on a
database logs in to the database as the database owner, regardless if the
user is a valid user of the database. Any object created by this user has
UID=1 in sysobjects.uid and their login name in sysobjects.loginame. If
both own any databaseand own database privileges are revoked from this
user, he or she enters the database with his or her own user ID or as a guest
if he or she has not been added as a user in the database.
sa_serverprivs_role
The sa_serverprivs_role is a user-defined role granted to the sa by default, and
ensures the system administrator possesses all privileges necessary to run
Adaptive Server when enable granular permissions is enabled. As a user-
defined role, when granted to a login, sa_serverprivs_role is not activated
automatically for the login during login by default.
You can use alter login to enable automatic activation of this role during login.
When you enable enable granular permissions, the sa login has the same
privileges in a database as the database owner. The sa login can obtain other
database-wide privileges by adding himself as a user of the database, and
granting himself those privileges.
Default privileges granted to sa_serverprivs_role are listed in Table 8-13.
manage server
manage server configuration
manage server permissions
map external file
mount any database
online any database
own any database
quiesce any database
select on authmech
select on get_appcontext
select on list_appcontext
select on rm_appcontext
select on set_appcontext
set switch
set tracing any process
show switch
shutdown
unmount any database
use master
revoke own any database from sa_role
revoke manage server permissions from sa_role
Example 2:
By default, setuser privilege is granted to the database owner, which enables
the database owner access other users’ data by impersonating that user.
Revoke the setuser privilege from the database owners to restrict them from
accessing other users’ data. To prevent database owners from granting setuser
privileges to themselves, make sure that the manage database permissions
privilege is not granted to the database owners in the databases. By default, the
manage database permissions privilege is not granted to the database owner.
For example, to revoke setuser privileges from the database owner in database
db1:
use db1
revoke setuser from dbo
Change these privileges in the model database to make this the default behavior
in any user database created in the future:
use model
revoke setuser from dbo
Example 3:
Any sa_role user may accidentally shut down the server. To prevent this, a
system administrator with manage server permissions privilege can revoke
shutdown privilege from sa_role and grant it only to the administrators
responsible for shutting down the server operation.
For example, to grant users joe and bob (both with the sa_role) the shutdown
privilege, and revoke it from all others, a user with the manage server
permissions privilege issues:
use master
grant shutdown to joe, bob
revoke shutdown from sa_role
• All server privileges that include the word “any” do not apply to
sybsecurity. For example, own any database does not grant the privilege
holder access to sybsecurity as the database owner.
• Only users with manage security permissions can grant own database,
dump database, load database, checkpoint, and online database privileges
on sybsecurity to other users.
$SYBASE/$SYBASE_ASE/bin/dataserver
-d master.dat
-s server_name
-n "change password"
Parameter Value
msgnum Bitset of the permission token:
• 0x00000001 server-wide privilege
• 0x00000002 database-wide privilege
• 0x00000004 object permission
• 0x00000008 when granting the privilege a database name is required
• 0x00000010 the privilege is managed by "manage server permissions"
• 0x00000020 the privilege is managed by "manage security permissions"
• 0x00000040 the privilege is managed by "manage database permissions"
• 0x00000080 column level permission
• 0x00000100 the permission applies to system table object
• 0x00000200 the permission applies to view object
• 0x00000400 the permission applies to user table object
• 0x00000800 the permission applies to procedure object
For example, Bob is a valid user in master database, but not a valid user for
database db1 which does not have a guest user account. Bob has manage
security permissions privileges in the master database.
use db1
grant manage any encryption key to alice
Adaptive Server records the grantor of manage any encryption key in
sysprotects as the user ID of usedb_user.
Note Possessing one privilege may imply possessing another, more granular,
privilege. For example, a user with select any table privilege implies the user
has select permission on all user tables. See Table 1-22 in the grant command
in Reference Manual: Commands for a complete list of privileges pairs that
have an implied relationship.
Manage objects
alter any object owner Altering ownership for any object in the
database
Execute the alter ... modify owner command.
create any object Creating any of these objects owned by
anyone:
• tables
• views
• procedures
• functions
• defaults
• rules
• indexes
• triggers
Executing these commands:
• create table
• create view
• create procedure
• create function
• create rule
• create default
• create trigger
• create index
Topic Page
Secure Sockets Layer (SSL) in Adaptive Server 327
Using SSL to specify a common name 347
Kerberos confidentiality 348
Dumping and loading databases with password protection 348
Public-key cryptography
Several mechanisms, known collectively as public-key cryptography, have
been developed and implemented to protect sensitive data during transmission
over the Internet. Public-key cryptography consists of encryption, key
exchange, digital signatures, and digital certificates.
Encryption Encryption is a process wherein a cryptographic algorithm is used to encode
information to safeguard it from anyone except the intended recipient. There
are two types of keys used for encryption:
• Symmetric-key encryption – is where the same algorithm (key) is used
to encrypt and decrypt the message. This form of encryption provides
minimal security because the key is simple, and therefore easy to decipher.
However, transfer of data that is encrypted with a symmetric key is fast
because the computation required to encrypt and decrypt the message is
minimal.
• Public/private key encryption – also known as asymmetric-key, is a pair
of keys that are made up of public and private components to encrypt and
decrypt messages. Typically, the message is encrypted by the sender with
a private key, and decrypted by the recipient with the sender’s public key,
although this may vary. You can use a recipient’s public key to encrypt a
message, who then uses his private key to decrypt the message.
The algorithms used to create public and private keys are more complex,
and therefore harder to decipher. However, public/private key encryption
requires more computation, sends more data over the connection, and
noticeably slows data transfer.
Key exchange The solution for reducing computation overhead and speeding transactions
without sacrificing security is to use a combination of both symmetric key and
public/private key encryption in what is known as a key exchange.
For large amounts of data, a symmetric key is used to encrypt the original
message. The sender then uses either his private key or the recipient’s public
key to encrypt the symmetric key. Both the encrypted message and the
encrypted symmetric key are sent to the recipient. Depending on what key was
used to encrypt the message (public or private) the recipient uses the opposite
to decrypt the symmetric key. Once the key has been exchanged, the recipient
uses the symmetric key to decrypt the message.
Digital signatures Digital signatures are used for tamper detection and non-repudiation. Digital
signatures are created with a mathematical algorithm that generates a unique,
fixed-length string of numbers from a text message; the result is called a hash
or message digest.
SSL overview
SSL is an industry standard for sending wire- or socket-level encrypted data
over secure network connections.
Before the SSL connection is established, the server and the client exchange a
series of I/O round trips to negotiate and agree upon a secure encrypted session.
This is called the SSL handshake.
SSL handshake When a client requests a connection, the SSL-enabled server presents its
certificate to prove its identity before data is transmitted. Essentially, the
handshake consists of the following steps:
• The client sends a connection request to the server. The request includes
the SSL (or Transport Layer Security, TLS) options that the client
supports.
• The server returns its certificate and a list of supported cipher suites, which
includes SSL/TLS support options, algorithms used for key exchange, and
digital signatures.
• A secure, encrypted session is established when both client and server
have agreed upon a CipherSuite.
For more specific information about the SSL handshake and the SSL/TLS
protocol, see the Internet Engineering Task Force Web site at http://www.ietf.org.
For a list of cipher suites that Adaptive Server supports, see “Cipher Suites” on
page 340.
On most platforms, Adaptive Server uses SSL Plus(TM) library API from
Certicom Corp. However, for Windows Opteron X64, Adaptive Server uses
OpenSSL as the SSL provider.
SSL filter
The Adaptive Server directory service, such as the interfaces file, Windows
Registry, or LDAP service, defines the server address and port numbers, and
determines the security protocols that are enforced for client connections.
Adaptive Server implements the SSL protocol as a filter that is appended to the
master and query lines of the directory services.
The addresses and port numbers on which Adaptive Server accepts
connections are configurable, so you can enable multiple network and security
protocols for a single server. Server connection attributes are specified with
directory services, such as LDAP, or with the traditional Sybase interfaces file.
See “Creating server directory entries” on page 337.
All connection attempts to a master or query entry in the interfaces file with an
SSL filter must support the SSL protocol. A server can be configured to accept
SSL connections and have other connections that accept clear text
(unencrypted data), or use other security mechanisms.
For example, the interfaces file on UNIX that supports both SSL-based
connections and clear-text connections looks like this:
SYBSRV1
master tcp ether myhostname myport1 ssl
query tcp ether myhostname myport1 ssl
master tcp ether myhostname myport2
The SSL filter is different from other security mechanisms, such Kerberos,
which are defined with SECMECH (security mechanism) lines in the
interfaces file (sql.ini on Windows).
The server certificate Each Adaptive Server must have its own server certificate file that is loaded at
start-up. The following is the default location for the certificates file, where
servername is the name of the Adaptive Server as specified on the command
line during start-up with the -s flag, or from the environment variable
$DSLISTEN:
• UNIX – $SYBASE/$SYBASE_ASE/certificates/servername.crt
• Windows – %SYBASE%\%SYBASE_ASE%\certificates\servername.crt
The server certificate file consists of encoded data, including the server’s
certificate and the encrypted private key for the server certificate.
Alternatively, you can specify the location of the server certificate file when
using sp_ssladmin.
The CA trusted roots The list of trusted CAs is loaded by Adaptive Server at start-up from the trusted
certificate roots file. The trusted roots file is similar in format to a certificate file, except
that it contains certificates for CAs known to Adaptive Server. A trusted roots
file is accessible by the local Adaptive Server in the following, where
servername is the name of the server:
• UNIX – $SYBASE/$SYBASE_ASE/certificates/servername.txt
• Windows – %SYBASE%\%SYBASE_ASE\certificates\servername.txt
The trusted roots file is only used by Adaptive Server when it is functioning as
a client, such as when performing RPC calls or Component Integration
Services (CIS) connections.
The system security officer adds and deletes CAs that are to be accepted by
Adaptive Server, using a standard ASCII-text editor.
Warning! Use the system security officer role (sso_role) within Adaptive
Server to restrict access and execution on security-sensitive objects.
Connection types
This section describes various client-to-server and server-to-server
connections.
Client login to Open Client applications establish a socket connection to Adaptive Server
Adaptive Server similarly to the way that existing client connections are established. Before any
user data is transmitted, an SSL handshake occurs on the socket when the
network transport-level connect call completes on the client side and the accept
call completes on the server side.
Server-to-server Adaptive Server establishes a socket connection to another server for RPCs in
remote procedure the same way that existing RPC connections are established. Before any user
calls
data is transmitted, an SSL handshake occurs on the socket when the network
transport-level connect call completes. If the server-to-server socket
connection has already been established, the existing socket connection and
security context is reused.
When functioning as a client during RPCs, Adaptive Server requests the
remote server’s certificate during connection. Adaptive Server then verifies
that the CA that signed the remote server’s certificate is trusted; that is to say,
on its own list of trusted CAs in the trusted roots file. It also verifies that the
common name in the server certificate matches the common name used when
establishing the connection.
Companion server You can use a companion server to configure Adaptive Server for failover. You
and SSL must configure both the primary and secondary servers with the same SSL and
RPC configuration. When connections fail over or fail back, security sessions
are reestablished with the connections.
Open Client Component Integration Services, RepAgent, Distributed Transaction
connections Management, and other modules in Adaptive Server use Client-Library to
establish connections to servers other than Adaptive Server. The remote server
is authenticated by its certificate. The remote server authenticates the Adaptive
Server client connection for RPCs with user name and password.
Enabling SSL
Adaptive Server determines which security service it will use for a port based
on the interface file (sql.ini on Windows).
❖ Enabling SSL
1 Generate a certificate for the server.
2 Create a trusted roots file.
Note To request, authorize, and convert third-party certificates, see the Utility
Guide for information on the certauth, certreq, and certpk12 tools.
Unlike other security services, such Kerberos, and NTLAN, SSL relies neither
on the “Security” section of the Open Client/Open Server configuration file
libtcl.cfg, nor on objects in objectid.dat.
The system administrator should consider memory use by SSL when planning
for total physical memory. You need approximately 40K per connection
(connections include user connections, remote servers, and network listeners)
in Adaptive Server for SSL connections. The memory is reserved and
preallocated within a memory pool and is used internally by Adaptive Server
and SSL Plus libraries as requested.
Obtaining a certificate
The system security officer installs server certificates and private keys for
Adaptive Server by:
• Using third-party tools provided with existing public-key infrastructure
already deployed in the customer environment.
• Using the Adaptive Server certificate request tool in conjunction with a
trusted third-party CA.
Using Adaptive Server Adaptive Server provides two tools for requesting and authorizing certificates.
tools to request and certreq generates public and private key pairs and certificate requests. certauth
authorize certificates
converts a server certificate request to a CA-signed certificate.
Warning! Use certauth only for testing purposes. Sybase recommends that you
use the services of a commercial CA because it provides protection for the
integrity of the root certificate, and because a certificate that is signed by a
widely accepted CA facilitates the migration to the use of client certificates for
authentication.
Preparing the server’s trusted root certificate is a five-step process. Perform the
first two steps to create a test trusted root certificate so you can verify that you
are able to create server certificates. Once you have a test CA certificate
(trusted roots certificate) repeat steps three through five to sign server
certificates.
1 Use certreq to request a certificate.
2 Use certauth to convert the certificate request to a CA self-signed
certificate (trusted root certificate).
3 Use certreq to request a server certificate and private key.
4 Use certauth to convert the certificate request to a CA-signed server
certificate.
5 Append the private key text to the server certificate and store the
certificate in the server’s installation directory.
For information about Sybase utilities, certauth, certreq, and certpk12 for
requesting, authorizing and converting third-party certificates, see the Utility
Guide.
Note certauth and certreq are dependent on RSA and DSA algorithms. These
tools only work with crypto modules that use RSA and DSA algorithms to
construct the certificate request.
Administering certificates
To administer SSL and certificates in Adaptive Server, use sp_ssladmin.
sso_role is required to execute the stored procedure.
• Add local server certificates. You can add certificates and specify the
password used to encrypt private keys, or require input of the password at
the command line during start-up.
• Delete local server certificates.
• List server certificates.
The syntax for sp_ssladmin is:
sp_ssladmin {[addcert, certificate_path [, password|NULL]]
[dropcert, certificate_path]
[lscert]
[help]}
[lsciphers]
[setciphers, {"FIPS" | "Strong" | "Weak" | "All"
| quoted_list_of_ciphersuites}]
For example:
sp_ssladmin addcert, "/sybase/ASE-12_5/certificates/Server1.crt",
"mypassword"
This adds an entry for the local server, Server1.crt, in the certificates file in the
absolute path to /sybase/ASE-12_5/certificates
(x:\sybase\ASE-12_5\certificates on Windows). The private key is encrypted
with the password “mypassword”. The password should be the one specified
when you created the private key.
Before accepting the certificate, sp_ssladmin verifies that:
• The private key can be decrypted using the provided password (except
when NULL is specified).
• The private key and public key in the certificate match.
• The certificate chain, from root CA to the server certificate, is valid.
• The common name in the certificate matches the common name in the
interfaces file.
If the common names do not match, sp_ssladmin issues a warning. If the other
criteria fails, the certificate is not added to the certificates file.
The use of NULL as the password is intended to protect passwords during the
initial configuration of SSL, before the SSL-encrypted session begins. Since
you have not yet configured SSL, the password travels unencrypted over the
connection. You can avoid this by specifying the password as NULL during the
first login.
When NULL is the password, you must start dataserver with a -y flag, which
prompts the administrator for the private-key password at the command line.
After restarting Adaptive Server with an SSL connection established, use
sp_ssladmin again, this time using the actual password. The password is then
encrypted and stored by Adaptive Server. Any subsequent starts of Adaptive
Server from the command line use the encrypted password; you do not have to
specify the password on the command line during start-up.
An alternative to using a NULL password during the first login is to avoid a
remote connection to Adaptive Server via isql. You can specify “localhost” as
the hostname in the interfaces file (sql.ini on Windows) to prevent clients from
connecting remotely. Only a local connection can be established, and the
password is never transmitted over a network connection.
Note Adaptive Server has sufficient memory in its network memory pool to
allow sp_ssladmin addcert to set the certificate and private key password with
its default memory allocations. However, if another network memory
consumer has already allocated the default network memory, sp_ssladmin may
fail and display this error to the client:
Msg 12823, Level 16, State 1:
Server 'servername', Procedure 'sp_ssladmin', Line 72:
Performance
There is additional overhead required to establish a secure session, because
data increases in size when it is encrypted, and it requires additional
computation to encrypt or decrypt information. The additional memory
requirements for SSL increases the overhead by 50-60 percent for network
throughput or for establishing a connection. You must have approximately 40K
more memory for each user connection.
Cipher Suites
During the SSL handshake, the client and server negotiate a common security
protocol via a CipherSuite. Cipher Suites are preferential lists of
key-exchange algorithms, hashing methods, and encryption methods used by
SSL-enabled applications. For a complete description of Cipher Suites, visit
the Internet Engineering Task Force (IETF) organization at
http://www.ietf.org/rfc/rfc2246.txt.
By default, the strongest CipherSuite supported by both the client and the
server is the CipherSuite that is used for the SSL-based session.
Adaptive Server supports the Cipher Suites that are available with the SSL Plus
library API and the cryptographic engine, Security Builder™, both from
Certicom Corp.
Note The Cipher Suites listed conform to the Transport Layer Specification
(TLS). TLS is an enhanced version of SSL 3.0, and is an alias for the SSL
version 3.0 Cipher Suites.
@@ssl_ciphersuite
The Transact-SQL global variable @@ssl_ciphersuite allows users to know
which cipher suite was chosen by the SSL handshake and verify that an SSL or
a non-SSL connection was established.
Adaptive Server sets @@ssl_ciphersuite when the SSL handshake completes.
The value is either NULL, indicating a non-SSL connection, or a string
containing the name of the cipher suite chosen by the SSL handshake.
For example, an isql connection using SSL protocol displays the cipher suite
chosen for it.
1> select @@ssl_ciphersuite
2> go
Output:
------------------------------
TLS_RSA_WITH_AES_128_CBC_SHA
(1 row affected)
sp_ssladmin lsciphers
To set a specific cipher suite preference, enter:
sp_ssladmin setciphers, {"FIPS" | "Strong" | "Weak" |
"All" | quoted_list_of_ciphersuites }
where:
• “FIPS” – is the set of encryptions, hash, and key exchange algorithms that
are FIPS-compliant. The algorithms included in this list are AES, 3DES,
DES, and SHA1.
• “Strong” – is the set of encryption algorithms using keys longer than 64
bits.
• “Weak” – is the set of encryption algorithms from the set of all supported
cipher suites that are not included in the strong set.
• “All” – is the set of default cipher suites.
Table 9-2 describes Cipher suites no longer supported for Adaptive Server 15.0
and later. 15.0. Attempts to use use any dropped cipher suite results in an
SSLHandshake failure and a failure to connect to Adaptive Server.
Examples sp_ssladmin
On initial startup, before any cipher suite preferences have been set, no
preferences are shown by sp_ssladmin lscipher.
1> sp_ssladmin lscipher
2> go
Output:
Cipher Suite Name Preference
----------------- ----------
(0 rows affected)
(return status = 0)
The following example specifies the set of cipher suites that use FIPS
algorithms.
1> sp_ssladmin setcipher, 'FIPS'
The following cipher suites and order of preference are set for SSL connections:
Cipher Suite Name Preference
---------------------------------------------------------------- -----------
TLS_RSA_WITH_AES_256_CBC_SHA 1
TLS_RSA_WITH_AES_128_CBC_SHA 2
TLS_RSA_WITH_3DES_EDE_CBC_SHA 3
TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA 4
TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA 5
TLS_RSA_WITH_DES_CBC_SHA 6
TLS_DHE_DSS_WITH_DES_CBC_SHA 7
TLS_DHE_RSA_WITH_DES_CBC_SHA 8
TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA 9
TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA 10
A preference of 0 (zero) sp_ssladmin output indicates a cipher suite is not used
by Adaptive Server. The other, non-zero numbers, indicate the preference order
that Adaptive Server uses the algorithm during the SSL handshake. The client
side of the SSL handshake chooses one of these cipher suites that matches its
list of accepted cipher suites.
This example uses a quoted list of cipher suites to set preferences in Adaptive
Server:
1> sp_ssladmin setcipher, 'TLS_RSA_WITH_AES_128_CBC_SHA,
TLS_RSA_WITH_AES_256_CBC_SHA'
2> go
The following cipher suites and order of preference are set for SSL connections:
Cipher Suite Name Preference
---------------------------------------------------------------- -----------
TLS_RSA_WITH_AES_128_CBC_SHA 1
TLS_RSA_WITH_AES_256_CBC_SHA 2
Other considerations
When you upgrade to Adaptive Server version 12.5.3 and later, the cipher suite
preferences are the server defaults, and sp_ssladmin option lscipher displays no
preferences. The server uses its default preferences, those defined by “All”. The
system security officer should consider the security policies employed at his or
her site and the available SSL cipher suites to decide whether to restrict cipher
suites and which cipher suites are appropriate for the security policies.
If you upgrade from Adaptive Server version 12.5.3 and later and have set
cipher suite preferences, those preferences remain after upgrade. After the
upgrade is complete, review your server's cipher suite preferences with current
security policies and the lists of supported and unsupported cipher suites found
in tables Table 9-1. Omit any cipher suites that are not supported.
If you have set SSL cipher suite preferences and want to remove all preferences
from the server and use default preferences, delete the preferences from their
storage location in system catalogs using the following commands:
1> sp_configure 'allow updates to system tables', 1
2> go
Kerberos confidentiality
You can also ensure the confidentiality of all messages with Adaptive Server.
To require all messages into and out of Adaptive Server to be encrypted, set the
msg confidentiality reqd configuration parameter to 1. If this parameter is 0 (the
default), message confidentiality is not required but may be established by the
client.
For example, to require that all messages be encrypted, execute:
sp_configure "msg confidentiality reqd", 1
For more information about using Message Confidentiality with Kerberos and
other Security Services supported, see “Administering network-based
security” on page 120.
• password – is the password you provide to protect the dump file from
unauthorized users.
Your password must be between 6 and 30 characters long. If you provide a
password that is less than 6 or greater than 30 characters, Adaptive server
issues an error message. If you issue an incorrect password when you attempt
to load the database, Adaptive Server issues an error message and the
command fails.
For example, the following uses the password “bluesky” to protect the database
dump of the pubs2 database:
dump database pubs2 to "/Syb_backup/mydb.db" with passwd = "bluesky"
The database dump must be loaded using the same password:
load database pubs2 from "/Syb_backup/mydb.db" with passwd = "bluesky"
Each audit record can log the nature of the event, the date and time, the user
responsible for it, and the success or failure of the event. Among the events that
can be audited are log ins and log outs, server starts, use of data access
commands, attempts to access particular objects, and a particular user’s
actions. The audit trail, or log of audit records, allows the system security
officer to reconstruct events that occurred on the system and evaluate their
impact.
The system security officer is the only user who can start and stop auditing, set
up auditing options, and process the audit data. As a system security officer,
you can establish auditing for events such as:
• Server-wide, security-relevant events
• Creating, deleting, and modifying database objects
• All actions by a particular user or all actions by users with a particular role
active
• Granting or revoking database access
• Importing or exporting data
• Log ins and log outs
Figure 10-1 shows how the auditing process works with multiple audit tables.
User processes
Audit queue
Audit process
pool of empty audit tables currently active audit tables pool of full audit tables
Archive
The auditing system writes audit records from the in-memory audit queue to
the current audit table. When the current audit table is nearly full, a threshold
procedure can automatically archive the table to another database. The archive
database can be backed up and restored with the dump and load commands. Use
archive database access for read-only access to archived audit tables from
backup. See Chapter 14, “Archive Database Access,” in the System
Administration Guide, Volume 2. For more information about managing the
audit trail, see “Setting up audit trail management” on page 370.
Before you configure the size of the audit queue, consider the trade-off
between the risk of losing records in the queue if the system crashes and the
loss of performance when the queue is full. As long as an audit record is in the
queue, it can be lost if the system crashes. However, if the queue repeatedly
becomes full, overall system performance is affected. If the audit queue is full
when a user process tries to generate an audit record, the process sleeps until
space in the queue becomes available.
Note Because audit records are not written directly to the audit trail, you
cannot count on an audit record’s being stored immediately in the current audit
table.
The following is an example of an audit record for a select statement where two
predicated privileges were granted to user1 on table t1:
; SELECT; ; ; Predicates Applied: t1_qx8WwJltv#Co,
t1_eb#rxg5pnV76; ; user1/ase;
-------------------------------------------
103 sa_role sso_role oper_role sybase_ts_role; create
login test1 with passwd ****** default database master;
; ; ; ; sa/ase;
The following is an example of an audit record for a create login statement with
a declare statement for the varchar @pass:
declare @pass varchar(30)
select @pass = "greatSecret"
create login test3 with passwd @pass default database
master
go
select event,extrainfo from sybsecurity..sysaudits_01
where event=103
go
event extrainfo
-------------------------------------------
103 sa_role sso_role oper_role sybase_ts_role; create
login test3 with passwd @pass default database master;
; ; ; ; sa/ase;
The following is an example of an audit record for a create login statement with
an encrypted password:
create login test4 with encrypted passwd
0xc00749c449a5dd4922a59b025c605c80efe26a9235710e18b4ee
db31b32edae356d57a4d86a57388f73c default database
master
go
select event,extrainfo from sybsecurity..sysaudits_01
where event=103
go
event extrainfo
-------------------------------------------
103 sa_role sso_role oper_role sybase_ts_role; create
login test4 with encrypted passwd ****** default
database master; ; ; ; ; sa/ase;
The following is an example of an audit record for an alter login statement
modifying the password:
alter login test1 with passwd joe123 modify passwd
myPass123
go
• Configure your system with the minimum number of auditing devices you
require—you must configure at least three devices. You can add more
auditing devices later with sp_addaudittable. For information, see the
Reference Manual: Procedures.
• Install auditing tables and devices in a one-to-one ratio. Tables that share
the same device will share the same upper threshold limit. These tables
cannot be used sequentially when a device fills up, because they both
reside on the same device.
• Install each auditing table on its own device. This enables you to set up a
smoothly running auditing system with no loss of auditing records. With
two auditing tables, when one fills up, you can switch to the other. With a
third auditing table, if one device fails, the system security officer can
install a new threshold procedure that changes the device rotation to skip
the broken device until the device is repaired.
• Make the device larger than the table. When you use only three auditing
tables and devices, the size of the table and the size of the device can be
similar, because you can obtain more auditing capacity by adding more
auditing tables and devices (up to eight). When you are working toward
the upper table and device limit (six to eight), you may want to make the
device considerably larger than the table. Then, you can expand the table
size later towards the upper size of the device when a larger auditing
capacity is desired, and few or no device additions are available.
• Enable the dsync attribute, or use the directio attribute with that device if
you are using a file system device. See the configuration guide for your
platform.
AUDITINIT
1. Release directory: /usr/u/sybase
2. Configure a Server product
3 Select Configure a Server Product.
4 Select Adaptive Server.
5 Select Configure an Existing Sybase Server.
6 Select the server to configure.
7 Provide the SA password for the server you selected.
8 From the Sybase Server Configuration screen, select Configure Auditing.
As you proceed through the menus in auditinit, you can change any default
values that appear. As you finish each menu, press Ctrl+A to accept the
defaults or changed values and move to the next menu.
CONFIGURE AUDITING
1. Configure auditing: no
2. Add a device for audit table(s)
3. Add a device for the audit database transaction log
4. Delete a device entry
5. Change a device entry
/dev/path_to_partition
where path_to_partition is the path to the raw partition or filename for the
device.
2 Press Return to acknowledge the warning.
Note The Size of the Device value must be equal to or greater than the
Device Size for Auditing value. The Device Size for Auditing must be
equal to the device size. If you are following Sybase auditing guidelines,
you need not change the value displayed in Device Size for Auditing.
• auditinit displays the size in both Size of the Device and in Device Size
for Auditing in the Add/Change a New Device for Auditing menu.
• The Device Size for Auditing default value is equal to the size of the
device, based on the assumption that you may want to devote the
entire device to log for the auditing task. If you want to use only a
subset of the device, you can edit the Size of the Device value.
6 Press Ctrl+A to accept the settings displayed in the Add/Change a New
Device for Auditing menu.
auditinit returns to the Configure Auditing menu and displays all the
devices you have created.
CONFIGURE AUDITING
1. Configure auditing: yes
2. Add a device for audit table(s)
3. Add a device for the audit database transaction log
4. Delete a device entry
5. Change a device entry
7 When you are ready to execute the audit configuration, press Ctrl+A.
auditinit returns you to the Sybase Server Configuration screen.
Enabling auditing After auditing is installed, no auditing occurs until a System Security Officer
enables auditing using:
sp_configure 'auditing', 1
Note This example assumes a server that uses a logical page size of 2K.
size = "10M"
disk init name = "auditlogdev",
physname = "/dev/dsk/c2d0s5",
size = "2M"
create database sybsecurity on auditdev
log on auditlogdev
2 Use isql to execute the installsecurity script:
cd $SYBASE/ASE-12_5/scripts
setenv DSQUERY server_name
isql -Usa -Ppassword -Sserver_name < installsecurity
3 Shut down and restart Adaptive Server.
When you have completed these steps, the sybsecurity database has one audit
table (sysaudits_01) created on its own segment. You can enable auditing at this
time, but should add more auditing tables with sp_addaudittable. For
information about disk init, create database, and sp_addaudittable, see the
Reference Manual: Procedures.
Note These steps include dropping the sybsecurity database, which destroys all
audit records and global audit settings previously recorded in sybsecurity.
Before you drop the sybsecurity database, make sure you archive existing
records with a backup or by following instructions in “Archiving the audit
table” on page 371 to avoid losing any historical data that remains in the
sybsecurity tables.
To move the sybsecurity database without saving the global audit settings:
• Make the next empty audit table current using sp_configure to set the
current audit table configuration parameter.
• Archive the audit table that is almost full using the insert...select
command.
Note If Adaptive Server truncates the current audit table and you have not
archived the data, the table’s audit records are lost. Archive the audit data
before you use the with truncate option.
To execute sp_configure to change the current audit table, you must have the
sso_role active. You can write a threshold procedure to automatically change
the current audit table.
Be sure that the threshold procedure can successfully copy data into the archive
table in another database:
1 Create the archive database on a separate device from the one containing
audit tables in sybsecurity.
2 Create an archive table with columns identical to those in the sybsecurity
audit tables. If such a table does not already exist, you can use select into
to create an empty one by having a false condition in the where clause. For
example:
use aud_db
go
select *
into audit_data
from sybsecurity.dbo.sysaudits_01
where 1 = 2
The where condition is always false, so an empty duplicate of sysaudits_01
is created.
The select into/bulk copy database option must be turned on in the archive
database (using sp_dboption) before you can use select into.
The threshold procedure, after using sp_configure to change the audit table, can
use insert and select to copy data to the archive table in the archive database.
The procedure can execute commands similar to these:
insert aud_db.sso_user.audit_data
select * from sybsecurity.dbo.sysaudits_01
The sample threshold procedure audit_thresh receives control when fewer than
250 free pages remain in the current audit table.
For more information about adding threshold procedures, see Chapter 16,
“Managing Free Space with Thresholds,” in System Administration Guide:
Volume 2.
• suspend audit when device full determines what Adaptive Server does if the
current audit table becomes completely full. The full condition occurs only
if the threshold procedure attached to the current table segment is not
functioning properly.
For more information about setting the audit queue size and other configuration
parameters, see Chapter 5, “Setting Configuration Parameters” in the System
Administration Guide: Volume 1.
If the trunc log on chkpt database option is active, Adaptive Server truncates
syslogs every time it performs an automatic checkpoint. After auditing is
installed, the value of trunc log on chkpt is on, but you can use sp_dboption to
change its value.
Adaptive Server does not supply a default procedure, but Chapter 16,
“Managing Free Space with Thresholds,” in System Administration Guide:
Volume 2 contains examples of last-chance threshold procedures. The
procedure should execute the dump transaction command, which truncates the
log. When the transaction log reaches the last-chance threshold point, any
transaction that is running is suspended until space is available. The suspension
occurs because the option abort xact when log is full is always set to false for the
sybsecurity database. You cannot change this option.
With the trunc log on chkpt option disable, you can use standard backup and
recovery procedures for the sybsecurity database, but be aware that the audit
tables in the restored database may not be in sync with their status during a
device failure.
• 0 – disables auditing.
Single-table auditing
Sybase strongly recommends that you not use single-device auditing for
production systems. If you use only a single audit table, you create a window
of time while you are archiving audit data and truncating the audit table during
which incoming audit records are lost. There is no way to avoid this when using
only a single audit table.
If you use only a single audit table, your audit table is likely to fill up. The
consequences of this depend on how you have set suspend audit when device
full. If you have suspend audit when device full set to on, the audit process is
suspended, as are all user processes that cause auditable events. If suspend
audit when device full is off, the audit table is truncated, and you lose all the
audit records that were in the audit table.
For non-production systems, where the loss of a small number of audit records
may be acceptable, you can use a single table for auditing, if you cannot spare
the additional disk space for multiple audit tables, or you do not have additional
devices to use.
The procedure for using a single audit table is similar to using multiple audit
tables, with these exceptions:
• During installation, you specify only one system table to use for auditing.
• During installation, you specify only one device for the audit system table.
• The threshold procedure you create for archiving audit records is different
from the one you would create if you were using multiple audit tables.
Figure 10-2 shows how the auditing process works with a single audit table.
User processes
Audit queue
Audit process
threshold procedure
Archive
audit table
• Truncate the audit table to create space for new audit records, using the
truncate table command.
Before you can archive your audit records, create an archive table that has the
same columns as your audit table. After you have done this, your threshold
procedure can use insert with select to copy the audit records into the archive
table.
Here is a sample threshold procedure for use with a single audit table:
create procedure audit_thresh as
/*
** copy the audit records from the audit table to
** the archive table
*/
insert aud_db.sso_user.audit_data
select * from sysaudits_01
return(0)
go
/*
** truncate the audit table to make room for new
** audit records
*/
truncate table “sysaudits_01”
go
After you have created your threshold procedure, you will need to attach the
procedure to the audit table segment. For instructions, see “Attaching the
threshold procedure to each audit segment” on page 373.
Warning! On a multiprocessor, the audit table may fill up even if you have a
threshold procedure that triggers before the audit table is full. For example, if
the threshold procedure is running on a heavily loaded CPU, and a user process
performing auditable events is running on a less heavily loaded CPU, the audit
table may fill up before the threshold procedure triggers. The configuration
parameter suspend audit when device full determines what happens when the
audit table fills up. For information about setting this parameter, see
“Suspending auditing if devices are full” on page 376.
Restarting auditing
If the audit process is forced to terminate due to an error, sp_audit can be
manually restarted by entering:
sp_audit restart
The audit process can be restarted provided that no audit was currently running,
but the audit process must be enabled with sp_configure “auditing” 1.
Note Auditing does not occur until you activate auditing for the server. For
information on how to start auditing, see “Enabling and disabling auditing” on
page 378.
• Global options apply to commands that affect the entire server, such as
booting the server, disk commands, and allowing ad hoc, user-defined
audit records. Option settings for global events are stored in the
sybsecurity..sysauditoptions system table.
Database to
Option be in to set Command or access being
(option type) login_name object_name the option audited
bcp all Database to be Any bcp in
(database-specific) audited
This example returns the status of bcp auditing in the pubs2 database:
sp_audit "bcp", "all", "pubs2"
If you do not specify a value for setting, Adaptive Server returns the status of auditing for the
option you specify)
bind all Database to be Any sp_bindefault, sp_bindmsg, sp_bindrule
(database-specific) audited
This example turns bind auditing off for the planning database:
sp_audit "bind", "all", "planning", "off"
cmdtext Login name all Any SQL text entered by a user.
(user-specific) of the user to (Does not reflect whether or not the text
be audited in question passed permission checks or
not. eventmod always has a value of 1.)
This example turns text auditing off for database owners:
sp_audit "cmdtext", "sa", "all", "off"
create all Database to be Any create database, create table, create
(database-specific) audited role, create procedure, create trigger,
create rule, create default,
sp_addmessage, create view, create
index, create function
Note Specify master for object_name to audit create database. You are also auditing the
creation of other objects in master.
This example turns on auditing of successful object creations in the planning database:
sp_audit "create", "all", "planning", "pass"
The current status of auditing create database is not affected because you did not specify the
master database.)
dbaccess all Database to be Any Any access to the database from
(database-specific) audited another database
This example audits all external accesses to the project database:
sp_audit "dbaccess", "all", "project", "on"
dbcc all all Any All dbcc commands that require
(global) permissions
This example audits all executions of the dbcc command:
sp_audit "dbcc", "all", "all", "on"
Database to
Option be in to set Command or access being
(option type) login_name object_name the option audited
delete all Name of the The database of delete from a table, delete from a view
(object-specific) table or view to the table or
be audited, or view (except
default view or tempdb)
default table
This example audits all delete actions for all future tables in the current database:
sp_audit "delete", "all", "default table", "on"
disk all all Any disk init, disk refit, disk reinit, disk mirror,
(global) disk unmirror, disk remirror, disk resize
This example audits all disk actions for the server:
sp_audit "disk", "all", "all", "on"
drop all Database to be Any drop database, drop table, drop role,
(database-specific) audited drop procedure, drop index, drop trigger,
drop rule, drop default,
sp_dropmessage, drop view, drop
function
This example audits all drop commands in the financial database that fail permission checks:
sp_audit "drop", "all", "financial", "fail"
dump all Database to be Any dump database, dump transaction
(database-specific) audited
This example audits dump commands in the pubs2 database:
sp_audit "dump", "all", "pubs2", "on"
encryption_key all Database to be Any alter encryption key
(database-specific) audited create encryption key
drop encryption key
sp_encryption
This example audits all the above commands in the pubs2 database:
sp_audit "encryption_key", "all", "pubs2", "on"
errors all all Any Fatal error, non-fatal error
(global) This example audits errors throughout the server:
sp_audit "errors", "all", "all", "on"
errorlog all all Any sp_errorlog or the errorlog_admin
function
This example audits attempts to "change log" to move to a new Adaptive Server error log file:
sp_audit "errorlog", "all", "all", "on"
Database to
Option be in to set Command or access being
(option type) login_name object_name the option audited
exec_procedure all Name of the The database of execute
(object-specific) procedure to be the procedure
audited or (except tempdb)
default
procedure
This example turns automatic auditing off for new procedures in the current database:
sp_audit "exec_procedure", "all", "default procedure", "off"
exec_trigger all Name of the The database of Any command that fires the trigger
(object-specific) trigger to be the trigger
audited or (except tempdb)
default trigger
This example audits all failed executions of the trig_fix_plan trigger in the current database:
sp_audit "exec_trigger", "all", "trig_fix_plan", "fail"
func_dbaccess all Name of the Any Access to the database using the
(database-specific) database you following functions:
are auditing curunreserved_pgs, db_name, db_id,
lct_admin, setdbrepstat, setrepstatus,
setrepdefmode, is_repagent_enabled,
rep_agent_config, rep_agent_admin
This example audits accesses to the strategy database via built-in functions:
sp_audit @option="func_dbaccess", @login_name="all",
@object_name = "strategy", @setting = "on"
func_obj_access all Name of any Any Access to an object using the following
(object-specific) object that has functions: schema_inc, col_length,
an entry in col_name, data_pgs, index_col,
sysobjects object_id, object_name, reserved_pgs,
rowcnt, used_pgs, has_subquery
This example audits accesses to the customer table via built-in functions:
sp_audit @option="func_obj_access", @login_name="all",
@object_name = "customer", @setting = "on"
grant all Name of the Any grant
(database-specific) database to be
audited
This example audits all grants in the planning database:
sp_audit @option="grant", @login_name="all", @object_name =
"planning", @setting = "on"
Database to
Option be in to set Command or access being
(option type) login_name object_name the option audited
insert all Name of the The database of insert into a table, insert into a view
(object-specific) view or table to the object
which you are (except tempdb)
inserting rows,
or default view
or default table
This example audits all inserts into the dpt_101_view view in the current database:
sp_audit "insert", "all", "dpt_101_view", "on"
install all Database to be Any install java
(database-specific) audited
This example audits the installation of java classes in database planning:
sp_audit "install", "all", "planning", "on"
load all Database to be Any load database, load transaction
(database-specific) audited
This example audits all failed executions of database and transaction loads in the projects_db
database:
sp_audit "load", "all", "projects_db", "fail"
login all all Any Any login to Adaptive Server
(global) This example audits all failed attempts to log in to the server:
sp_audit "login", "all", "all", "fail"
login_locked all all Any
(global) This example shows that the login is locked because of exceeding the configured number of
failed login attempts:
sp_audit "login_locked", "all", "all", "on"
logout all all Any Any logout from Adaptive Server
This example turns auditing off of logouts from the server:
sp_audit "logout", "all", "all", "off"
mount all all Any mount database
(global) This example audits all mount database commands issued:
sp_audit "mount", "all", "all", "on"
password all all Any Setting of global password and login
policy options
This example turns auditing on for passwords:
sp_audit "password", "all", "all", "on"
quiesce all all Any quiesce database
(global) This example turns auditing on for quiesce database commands:
sp_audit "quiesce", "all", "all", "on"
Database to
Option be in to set Command or access being
(option type) login_name object_name the option audited
reference all Name of the Any create table, alter table
(object-specific) view or table to
which you are
inserting rows,
or default view
or default table
This example turns off auditing of the creation of references to the titles table:
sp_audit "reference", "all", "titles", "off"
remove all all Any Audits the removal of Java classes
(database-specific) This example audits the removal of Java classes in the planning database:
sp_audit "remove", "all", "planning", "on"
revoke all Database to be Any revoke
(database-specific) audited
This example turns off auditing of the execution of revoke in the payments_db database:
sp_audit "revoke", "all", "payments_db", "off"
rpc all all Any Remote procedure calls (either in or
(global) out)
This example audits all remote procedure calls out of or into the server:
sp_audit "rpc", "all", "all", "on"
security all all Any Server-wide security-relevant events.
(global) See the “security” option in Table 10-5.
This example audits server-wide security-relevant events in the server:
sp_audit "security", "all", "all", "on"
select all Name of the The database of select from a table, select from a view
(object-specific) view or table to the object
which you are (except tempdb)
inserting rows,
or default view
or default table
This example audits all failed selects from the customer table in the current database:
sp_audit "select", "all", "customer", "fail"
setuser all all Any setuser
(database-specific) This example audits all executions of setuser in the projdb database:
sp_audit "setuser", "all", "projdb", "on"
Database to
Option be in to set Command or access being
(option type) login_name object_name the option audited
table_access Login name all Any select, delete, update, or insert access in
(user-specific) of the user to a table
be audited.
This example audits all table accesses by the login named “smithson”:
sp_audit "table_access", "smithson", "all", "on"
transfer_table all all Any Server-wide option. Does not appear in
(global) sysauditoptions.
This example audits server-wide transfer-relevant events in the server:
sp_audit "transfer_table", "tdb1.table1", "all", "on"
truncate all Database to be Any truncate table
(database-specific) audited
This example audits all table truncations in the customer database:
sp_audit "truncate", "all", "customer", "on"
unbind all Database to be Any sp_unbindefault, sp_unbindrule,
(database-specific) audited sp_unbindmsg
This example audits all failed attempts of unbinding in the master database:
sp_audit "unbind", "all", "master", "fail"
unmount all all Any unmount database
(global) This example audits all attempts to unmount or create a manifest file with any database:
sp_audit "unmount", "all", "all", "on"
update all Name The database of update to a table, update to a view
(object-specific) specifying the the object
object to be (except tempdb)
audited, default
table or default
view
This example audits all attempts by users to update the projects table in the current database:
sp_audit "update", "all", "projects", "on"
view_access Login name all Any select, delete, insert, or update to a view
(user-specific) of the user to
be audited
This example turns off view auditing of user “joe”:
sp_audit "view_access", "joe", "all", "off"
To query the audit trail using the name of an audit event, use the
audit_event_name function. For example, to request the audit records for all
database creation events, enter:
select * from audit_data where audit_event_name(event)
= "Create Database"
go
This example shows an extrainfo column entry for the event of changing an
auditing configuration parameter.
sso_role;suspend audit when device full;1;0;;ralph;
This entry indicates that a system security officer changed suspend audit when
device full from 1 to 0. There is no “other information” for this entry. The sixth
category indicates that the user “ralph” was operating with a proxy login. No
principal name is provided.
The other fields in the audit record give other pertinent information. For
example, the record contains the server user ID (suid) and the login name
(loginname).
Table 10-5 lists the values that appear in the event column, arranged by
sp_audit option. The “Information in extrainfo” column describes information
that might appear in the extrainfo column of an audit table, based on the
categories described in Table 10-4.
Table 10-5: Values in event and extrainfo columns
Command or access to be
Audit option audited event Information in extrainfo
(Automatically Enabling auditing with: 73 —
audited event not sp_configure auditing
controlled by an
option)
(Automatically Disabling auditing with: 74 —
audited event not sp_configure auditing
controlled by an
option)
Unlocking Disabling auditing with: 74 —
Administrator’s sp_configure auditing
account
adhoc User-defined audit record 1 extrainfo is filled by the text parameter of
sp_addauditrecord
Command or access to be
Audit option audited event Information in extrainfo
alter alter database 2 Subcommand keywords:
alter maxhold
alter size
inmemory
alter...modify owner 124 Subcommand keywords:
name_in_db • For user-defined types: owner. obj_name
name_in_db preserve permissions if the
option is specified.
• For objects: name_in_db preserve
permission if the option is specified.
alter...modify owner 124 Subcommand keywords:
login_name Do not apply to user-defined datatypes:
For objects:
login_name preserve permissions if the option
is specified.
alter table 3 Subcommand keywords:
add/drop/modify column
replace columns
replace decrypt default
replace/add decrypt default
add constraint
drop constraint
If one or more encrypted columns are added,
extrainfo contains the following, where
keyname is the fully qualified name of the key:
add/drop/modify column column1/keyname1,
[,column2/keyname2]
bcp bcp in 4 —
bind sp_bindefault 6 Other information: Name of the default
sp_bindmsg 7 Other information: Message ID
sp_bindrule 8 Other information: Name of the rule
all, create create database 9 Keywords or options: inmemory
cmdtext All commands 92 Full text of command, as sent by the client
Command or access to be
Audit option audited event Information in extrainfo
create create database 9 —
create default 14 —
create procedure 11 —
create rule 13 —
create table 10 For encrypted columns, extrainfo contains
column names and keynames.
EK column1/keyname1[,column2 keyname2]
where EK is a prefix indicating that subsequent
information refers to encryption keys and
keyname is the fully qualified name of the key.
create trigger 12 —
create view 16 —
create index 104 Other information: Name of the index
create function 97 —
sp_addmessage 15 Other information: Message number
dbaccess Any access to the database by any 17 Keywords or options:
user use cmd
outside reference
dbcc dbcc all keywords 81 Keywords or options: Any of the dbcc
keywords such as checkstorage and the options
for that keyword.
delete delete from a table 18 Keywords or options: delete
delete from a view 19 Keywords or options: delete
Command or access to be
Audit option audited event Information in extrainfo
disk disk init 20 Keywords or options: disk init
Other information: Name of the disk
disk mirror 23 Keywords or options: disk mirror
Other information: Name of the disk
disk refit 21 Keywords or options: disk refit
Other information: Name of the disk
disk reinit 22 Keywords or options: disk reinit
Other information: Name of the disk
disk release 87 Keywords or options: disk release
Other information: Name of the disk
disk remirror 25 Keywords or options: disk remirror
Other information: Name of the disk
disk unmirror 24 Keywords or options: disk unmirror
Other information: Name of the disk
disk resize 100 Keywords or options: disk resize
Other information: Name of the disk
drop drop database 26 —
drop default 31 —
drop procedure 28 —
drop table 27 —
drop trigger 29 —
drop rule 30 —
drop view 33 —
drop index 105 Other information: Index name
drop function 98 —
sp_dropmessage 32 Other information: Message number
dump dump database 34 —
dump transaction 35 —
encryption_key sp_encryption 106 If password is set the first time:
ENCR_ADMIN system_encr_passwd
password ********
If the password is subsequently changed:
ENCR_ADMIN system_encr_passwd
password ******** ********
Command or access to be
Audit option audited event Information in extrainfo
create encryption key 107 Keywords contain:
algorithm name-bitlength/IV
[random|NULL]/pad [random |NULL]
user/system
For example:
AES-128/IV RANDOM/PAD NULL USER
alter encryption key 108 default/not default
drop encryption key 109
AEK modify encryption 118 modify encryption
with user passwd
| for user username
{with login passwd
| with user passwd
| with keyvalue}
[for recovery
Note that keyvalue is displayed only for
replication of alter encryption key modify
encryption. For example, when user “stephen”
modifies his key copy, the following
information is saved:
MODIFY ENCRYPTION for user
stephen WITH USER PASSWD
AEK add encryption 119 add encryption for user user_name
for login association | recovery|with
keyvalue]
Note that keyvalue is displayed only for
replication of alter encryption key add
encryption.
alter encryption key drop encryption 120 drop encryption [for recovery | for user
user_name
See the Encrypted Columns Users Guide.
alter encryption key modify owner 121 modify owner [new owner user_name]
See the Encrypted Columns Users Guide.
alter encryption key recover key 122 recovery key [with key_value]
with keyvalue is only used during replication of
alter encryption key
See the Encrypted Columns Users Guide.
errorlog errorlog or errorlog_admin function 127 The parameters passed to errorlog_admin are
logged to identify the subcommand:
errorlog_admin (param1, param2,...).
Command or access to be
Audit option audited event Information in extrainfo
errors Fatal error 36 Other information:
Error number.Severity.State
Non-fatal error 37 Other information:
Error number.Severity.State
exec_procedure Execution of a procedure 38 Other information: All input parameters
exec_trigger Execution of a trigger 39 —
func_obj_access, Accesses to objects and databases 86 —
func_dbaccess via Transact-SQL functions.
(Auditing must be enabled for the
sa_role to audit functions).
grant grant 40 Contains the full command text if available.
Otherwise, contains the grantee and command
type.
insert insert into a table 41 Keywords or option:
• If insert is used: insert
• If select into is used: insert into followed by
the fully qualified object name
insert into a view 42 Keywords or options: insert
install install 93 —
load load database 43 —
load transaction 44 —
login Any login to the server 45 Other information:
• Host name and IP address of the machine
from which the login was performed.
• Error number.Severity.State for failed
logins.
login_locked Login locked due to exceeding the 112
configured number of failed login
attempts
logout Any logouts from the server 46 Other information: Host name
mount mount database 101 —
password sp_passwordpolicy and all its 115 Parameters for sp_passwordpolicy
actions except list.
quiesce quiesce database 96 —
reference Creation of references to tables 91 Keywords or options: reference
Other information: Name of the referencing
table
remove remove java 94 —
Command or access to be
Audit option audited event Information in extrainfo
revoke revoke 47 Contains the full command text if available.
Otherwise, contains the grantee and command
type.
rpc Remote procedure call from 48 Keywords or options: Name of client program
another server Other information: Server name, host name of
the machine from which the RPC was
executed.
Remote procedure call to another 49 Keywords or options: Procedure name
server
role locked Role setting/unsetting 133 Role name and lock reason:
• Role locked by suid by manually executing
alter role rolename lock
• Role locked by Adaptive Server due to
failed role activation attempts reaching max
failed_logins
security connect to (CIS only) 90 Keywords or options: connect to
online database 83 —
proc_role function (executed from 80 Other information: Required roles
within a system procedure)
Regeneration of a password by an 76 Keywords or options: Setting SSO password
sso Other information: Login name
Role toggling 55 Previous value: on or off
Current value: on or off
Other information: Name of the role being set
Server start 50 Other information:
-dmasterdevicename
-iinterfaces file path
-Sservername
-eerrorfilename
sp_webservices 111 Keywords or options: deploy if deploying a
web service. deploy_all if deploying all web
services
sp_webservices 111 Keywords or options: undeploy if undeploying
a web service. undeploy_all if undeploying all
web services
Server shutdown 51 Keywords or options: shutdown
set proxy or 88 Previous value: Previous suid
set session authorization Current value: New suid
Command or access to be
Audit option audited event Information in extrainfo
sp_configure 82 Keywords or options: SETCONFIG
Other information:
• If a parameter is being set: number of
configuration parameter
• If a configuration file is being used to set
parameters: name of the configuration file
sp_ssladmin administration 99 Keywords contains SSL_ADMIN addcert, if
enabled adding a certification.
Audit table access 61 —
create login, drop login 103 Keywords or options: create login, drop login
create, drop, alter, grant, or revoke 85 Keywords or options: create, drop, alter, grant,
role or revoke role
built-in functions 86 Keywords or options: Name of function
Security command or access to be 95 Other information contains 'Unlocking admin
audited, specifically, starting account'
Adaptive Server with -u option to
unlock the administrator’s
account..
Changes to the LDAP state changes 123 Keywords or options: Primary URL state and
secondary URL state
• Previous value
• Current value
Additional information indicates whether the
state change happened automatically or
because of a manually entered command.
The regeneration of asymmetric 117 Information in extrainfo
keypairs for network password
encryption by the system or
sp_passwordpolicy
select select from a table 62 Keywords or options:
select into
select
readtext
select from a view 63 Keywords or options:
select into
select
readtext
setuser setuser 84 Other information: Name of the user being set
Command or access to be
Audit option audited event Information in extrainfo
table_access delete 18 Keywords or options: delete
insert 41 Keywords or options: insert
select 62 Keywords or options:
select into
select
readtext
update 70 Keywords or options:
update
writetext
truncate truncate table 64 —
transfer_table transfer table 136 transfer table
unbind sp_unbindefault 67 —
sp_unbindmsg 69 —
sp_unbindrule 68 —
unmount unmount database 102 —
create manifest file 116 Information in extrainfo
update update to a table 70 Keywords or options:
update
writetext
update to a view 71 Keywords or options:
update
writetext
view_access delete 19 Keywords or options: delete
insert 42 Keywords or options: insert
select 63 Keywords or options:
select into
select
readtext
update 71 Keywords or options:
update
writetext
Table 10-6 lists the values that appear in the event column, arranged by the
audit event.
Table 10-6: Audit event values
Audit event ID Command name Audit event ID Command name
1 ad hoc audit record 62 select table
• Using Adaptive Server for Windows with the Trusted Login or Unified
Login configuration, but the specified user is not a trusted administrator
(that is, an authentication failure).
• Adaptive Server does not support the SQL interface requested by the
client.
• A user is attempting to log into Adaptive Server when it is in single-user
mode. In single-user mode, exactly one user with the sa_role is allowed to
log in to Adaptive Server. Additional logins are prevented, even if they
have the sa_role.
• The syslogins table in the master database fails to open, indicating the
master database has an internal error.
• A client attempts a remote login, but sysremotelogins cannot be opened, or
there is no entry for the specified user account and no guest account exists.
• A client attempts a remote login and, although it finds an entry referring to
a local account for the specified user in sysremotelogins, the referenced
local account does not exist.
• A client program requests a security session (for example, a Kerberos
authentication), but the security session could not be established because:
• The Adaptive Server security subsystem was not initialized at startup.
• Insufficient memory resources for allocated structures.
• The authentication negotiation failed.
• An authentication mechanism is not found for the specified user.
• The specified password was not correct.
• syslogins does not contain the required entry for the specified login.
• A shutdown is in progress, but the specified user does not have the sa role.
• Adaptive Server could not open the default database for a login, and this
login does not have access to the master database.
• A client makes a high availability login fail over request, but the high
availability subsystem is does not have a high availability session for this
login, or the login is unable to wait for the fail over to complete.
• A client requests a high availability login setup, but the high availability
subsystem is unable to create the session or is unable to complete the TDS
protocol negotiations for the high availability session.
• Adaptive Server fails to setup tempdb for a login.
• TDS Login Protocol errors are detected.
ACF (Application Context Facility), problem-solving with audit trail 351, 395
237 adding comments 359, 393
activating roles 103 changing current audit table 371
Adaptive Server principal name 142 illustration with multiple audit tables 353
adding managing 370
comments to the audit trail 359 querying 394
group to a database 71 threshold procedure for 370
guest users 69 auditing 13, 351, 351–394
logins to server 17 See also audit options
remote users 71 adding comments to the audit trail 359
users to a group 68 configuration parameters 355
administering security, getting started 5–8 devices for 361
aliases, user disabling 359
See also logins;users displaying options for 359
creating 73 enabling 359
database ownership transfer and 180 enabling and disabling 378
dropping 74, 75 installing 361
help on 75 installing using the auditinit utility 361
alter role command 56, 59, 98 installing using the installsecurity script 360
alternate identity. See alias, user managing the audit trail 370
and (&) managing the transaction log 377
translated to underscore in login names 129 overview 351
ansi_permissions option, set queue, size of 355
permissions and 185 sybsecurity database 353
apostrophe converted to underscore in login names 129 sysaudits_01...sysaudits_08 tables 395
Application Context Facility 230, 231 system procedures for 359
granting and revoking privileges 232 threshold procedure for 370
setting permissions 231 turning on and off 378
valid users 232 auditing configuration parameter 378
application contexts authentication 118
built-in functions 233 mutual 119
using 233 authorizations. See permissions
applications automatic LDAP enhancements 166
proxy authorization and 198 automatic operations
assigning character conversions in logins 128
login names 7 automatic user authentication enhancements 166
assymetric key pairs, generating 39
asterisk (*)
converted to pound sign in login names 129
select and 208 B
audit options backslash (\)
displaying 359 translated to underscore in login names 129
examples 384 base tables. See tables
setting 383 bcp (bulk copy utility)
audit queue 355, 375 security services and 133
audit queue size configuration parameter 355, 375 with access rules 227
converted to dollar sign in login names 129 manage database permissions 280
expand_down parameter manage security permissions 276
sp_activeroles 106 manage server permissions 278
expiration interval for passwords 35 master.dbo.sysprotects 298
expiration of passwords 35 restore default database owner privilege 288
exporting set options 247 restore default role privilege 288
revoking system defined role 293
roles granted to sa 292
sybsecurity 294
F system privileges 274
filter parameter, in sp_addserver 348 groups
finding See also public group
user IDs 78 changing 72
user names 78 conflicting permissions and 192
users in a database 78 dropping 84
functions grant and 186
security 135 naming 71
revoke and 187
guest users 183
adding 69
G creating 69
get_appcontext 233, 234 permissions 69
global login triggers 249 sample databases and 70
grant command 178, 183–193 guidelines, security 6
roles and 108
grant dbcc
roles and 188
users in databases and 188 H
grant option hash
sp_helprotect 204 defined 328
granting message digest 328
predicated privileges 254 hierarchy
roles to roles 99 permissions. See permissions
roles with grant role 107 roles. See role hierarchies
system privileges 300 high availability and passwords 52
granting default permissions on system tables 189– housekeeper task
191 license use monitoring 85
granular permissions
added roles 290
configuring 274
database owner privileges 288 I
default roles granted to sa 290 I/O
enable 274 usage statistics 89
granted to system-defined roles 284 i/o accounting flush interval configuration parameter
lock-out server 295 90
manage any object permission 283 identification and authentication
R S
records, audit 355 “sa” login 6
reestablishing original identity 194 changing password for 7
remote procedure calls configured with system administrator and system
network-based security 131 security officer roles 6
unified login and 132 security recommendations for using 6
remote server users. See remote logins secmech specification 125
remote users. See remote logins secondary
replay detection 119 lookup server support 155
reporting lookup servers, using sp_ldapadmin 156
usage statistics 89 secure default login 127
reports securing login passwords on a network 38
server usage 89 security
revoke command 178, 183–193 auditing 13
revoking discretionary access control 11
default permissions from system tables 190 establishing after installation 6–8
roles with revoke role 109 identification and authentication controls 9
revoking default permissions on master database system Kerberos 136
tables 190 roles 11
RFC 86.0 169 security administration
rm_appcontext 233, 236 example of 7
role hierarchies 12 getting started 5–8
creating 108 guidelines 6
displaying 106 security drivers
displaying with role_contain 105 example of entry in libtcl.cfg file 125
displaying with sp_displayroles 105 syntax for entries in libtcl.cfg file 123
role_contain system function 105 security functions 135
roles security mechanisms 134
activating 103 security services
configured for sa login 6 example 118–119
deactivating 103 supported by Adaptive Server 119
locking 22, 55 select * command
maximum login attempts, changing 23 error message 208
maximum login attempts, setting 22 sensitive information, views of 207
passwords for 35 separation of roles 11
permissions and 108, 184 sequence checks 119
stored procedure permissions and 106 server authentication
stored procedures and 108, 209 server certificates 331
unlocking 55, 56, 59 server certificates 329
roles, user-defined location of 332
planning 96 server authentication 331
rowlevel access control 221 server user name and ID 78
rules servers
protection hierarchy 213 adding new logins to 17
adding users to 17
user information 75–90
server-wide dbcc, master and 188 sp_serveroption net password encryption description
session authorization option, set 197 40
set command sp_who system procedure 76, 204
roles and 103 square brackets [ ]
set options converted to pound sign in login names 129
exportable 247 SSL
set_appcontext 233 common name, to specify 347
setting timeout for LDAP user authentication 159 defined 330
setuser command enabling SSL 333
show_role and 105 filter, defined 331
setuser, using 194 handshake 330
show_role system function 105 SSL connections
show_sec_services security function 135 for companion servers 333
slash (/) for RPCs 333
converted to pound sign in login names 129 Open Client 333
sp_activeroles system procedure 106 state transitions
sp_addalias system procedure 74 LDAP server 157
sp_addauditrecord system procedure 393 statistics
sp_addgroup system procedure 71 I/O usage 89
sp_addlogin system procedure 35, 37 steps
sp_addserver administering security 5
includes filter parameter 348 stored procedures
sp_adduser system procedure 69 checking for roles in 106
sp_audit system procedure granting execution permission to roles 106
setting options with 383 ownership chains 210
sp_changedbowner system procedure 180 permissions on 182
sp_changegroup system procedure 71, 72 roles and 209
sp_configure system procedure as security mechanisms 209
configuring server for security services 126 suser_id system function 78–79
sp_displaylogin system procedure 77 suser_name system function 78–79
sp_displayroles system procedure 105 suspend audit when device full configuration
sp_dropalias system procedure 74, 75 parameter 376
sp_dropgroup system procedure 84 syb__map_name 143
sp_dropuser system procedure 83 SYBASE_PRINCIPAL 142
sp_helprotect system procedure 204–205 syblicenseslog table 86
sp_helpuser system procedure 75 sybmapname 143
sp_ldapadmin 156 sybsecurity database 353
sp_listener, specifying a common name 347 sybsystemprocs database
sp_locklogin system procedure 56 permissions and 183
sp_logintrigger 249 symmetric key encryption 328
sp_maplogin 160 syntax
sp_modifylogin system procedure 35, 38 dump database 348
sp_password system procedure 80 load database 348
sp_passwordpolicy syntax 39 sys_session application context table 237
sp_reportstats system procedure 89 sysalternates table 74
See also sysusers table
IDs 78, 93
information on 75–90
license use monitoring 84
number or 87
permissions to all or specific 191, 208
views for specific 207
visiting 70
using proxy authorization 195
V
verifying Kerberos authentication 145
views
dependent 211
ownership chains 210
permissions on 207–208
security and 206
visitor accounts 70
W
Windows NT LAN Manager security mechanism
126