-
Notifications
You must be signed in to change notification settings - Fork 547
Database
The King Phisher server requires a database connection for storing data related to campaigns that are running. Currently the only two backends that are currently supported are SQLite and PostgreSQL. After configuring the database, the connection string needs to be set in the server's configuration file under server/database
. When King Phisher starts for the first time it will create all necessary tables automatically.
PostgreSQL is the preferred database backend of King Phisher. The database needs to be created manually before the server starts. It is also highly recommended that a dedicated database user for King Phisher be created that only has access to the database used.
First find the pg_hba.conf
file and add the following line:
host "king_phisher" "king_phisher" 127.0.0.1/32 md5
Then create the PostgreSQL user:
postgres@localhost:$ createuser king_phisher -P
Enter password for new role: yournewpassword
Enter it again: yournewpassword
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
And finally create the database with the new owner:
postgres@localhost:$ createdb --owner=king_phisher king_phisher
The database service may need to be restarted and the server configuration file will need to be updated with the database connection string. The syntax for the PostgreSQL connection string in the configuration is postgresql://username:password@localhost/database_name
.
Starting in version 0.1.6 SQLite is only supported in a limited capacity. SQLite is fully supported for all King Phisher functions, with the exceptions of automatic database upgrades. If SQLite is being used, then when a new database schema is released for King Phisher, the old database will be incompatible. Users will be left with the only option of deleting the old SQLite database file in order to use the newest versions. Because of this, it is highly recommended that users who desire to maintain campaign data over long periods of time use a more full featured DBMS such as PostgreSQL.
The limitations of automatic database migration for SQLite is due to the lack of functionality surrounding the SQL ALTER TABLE
command. More details regarding this limitation can be found on the SQLite website.