passwords renamed

This commit is contained in:
Christoph Haas 2025-09-07 20:41:53 +02:00
parent 7f310614ea
commit 3c390fb1e5
5 changed files with 10 additions and 10 deletions

View file

@ -66,8 +66,8 @@ Take a note of the passwords or store them somewhere safe.
Create the database users: Create the database users:
```sql ```sql
grant all privileges on mailserver.* to 'mailadmin'@'localhost' identified by 'FIRST-PASSWORD-HERE'; grant all privileges on mailserver.* to 'mailadmin'@'localhost' identified by 'MAILADMIN-PASSWORD-HERE';
grant select on mailserver.* to 'mailserver'@'127.0.0.1' identified by 'SECOND-PASSWORD-HERE'; grant select on mailserver.* to 'mailserver'@'127.0.0.1' identified by 'MAILSERVER-PASSWORD-HERE';
``` ```
<Aside type="note" title="127.0.0.1 versus localhost"> <Aside type="note" title="127.0.0.1 versus localhost">

View file

@ -50,7 +50,7 @@ Run the following code in your shell to create a configuration file creating tha
```sh ```sh
cat > /etc/postfix/mariadb-virtual-mailbox-domains.cf << EOF cat > /etc/postfix/mariadb-virtual-mailbox-domains.cf << EOF
user = mailserver user = mailserver
password = SECOND-PASSWORD-HERE password = MAILSERVER-PASSWORD-HERE
hosts = 127.0.0.1 hosts = 127.0.0.1
dbname = mailserver dbname = mailserver
query = SELECT 1 FROM virtual_domains WHERE name='%s' query = SELECT 1 FROM virtual_domains WHERE name='%s'
@ -62,7 +62,7 @@ and `dbname` definitions tell Postfix how to connect to the database. And the `q
domain is present in the database table `virtual_domains`. Using `SELECT 1` we return just the number 1 if such an entry domain is present in the database table `virtual_domains`. Using `SELECT 1` we return just the number 1 if such an entry
was found. In fact it does not matter what we return. Any _answer_ is fine. was found. In fact it does not matter what we return. Any _answer_ is fine.
Don't forget to replace the `SECOND-PASSWORD-HERE` by your own password for the `mailserver` user. Don't forget to replace the `MAILSERVER-PASSWORD-HERE` by your own password for the `mailserver` user.
### Virtual Aliases ### Virtual Aliases
@ -84,7 +84,7 @@ Run this code to create the appropriate mapping file:
```sh ```sh
cat > /etc/postfix/mariadb-virtual-alias-maps.cf << EOF cat > /etc/postfix/mariadb-virtual-alias-maps.cf << EOF
user = mailserver user = mailserver
password = SECOND-PASSWORD-HERE password = MAILSERVER-PASSWORD-HERE
hosts = 127.0.0.1 hosts = 127.0.0.1
dbname = mailserver dbname = mailserver
query = SELECT destination FROM virtual_aliases WHERE source='%s' query = SELECT destination FROM virtual_aliases WHERE source='%s'
@ -100,7 +100,7 @@ The last mapping we need is a query to find valid mailboxes. Without further ado
```sh ```sh
cat > /etc/postfix/mariadb-virtual-mailbox-maps.cf << EOF cat > /etc/postfix/mariadb-virtual-mailbox-maps.cf << EOF
user = mailserver user = mailserver
password = SECOND-PASSWORD-HERE password = MAILSERVER-PASSWORD-HERE
hosts = 127.0.0.1 hosts = 127.0.0.1
dbname = mailserver dbname = mailserver
query = SELECT 1 FROM virtual_users WHERE email='%s' query = SELECT 1 FROM virtual_users WHERE email='%s'

View file

@ -136,7 +136,7 @@ sql_driver = mysql
mysql /var/run/mysqld/mysqld.sock { mysql /var/run/mysqld/mysqld.sock {
user = mailserver user = mailserver
password = 'SECOND-PASSWORD-HERE' password = 'MAILSERVER-PASSWORD-HERE'
dbname = mailserver dbname = mailserver
host = 127.0.0.1 host = 127.0.0.1
} }

View file

@ -133,7 +133,7 @@ $config['password_minimum_length'] = 12;
$config['password_force_save'] = true; $config['password_force_save'] = true;
$config['password_algorithm'] = 'blowfish-crypt'; $config['password_algorithm'] = 'blowfish-crypt';
$config['password_algorithm_prefix'] = '{CRYPT}'; $config['password_algorithm_prefix'] = '{CRYPT}';
$config['password_db_dsn'] = 'mysql://mailadmin:FIRST-PASSWORD-HERER@localhost/mailserver'; $config['password_db_dsn'] = 'mysql://mailadmin:MAILADMIN-PASSWORD-HERER@localhost/mailserver';
$config['password_query'] = "UPDATE virtual_users SET password=%P WHERE email=%u"; $config['password_query'] = "UPDATE virtual_users SET password=%P WHERE email=%u";
?> ?>
EOF EOF
@ -155,7 +155,7 @@ Lets briefly cover the meaning of those lines:
The cryptographic algorithm to encode the password. This one is considered very secure and supported by Dovecot. The cryptographic algorithm to encode the password. This one is considered very secure and supported by Dovecot.
- `$config['password_algorithm_prefix'] = '{CRYPT}';`\ - `$config['password_algorithm_prefix'] = '{CRYPT}';`\
Prepend every password with this string so that Dovecot knows how we encrypted the password. Prepend every password with this string so that Dovecot knows how we encrypted the password.
- `$config['password_db_dsn'] = 'mysql://mailadmin:FIRST-PASSWORD-HERER@localhost/mailserver';`\ - `$config['password_db_dsn'] = 'mysql://mailadmin:MAILADMIN-PASSWORD-HERER@localhost/mailserver';`\
Connection information for the local database. Use your own password for the _mailadmin_ (!) database user here. We cannot Connection information for the local database. Use your own password for the _mailadmin_ (!) database user here. We cannot
use the restricted _mailserver_ user because we have to write the new password to the database. use the restricted _mailserver_ user because we have to write the new password to the database.
- `$config['password_query'] = "UPDATE virtual_users SET password=%P WHERE email=%u";`\ - `$config['password_query'] = "UPDATE virtual_users SET password=%P WHERE email=%u";`\

View file

@ -490,7 +490,7 @@ sides. Let's create it:
```sh ```sh
cat > /etc/postfix/mariadb-email2email.cf << EOF cat > /etc/postfix/mariadb-email2email.cf << EOF
user = mailserver user = mailserver
password = SECOND-PASSWORD-HERE password = MAILSERVER-PASSWORD-HERE
hosts = 127.0.0.1 hosts = 127.0.0.1
dbname = mailserver dbname = mailserver
query = SELECT email FROM virtual_users WHERE email='%s' query = SELECT email FROM virtual_users WHERE email='%s'