edb_user_login is an extension which allows to users to include after logon procedures/functions for EDB Postgres Advanced Server Version 9.6
- Download the the module using git command as given below:
git clone https://github.com/vibhorkum/edb_user_login
- Make sure path variable set correctly and has included EDB AS 9.6 bin location as given below:
export PATH=/usr/edb/as9.6/bin:$PATH
- Use make and make install to install the module as given below:
make
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -I/usr/libexec/icu-edb53.1/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -I/usr/include/et -fPIC -I. -I./ -I/usr/edb/as9.6/include/server -I/usr/edb/as9.6/include/internal -I/usr/include/et -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/libexec/icu-edb53.1/include -I/usr/include -c -o edb_user_login.o edb_user_login.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -I/usr/libexec/icu-edb53.1/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -I/usr/include/et -fPIC -shared -o edb_user_login.so edb_user_login.o -L/usr/edb/as9.6/lib -Wl,-rpath,/usr/libexec/icu-edb53.1/lib -L/usr/libexec/icu-edb53.1/lib -L/usr/lib64 -L/usr/libexec/icu-edb53.1/lib -Wl,--as-needed -Wl,-rpath,'/usr/edb/as9.6/lib',--enable-new-dtags
make install
/bin/mkdir -p '/usr/edb/as9.6/lib'
/bin/install -c -m 755 edb_user_login.so '/usr/edb/as9.6/lib/edb_user_login.so'
- After installing the module, set the following parameters:
ssession_preload_libraries = '$libdir/edb_user_login'
edb_user_login.enabled = true
edb_user_login.login_procedure_name = 'public.login_procedure'
Where edb_user_login.enabled is enable to execution of all roles inside the database and edb_user_login.login_procedure_name is for procedure/function which DBAs/Developers want to execute after each successful login.
Please note: Procedure/function should not include any (). Also, this module ignores the output of function/procedures.
Also, if user wants to disable the execution of procedure/function for specific user or specific database, they can use following command:
ALTER USER <username> SET edb_user_login.enabled TO false;
ALTER DATABASE <databasename> SET edb_user_login.enabled TO false;
If user wants to execute some other specific procedure/function for user/database then following command allows that:
ALTER USER <username> SET edb_user_login.login_procedure_name TO '<schema>.procedure';
ALTER DATABASE <databasename> SET edb_user_login.login_procedure_name TO '<schema>.procedure';