Protectection of Informix database from connections outside application
Posted in 1997
Dear audience,
We have an existing application which connects to an informix database
directly. Because of the comlexity of the authorization rules for
data-access and update we chose to manage all these in the application.
Resulting problem was that people could also access the database using
alternate tools.
To prevent direct access to the database by an authorised user we have
implemented an application authentication mechanim, which is described
below.
Question: could anybody give information concerning the setup the
application authentication mechanism which helps us to determine its
validity?
' Initially give all users access-right to the database, only with
database-privilege "connect".
' Create a table containing a password for the application e.g.
paswrd_tables.
' Delete all rights on the application tables. (Revoke all
table-privileges on "all tables" from "everyone")
' Create a role, e.g. apllic_user. Connect no users to this role.
' Authorize apllic_user for all regular table-privileges on all
application tables. (grant all on "all tables" to applic_user). Note:
All further authorizations are controlled by the application itself.
' Create a stored procedure with dba-rights, e.g. appl_start.
create dba procedure appl_start (usride char(8),psw char(8))
DEFINE psw002 char(8); select paswrd into psw002 from paswrd_tables where ...;
IF psw = psw002 THEN
ELSE
RETURN;
END IF
grant pssgbr to usride; set role pssgbr;
revoke pssgbr from usride; !!!!!!
end procedure;
' All users have to be authorized for executing this procedure. (grant
execute on apll_start to public;)
' The procedure is protected by the application password, that has to be
passed through as a parameter.
' When starting up the application this procedure has to be executed
directly after opening the database. Therefore the password stands
hard-coded in the source-file. Of course this source-file has to be
protected from unauthorized access.
' Consider the construction of the on_line user-connection to the role,
the action of activating the role in the particular session, and the
disconnection from the role immediately after this action.
Thanks in advance,
greetings,
Rob