Articles

Firebird 3 Quick Start Guide - Initializing security database

Sergey Nikitin, IBSurgeon, 09-Sep-2015

Initializing the Security Database
By default, Firebird 3 is configured for the new authentication model which uses SRP to work with user passwords and generate unique session identifiers for traffic encryption. The security database (security3.fdb) has no predefined users.
This is intentional.
However, when using the standard installers for Windows, Linux and MacOSX, the SYSDBA user is created during the final step of the installation, with a password that is either random or defined via a user input routine. In a situation where the SYSDBA initialization step either fails, or is missing from an OS-specific install process, such as a Windows .zip kit install or a dedicated POSIX platform port, it may be necessary to initialize the  security database manually for use with the SRP plugins.
You will need to create the user SYSDBA and set up the password for it using SQL CREATE USER command syntax in embedded mode as your first step to getting access to databases and utilities. The gsec utility can be used instead but, having been deprecated, it is not discussed here

Important. This initialization is not required and should NOT be performed if you have configured the server to use legacy (pre-Firebird 3 style) authentication and user management. The legacy security plugins totally preserve the legacy behaviour and thus contain the legacy record for SYSDBA with “masterke” as the initial password. Instructions for configuring firebird.conf for legacy authentication behaviour are in the next section.

Initialization Steps
Initialization is performed in embedded mode using the isql utility. For an embedded connection, an authentication password is not required and will be ignored if you provide one. An embedded connection will work fine with no login credentials and “log you in” using your host credentials if you omit a user name. However, even though the user name is not subject to authentication, creating or modifying anything in the existing security database requires that the user be SYSDBA; otherwise, isql will throw a privilege error for the CREATE USER request. The SQL user management commands will work with any open database. Because the sample database employee.fdb is present in your installation and already aliased in databases.conf, it is convenient to use it for the user management task.

1. Stop the Firebird server.
Firebird 3 caches connections to the security database aggressively. The presence of server connections may prevent isql from establishing an embedded connection.

2. In a suitable shell, start an isql interactive session, opening the employee database via its alias:
> isql -user sysdba employee
3. Create the SYSDBA user:
SQL> create user SYSDBA password 'SomethingCryptic';
SQL> commit;
SQL> quit; 

Note The SYSDBA user will have full administrator rights automatically. Do not assign the ADMIN role (RDB $ADMIN) to SYSDBA.

4. To complete the initialization, start the Firebird server again. Now you will be able to perform a network login to databases, including the security database, using the password you assigned to SYSDBA.

About Passwords
• An effective password, using the default user manager Srp, can be up to 20 characters, although a password of up to 255 characters will be valid.
• If you intend in future to configure the server to use legacy authentication (not recommended!), then only the first 8 characters of any password, including that of the SYSDBA, will be read.
• masterkey is NOT a recommended password for SYSDBA! 

You can also use HQbird - an advanced distributive of Firebird SQL for an enterprise use. It creates SYSDBA account with desired password during an installation.
Download HQbird here: http://ib-aid.com/en/hqbird/
 

Subscribe to IBSurgeon news

Subscribe