maddy

Fork https://github.com/foxcpp/maddy

git clone git://git.lin.moe/go/maddy.git

  1# Upgrading from older maddy versions
  2
  3It is generally possible to just install latest version (e.g. using build.sh
  4script) over the existing installation.
  5
  6It is recommended to backup state directory (usually /var/lib/maddy for Linux)
  7before doing so. The new server version may automatically convert DB files in a
  8way that will make them unreadable by older versions.
  9
 10Specific instructions for upgrading between versions with incompatible changes
 11are documented on this page below.
 12
 13## Incompatible version migration
 14
 15## 0.2 -> 0.3
 16
 170.3 includes a significant change to the authentication code that makes it
 18completely independent of IMAP index. This means 0.2 "unified" database cannot
 19be used in 0.3 and auto-migration is not possible. Additionally, the way
 20passwords are hashed is changed, meaning that after migration passwords will
 21need to be reset.
 22
 23**Migration utility is SQLite-specific, if you need one that works for
 24Postgres - reach out at the IRC channel.**
 25
 261. Make sure the server is not running.
 27
 28```
 29systemctl stop maddy
 30```
 31
 322. Take a backup of `imapsql.db*` files in state directory (/var/lib/maddy).
 33
 34```
 35mkdir backup
 36cp /var/lib/maddy/imapsql.db* backup/
 37```
 38
 393. Compile migration utility:
 40
 41```
 42git clone https://github.com/foxcpp/maddy.git
 43cd maddy/
 44git checkout v0.3.0
 45cd cmd/migrate-db-0.2
 46go build
 47```
 48
 494. Run compiled binary:
 50
 51```
 52./migrate-db-0.2 /var/lib/maddy/imapsql.db
 53```
 54
 555. Open maddy.conf and make following changes:
 56
 57Remove `local_authdb` name from imapsql configuration block:
 58```
 59imapsql local_mailboxes {
 60    driver sqlite3
 61    dsn imapsql.db
 62}
 63```
 64
 65Add `local_authdb` configuration block using `pass_table` module:
 66
 67```
 68pass_table local_authdb {
 69    table sql_table {
 70        driver sqlite3
 71        dsn credentials.db
 72        table_name passwords
 73    }
 74}
 75```
 76
 776. Use `maddy creds create ACCOUNT_NAME` to add credentials to `pass_table`
 78   store.
 79
 807. Start the server back.
 81
 82```
 83systemctl start maddy
 84```
 85
 86## 0.1 -> 0.2
 87
 880.2 requires several changes in configuration file.
 89
 90Change
 91```
 92sql local_mailboxes local_authdb {
 93```
 94to
 95```
 96imapsql local_mailboxes local_authdb {
 97```
 98
 99Replace
100```
101replace_rcpt postmaster postmaster@$(primary_domain)
102```
103with
104```
105replace_rcpt static {
106    entry postmaster postmaster@$(primary_domain)
107}
108```
109and
110
111```
112replace_rcpt "(.+)\+(.+)@(.+)" "$1@$3"
113```
114with
115```
116replace_rcpt regexp "(.+)\+(.+)@(.+)" "$1@$3"
117```