| 1 |
New way to authenticate users in firebird. |
| 2 |
|
| 3 |
Firebird starting with version 2.1 can use Windows security for user authentication. |
| 4 |
Current security context is passed to the server and if it's OK for that server is used to determine |
| 5 |
firebird user name. To use Windows trusted authentication in FB3 you should make minimum changes in |
| 6 |
firebird.conf and tune mappings in your databases. |
| 7 |
|
| 8 |
Parameter Authentication in firebird.conf file is not used any more - it's replaced with more |
| 9 |
generic AuthServer (and AuthClient) parameters. Also to use trusted authentication one should turn |
| 10 |
off mandatory wire encryption because Win_Sspi plugin (which implements trusted authentication on |
| 11 |
Windows) does not provide an encryption key. So minimum changes in firebird.conf you need is: |
| 12 |
|
| 13 |
AuthServer = Srp, Win_Sspi |
| 14 |
WireCrypt = Enabled |
| 15 |
|
| 16 |
Also mapping (see sql.extensions/README.mapping.html) should be created. To tune for all databases |
| 17 |
do: |
| 18 |
|
| 19 |
create global mapping trusted_auth using plugin win_sspi from any user to user; |
| 20 |
|
| 21 |
Do not put user and password parameters in DPB/SPB. With provided firebird.conf in almost all cases |
| 22 |
trusted authentication will be used (see environment below for exceptions). Suppose you have logged |
| 23 |
to the Windows server SRV as user John. If you connect to server SRV with isql, not specifying |
| 24 |
Firebird login and password: |
| 25 |
|
| 26 |
isql srv:employee |
| 27 |
|
| 28 |
and do: |
| 29 |
|
| 30 |
SELECT CURRENT_USER FROM RDB$DATABASE; |
| 31 |
|
| 32 |
you will get something like: |
| 33 |
|
| 34 |
USER |
| 35 |
==================================================== |
| 36 |
SRV\John |
| 37 |
|
| 38 |
Windows users may be granted rights to access database objects and roles in the same way as |
| 39 |
traditional Firebird users. (This is not something new - in UNIX OS users might be granted rights |
| 40 |
virtually always). |
| 41 |
|
| 42 |
- If domain administrator (member of well known predefined groups) connects to Firebird using trusted |
| 43 |
authentication, he/she may be granted 'god-like' (SYSDBA) rights depending upon settings in database, |
| 44 |
to which such user attachs. To keep CURRENT_USER value in a form DOMAIN\User, a new object (predefined |
| 45 |
system role) is added to the database. The name of that role is RDB$ADMIN, and any user, granted it, |
| 46 |
can attach to the database with SYSDBA rights. To configure all databases to auto-grant that role to |
| 47 |
administrators, use the following command: |
| 48 |
|
| 49 |
create global mapping win_admin using plugin win_sspi from predefined_group DOMAIN_ANY_RID_ADMINS to role RDB$ADMIN; |
| 50 |
|
| 51 |
Take into an account, that if Windows administrator attaches with role set in dpb, it will not be |
| 52 |
replaced with RDB$ADMIN, i.e. he/she will not get SYSDBA rights. |
| 53 |
|
| 54 |
- To keep legacy behavior when ISC_USER/ISC_PASSWORD variables are set in environment, they |
| 55 |
are picked and used instead of trusted authentication. In case when trusted authentication is needed |
| 56 |
and ISC_USER/ISC_PASSWORD are set, add new DPB parameter isc_dpb_trusted_auth to DPB. In most |
| 57 |
of Firebird command line utilities switch -trusted (may be abbreviated up to utility rules) is used |
| 58 |
for it. |
| 59 |
|
| 60 |
isql srv:db -- log using trusted authentication |
| 61 |
set ISC_USER=user1 |
| 62 |
set ISC_PASSWORD=12345 |
| 63 |
isql srv:db -- log as 'user1' from environment |
| 64 |
isql -trust srv:db -- log using trusted authentication |
| 65 |
|
| 66 |
Author: Alex Peshkov, <peshkoff at mail.ru> |