Collection Contents Index Troubleshooting connections CHAPTER 3.  Working with Database Objects pdf/chap2.pdf

User's Guide
   PART 1. Working with Databases
     CHAPTER 2. Connecting to a Database       

Using integrated logins


The integrated login feature allows you to maintain a single user ID and password for both database connections and operating system and/or network logins. This section describes the integrated login feature.

Operating systems supported 

Integrated login capabilities are available for the Windows NT server only. It is possible for Windows 95 clients as well as Windows NT clients to use integrated logins to connect to a network server running on Windows NT.

Benefits of an integrated login 

An integrated login is a mapping from one or more Windows NT user profiles to an existing user in a database. A user who has successfully navigated the security for that user profile and logged in to their machine can connect to a database without providing an additional user ID or password.

To accomplish this, the database must be enabled to use integrated logins and a mapping must have been granted between the user profile used to log in to the machine and/or network, and a database user.

Using an integrated login is more convenient for the user and permits a single security system for database and network security. Its advantages include:

Caution    
Integrated logins offer the convenience of a single security system but there are important security implications which database administrators should be familiar with.

For Info     For more information about security and integrated logins, see Security concerns: unrestricted database access.

Top of page  Using integrated logins

Several steps must be implemented in order to connect successfully via an integrated login.

  To use an integrated login:
  1. Enable the integrated login feature in a database by setting the value of the LOGIN_MODE database option to either Mixed or Integrated (the option is case insensitive), in place of the default value of Standard. This step requires DBA authority).

  2. Create an integrated login mapping between a user profile and an existing database user. This can be done using a SQL statement or a wizard in Sybase Central.

  3. Connect from a client application in such a way that the integrated login facility is triggered.

Each of these steps is described in the sections below.

Top of page  Enabling the integrated login feature

The LOGIN_MODE database option determines whether the integrated login feature is enabled. As database options apply only to the database in which they are found, different databases can have a different integrated login setting even if they are loaded and running within the same server.

The LOGIN_MODE database option accepts one of following three values (which are case insensitive).

Example 

The following SQL statement sets the value of the LOGIN_MODE database option to Mixed, allowing both standard and integrated login connections:

SET OPTION Public.LOGIN_MODE = Mixed

Top of page  Creating an integrated login

User profiles can only be mapped to an existing database user ID. When that database user ID is removed from the database, all integrated login mappings based on that database user ID are automatically removed.

A user profile does not have to exist for it to be mapped to a database user ID. More than one user profile can be mapped to the same user ID.

Only users with DBA authority are able to create or remove an integrated login mapping.

An integrated login mapping is made either using a wizard in Sybase Central or a SQL statement.

  To map an integrated login from Sybase Central:
  1. Connect to a database as a user with DBA authority.

  2. Open the Integrated Logins folder for the database, and double-click Add Integrated Login. The Integrated Login wizard is displayed.

  3. On the first page of the wizard, enter the name of the system (computer) user for whom the integrated login is to be created. You can either select a name from the list or enter a name.

    Also, select the database user ID this user maps to. The wizard displays the available database users. You must select one of these. You cannot add a new database user ID.

  4. Follow the remaining instructions in the Wizard.

  To map an integrate login using a SQL statement:
  1. The following SQL statement allows Window NT users dmelanso and bhay to log in to the database as the user DBA, without having to know or provide the DBA user ID or password.

    GRANT INTEGRATED LOGIN 
    TO dmelanso, bhay 
    AS USER dba

Top of page  Connecting from a client application

A client application can connect to a database using an integrated login in one of the following ways:

If INTEGRATED=yes is specified in the connection string, an integrated login is attempted. If the connection attempt fails and the LOGIN_MODE database option is set to Mixed, the server attempts a standard login.

If an attempt to connect to a database is made without providing a user ID or password, an integrated login is attempted. The attempt succeeds or fails depending on whether the current user profile name matches an integrated login mapping in the database.

Interactive SQL Examples 

For example, a connection attempt using the following Interactive SQL statement will succeed, providing the user has logged on with a user profile name that matches a integrated login mapping in a default database of a server:

CONNECT USING 'INTEGRATED=yes'

The following Interactive SQL statement...

CONNECT

...can connect to a database if all the following are true:

Integrated logins via ODBC 

A client application connecting to a database via ODBC can use an integrated login by including the Integrated parameter among other attributes in its Data Source configuration.

Setting the attribute Integrated=yes in an ODBC data source causes database connection attempts using that DSN to attempt an integrated login. If the LOGIN_MODE database option is set to Standard, the ODBC driver prompts the user for a database user ID and password.

Top of page  Security concerns: unrestricted database access

The integrated login feature works by using the login control system of Windows NT in place of the Adaptive Server Anywhere security system. Essentially, the user passes through the database security if they can log in to the machine hosting the database, and if other conditions, outlined in Using an integrated login, are met.

If the user successfully logs in to the Windows NT server as "dsmith", they can connect to the database without further proof of identification provided there is either an integrated login mapping or a default integrated login user ID.

When using integrated logins, database administrators should give special consideration to the way Windows NT enforces login security in order to prevent unwanted access to the database.

In particular, be aware that by default a "Guest" user profile is created and enabled when Windows NT Workstation or Server is installed.

Caution    
Leaving the user profile Guest enabled can permit unrestricted access to a database being hosted by that server.

If the Guest user profile is enabled and has a blank password, any attempt to log in to the server will be successful. It is not required that a user profile exist on the server, or that the login ID provided have domain login permissions. Literally any user can log in to the server using any login ID and any password: they are logged in by default to the Guest user profile.

This has important implications for connecting to a database with the integrated login feature enabled.

Consider the following scenario, which assumes the Windows NT server hosting a database has a "Guest" user profile that is enabled with a blank password.

Disable the Guest user profile for security    
The safest integrated login policy is to disable the "Guest" user profile on any Windows NT machine hosting an Adaptive Server Anywhere database. This can be done using the Windows NT User Manager utility.

Top of page  Setting temporary public options for added security

Setting the value of the LOGIN_MODE option for a given database to Mixed or Integrated using the following SQL statement permanently enables integrated logins for that database.

SET OPTION Public.LOGIN_MODE = Mixed

If the database is shut down and restarted, the option value remains the same and integrated logins are still enabled.

Changing the LOGIN_MODE option temporarily will still allow user access via integrated logins. The following statement will change the option value temporarily:

SET TEMPORARY OPTION Public.LOGIN_MODE = Mixed

If the permanent option value is Standard, the database will revert to that value when it is shut down.

Setting temporary public options can be considered an additional security measure for database access since enabling integrated logins means that the database is relying on the security of the operating system on which it is running. If the database is shut down and copied to another machine (such as a user's machine) access to the database reverts to the Adaptive Server Anywhere security model and not the security model of the operating system of the machine where the database has been copied.

For Info     For more information on using the SET OPTION statement see SET OPTION statement.

Top of page  Network aspects of integrated logins

If the database is located on a network server, then one of two conditions must be met for integrated logins to be used:

Top of page  Creating a default integrated login user

A default integrated login user ID can be created so that connecting via an integrated login will be successful even if no integrated login mapping exists for the user profile currently in use.

For example, if no integrated login mapping exists for the user profile name JSMITH, an integrated login connection attempt will normally fail when JSMITH is the user profile in use.

However, if you create a user ID named Guest in a database, an integrated login will successfully map to the Guest user ID if no integrated login mapping explicitly identifies the user profile JSMITH.

The default integrated login user permits anyone attempting an integrated login to successfully connect to a database if the database contains a user ID named Guest. The permissions and authorities granted to the newly-connected user are determined by the authorities granted to the Guest user ID.

Top of page  

Collection Contents Index Troubleshooting connections CHAPTER 3.  Working with Database Objects pdf/chap2.pdf