PWM – Open Source Password Self Service with OpenLDAP – Configuring PostgreSQL database

PWM – Open Source Password Self Service with OpenLDAP – Configuring PostgreSQL database
Settings required in Postgres:

In Postgres, Create a database named ‘pwm’.

# su – postgres

$ createdb pwm

$ exit

Create the following tables in Postgres required for PWM.

# psql pwm postgres

pwm=# CREATE table PWM_META (
id VARCHAR(128) NOT NULL PRIMARY KEY,
value TEXT
)
;

pwm=# CREATE table PWM_RESPONSES (
id VARCHAR(128) NOT NULL PRIMARY KEY,
value TEXT
)
;

pwm=# CREATE table USER_AUDIT (
id VARCHAR(128) NOT NULL PRIMARY KEY,
value TEXT
);

pwm=# CREATE table INTRUDER (
id VARCHAR(128) NOT NULL PRIMARY KEY,
value TEXT
);

pwm=# CREATE table TOKENS (
id VARCHAR(128) NOT NULL PRIMARY KEY,
value TEXT
)
;

pwm=# CREATE table OTP (
id VARCHAR(128) NOT NULL PRIMARY KEY,
value TEXT
);

pwm=# CREATE table PW_NOTIFY (
id VARCHAR(128) NOT NULL PRIMARY KEY,
value TEXT
);

In pg_hba.conf, add the following line:

host pwm postgres 127.0.0.1/32 trust

Save and exit from pg_hba.conf

Restart Postgresql

# service postgresql restart

 

Settings required in PWM:

Download the file “postgresql-8.4-703.jdbc3.jar” for PostgreSQL 8.4.20 or the right version depending on the version of Postgres from the site: https://jdbc.postgresql.org/download.html.

Upload this file in PWM, Settings->Database (Remote)->Connection->Upload File->Select the file and click upload.

Set Database class as: org.postgresql.Driver

Set Database connection string as: jdbc:postgresql://localhost/pwm

Set Database username : postgres

Save the Database password for user ‘postgres’.

Set Database vendor as ‘Other’.

Test the Database connection.

Save PWM settings and exit.