summaryrefslogtreecommitdiff
path: root/README.md
blob: 872fa20b92b551ea36108c51a4740328f3101349 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
JWebmail
========

SESSION STORAGE
---------------

This is a quick guide on how to set up the session storage.
Your options are Redis/Valkey, MySQL/MariaDB or SQLite.
They must be reachable by localhost or writable by the current user.

This is an example configuration:

    [JWEBMAIL.READ_MAILS]
    SESSION_TYPE = 'REDIS'
    SESSION_STORE_PASSWD = '$PASSWORD'

Make sure the config file can only be read by user/group `jwebmail` when you specify a password.

### SQLite

1. Make sure the db is created at a location where the jwebmail user has
   read and write permissions. Use the SESSION_STORE_DB_NAME value to set
   the path.

### Redis

1. Create a user 'jwebmail'
2. Grant privileges for that user to 'jwm:user:*' for the commands setex and getex.

        ACL SETUSER jwebmail ~jwm:user:* -@all +setex +getex >$PASSWORD

### MySQL / MariaDB

1. Create a user 'jwebmail' with a password

        CREATE USER jwebmail@localhost IDENTIFIED BY '$PASSWORD';

2. Create a database 'jwebmaildb1'

        CREATE DATABASE jwebmaildb1;
        USE jwebmaildb1;

3. Create a table 'session' with the following schema

        CREATE TABLE session (user char(64) PRIMARY KEY, password varchar(255), timeout timestamp NOT NULL);
        CREATE INDEX timeout_idx ON session (timeout); -- Optional

4. Grant privileges to the user jwebmail for the above table for at least SELECT, INSERT, UPDATE and DELETE

        GRANT SELECT, INSERT, UPDATE, DELETE PRIVILEGES ON 'jwebmaildb1'.'session' TO 'jwebmail'@'localhost';