Mail admin SQL

This commit is contained in:
Jeff Moe 2024-09-01 12:39:55 -06:00
parent 53ccf3851b
commit 6fda76bc77
2 changed files with 259 additions and 54 deletions

View file

@ -9,7 +9,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Libre Developers Documentation 0\n" "Project-Id-Version: Libre Developers Documentation 0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-01 11:54-0600\n" "POT-Creation-Date: 2024-09-01 12:39-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n" "Language: en\n"
@ -50,7 +50,7 @@ msgstr ""
msgid "For more information and details about what is what, refer to that site." msgid "For more information and details about what is what, refer to that site."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:20 ../../../_source/mail-libre-is.rst:233 #: ../../../_source/mail-libre-is.rst:20 ../../../_source/mail-libre-is.rst:236
msgid "Dovecot" msgid "Dovecot"
msgstr "" msgstr ""
@ -58,11 +58,11 @@ msgstr ""
msgid "`<https://dovecot.org/>`_" msgid "`<https://dovecot.org/>`_"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:25 ../../../_source/mail-libre-is.rst:79 #: ../../../_source/mail-libre-is.rst:25 ../../../_source/mail-libre-is.rst:82
msgid "MariaDB" msgid "MariaDB"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:28 ../../../_source/mail-libre-is.rst:449 #: ../../../_source/mail-libre-is.rst:28 ../../../_source/mail-libre-is.rst:452
msgid "OpenDKIM" msgid "OpenDKIM"
msgstr "" msgstr ""
@ -70,7 +70,7 @@ msgstr ""
msgid "`<http://www.opendkim.org/>`_" msgid "`<http://www.opendkim.org/>`_"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:32 ../../../_source/mail-libre-is.rst:457 #: ../../../_source/mail-libre-is.rst:32 ../../../_source/mail-libre-is.rst:460
msgid "OpenDMARC" msgid "OpenDMARC"
msgstr "" msgstr ""
@ -82,7 +82,7 @@ msgstr ""
msgid "`<https://github.com/trusteddomainproject/OpenDMARC>`_" msgid "`<https://github.com/trusteddomainproject/OpenDMARC>`_"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:38 ../../../_source/mail-libre-is.rst:131 #: ../../../_source/mail-libre-is.rst:38 ../../../_source/mail-libre-is.rst:134
msgid "Postfix" msgid "Postfix"
msgstr "" msgstr ""
@ -90,7 +90,7 @@ msgstr ""
msgid "`<https://www.postfix.org/>`_" msgid "`<https://www.postfix.org/>`_"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:44 ../../../_source/mail-libre-is.rst:472 #: ../../../_source/mail-libre-is.rst:44 ../../../_source/mail-libre-is.rst:475
msgid "DNS" msgid "DNS"
msgstr "" msgstr ""
@ -98,215 +98,303 @@ msgstr ""
msgid "Add a DNS mx record, so it returns result like this:" msgid "Add a DNS mx record, so it returns result like this:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:55 #: ../../../_source/mail-libre-is.rst:52
msgid "Set IP for mail.libre.is. Set up reverse DNS records."
msgstr ""
#: ../../../_source/mail-libre-is.rst:58
msgid "Debian" msgid "Debian"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:56 #: ../../../_source/mail-libre-is.rst:59
msgid "" msgid ""
"Install Debian stable (bookworm). Install rsyslog for old school " "Install Debian stable (bookworm). Install rsyslog for old school "
"convenience:" "convenience:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:65 #: ../../../_source/mail-libre-is.rst:68
msgid "Apache" msgid "Apache"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:66 #: ../../../_source/mail-libre-is.rst:69
msgid "" msgid ""
"The Apache webserver is used out of laziness as it allows easy " "The Apache webserver is used out of laziness as it allows easy "
"certificate updates with certbot. A webmail server won't be running on " "certificate updates with certbot. A webmail server won't be running on "
"the main mail server." "the main mail server."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:75 #: ../../../_source/mail-libre-is.rst:78
msgid "Open up firewall ports 80 and 443." msgid "Open up firewall ports 80 and 443."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:80 #: ../../../_source/mail-libre-is.rst:83
msgid "The main database server." msgid "The main database server."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:88 #: ../../../_source/mail-libre-is.rst:91
msgid "Add databases. Change password to something secure." msgid "Add databases. Change password to something secure."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:132 #: ../../../_source/mail-libre-is.rst:135
msgid "The main SMTP mail server." msgid "The main SMTP mail server."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:139 #: ../../../_source/mail-libre-is.rst:142
msgid "" msgid ""
"Set up postfix to use MariaDB. Edit /etc/postfix/mysql-virtual-mailbox-" "Set up postfix to use MariaDB. Edit /etc/postfix/mysql-virtual-mailbox-"
"domains.cf and add below, using the mailserver password used in MariaDB." "domains.cf and add below, using the mailserver password used in MariaDB."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:152 #: ../../../_source/mail-libre-is.rst:155
msgid "Edit /etc/postfix/mysql-virtual-mailbox-maps.cf and add below contents:" msgid "Edit /etc/postfix/mysql-virtual-mailbox-maps.cf and add below contents:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:162 #: ../../../_source/mail-libre-is.rst:165
msgid "Edit /etc/postfix/mysql-virtual-alias-maps.cf and add below:" msgid "Edit /etc/postfix/mysql-virtual-alias-maps.cf and add below:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:172 #: ../../../_source/mail-libre-is.rst:175
msgid "Edit /etc/postfix/mysql-email2email.cf and add:" msgid "Edit /etc/postfix/mysql-email2email.cf and add:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:182 #: ../../../_source/mail-libre-is.rst:185
msgid "Then run these commands:" msgid "Then run these commands:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:199 #: ../../../_source/mail-libre-is.rst:202
msgid "Redis" msgid "Redis"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:200 #: ../../../_source/mail-libre-is.rst:203
msgid "" msgid ""
"Note, the licensing of Redis has gone bad. The version in Debian is OK. " "Note, the licensing of Redis has gone bad. The version in Debian is OK. "
"But in the future, probably replace with a fork." "But in the future, probably replace with a fork."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:209 #: ../../../_source/mail-libre-is.rst:212
msgid "rspamd" msgid "rspamd"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:210 #: ../../../_source/mail-libre-is.rst:213
msgid "Spam control." msgid "Spam control."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:218 #: ../../../_source/mail-libre-is.rst:221
msgid "Certbot" msgid "Certbot"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:219 #: ../../../_source/mail-libre-is.rst:222
msgid "" msgid ""
"Encryption certificates with Let's Encrypt. Not using an Apache webserver" "Encryption certificates with Let's Encrypt. Not using an Apache webserver"
" on the mail server makes getting new certificates a bit more complex." " on the mail server makes getting new certificates a bit more complex."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:234 #: ../../../_source/mail-libre-is.rst:237
msgid "Just using encrypted IMAPS, not POP." msgid "Just using encrypted IMAPS, not POP."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:241 #: ../../../_source/mail-libre-is.rst:244
msgid "" msgid ""
"Note, since IPv6 isn't being used, the dovecot install barfs. Edit " "Note, since IPv6 isn't being used, the dovecot install barfs. Edit "
"/etc/dovecot/dovecot.conf and add this line, where appropriate:" "/etc/dovecot/dovecot.conf and add this line, where appropriate:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:248 #: ../../../_source/mail-libre-is.rst:251
msgid "" msgid ""
"Note, this is removing the \"::\" from listen, which using IPv6. Then re-" "Note, this is removing the \"::\" from listen, which using IPv6. Then re-"
"run the install so the packages are happy. Note, the re-install won't " "run the install so the packages are happy. Note, the re-install won't "
"overwrite the \"listen\" change." "overwrite the \"listen\" change."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:257 #: ../../../_source/mail-libre-is.rst:260
msgid "Add user and set up configs" msgid "Add user and set up configs"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:285 #: ../../../_source/mail-libre-is.rst:288
msgid "Edit /etc/dovecot/conf.d/10-master.conf and add:" msgid "Edit /etc/dovecot/conf.d/10-master.conf and add:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:296 #: ../../../_source/mail-libre-is.rst:299
msgid "" msgid ""
"Edit /etc/dovecot/conf.d/10-ssl.conf, set key locations, and make it " "Edit /etc/dovecot/conf.d/10-ssl.conf, set key locations, and make it "
"required." "required."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:305 #: ../../../_source/mail-libre-is.rst:308
msgid "" msgid ""
"Edit /etc/dovecot/dovecot-sql.conf.ext file and add these lines at the " "Edit /etc/dovecot/dovecot-sql.conf.ext file and add these lines at the "
"bottom, changing the password to the mailserver database password." "bottom, changing the password to the mailserver database password."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:328 #: ../../../_source/mail-libre-is.rst:331
msgid "Set file permissions." msgid "Set file permissions."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:335 #: ../../../_source/mail-libre-is.rst:338
msgid "Edit /etc/dovecot/conf.d/10-master.conf and change to:" msgid "Edit /etc/dovecot/conf.d/10-master.conf and change to:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:348 #: ../../../_source/mail-libre-is.rst:351
msgid "Restart dovecot server." msgid "Restart dovecot server."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:354 #: ../../../_source/mail-libre-is.rst:357
msgid "Run this to tell postfix to deliver to dovecot:" msgid "Run this to tell postfix to deliver to dovecot:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:360 #: ../../../_source/mail-libre-is.rst:363
msgid "Edit /etc/dovecot/conf.d/20-lmtp.conf and change line like this:" msgid "Edit /etc/dovecot/conf.d/20-lmtp.conf and change line like this:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:367 #: ../../../_source/mail-libre-is.rst:370
msgid "Restart dovecot again...." msgid "Restart dovecot again...."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:375 #: ../../../_source/mail-libre-is.rst:378
msgid "More postfix" msgid "More postfix"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:376 #: ../../../_source/mail-libre-is.rst:379
msgid "More postfix configuration, now that the above is set up." msgid "More postfix configuration, now that the above is set up."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:378 #: ../../../_source/mail-libre-is.rst:381
msgid "Set postfix to use dovecot for authentication:" msgid "Set postfix to use dovecot for authentication:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:392 #: ../../../_source/mail-libre-is.rst:395
msgid "Edit /etc/postfix/master.cf and change thusly:" msgid "Edit /etc/postfix/master.cf and change thusly:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:409 #: ../../../_source/mail-libre-is.rst:412
msgid "Run:" msgid "Run:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:415 #: ../../../_source/mail-libre-is.rst:418
msgid "Restart postfix:" msgid "Restart postfix:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:421 #: ../../../_source/mail-libre-is.rst:424
msgid "" msgid ""
"Does it ever end? Edit /etc/postfix/master.cf and add to bottom of " "Does it ever end? Edit /etc/postfix/master.cf and add to bottom of "
"submission section." "submission section."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:433 #: ../../../_source/mail-libre-is.rst:436
msgid "" msgid ""
"Allow aliases to send by adding this file (XXX check OK) " "Allow aliases to send by adding this file (XXX check OK) "
"/etc/postfix/aliases.cf with this contents:" "/etc/postfix/aliases.cf with this contents:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:441 #: ../../../_source/mail-libre-is.rst:444
msgid "Make sure all is good:" msgid "Make sure all is good:"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:458 #: ../../../_source/mail-libre-is.rst:461
msgid "Requires database setup." msgid "Requires database setup."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:467 #: ../../../_source/mail-libre-is.rst:470
msgid "SPF" msgid "SPF"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:468 #: ../../../_source/mail-libre-is.rst:471
msgid "Set up SPF." msgid "Set up SPF."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:473 #: ../../../_source/mail-libre-is.rst:476
msgid "Set up DNS." msgid "Set up DNS."
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:477 #: ../../../_source/mail-libre-is.rst:481
msgid "Administration"
msgstr ""
#: ../../../_source/mail-libre-is.rst:482
msgid "Now that everything is working..."
msgstr ""
#: ../../../_source/mail-libre-is.rst:484
msgid "Log into the database using the mailadmin databse password:"
msgstr ""
#: ../../../_source/mail-libre-is.rst:492
msgid "List Virtual Domains"
msgstr ""
#: ../../../_source/mail-libre-is.rst:500
msgid "List Virtual Users"
msgstr ""
#: ../../../_source/mail-libre-is.rst:508
msgid "List Virtual Aliases"
msgstr ""
#: ../../../_source/mail-libre-is.rst:516
msgid "Add Virtual Domain"
msgstr ""
#: ../../../_source/mail-libre-is.rst:518
msgid "Add the domain:"
msgstr ""
#: ../../../_source/mail-libre-is.rst:526
msgid "Add a Mail User"
msgstr ""
#: ../../../_source/mail-libre-is.rst:527
msgid "Generate a password with dovecot:"
msgstr ""
#: ../../../_source/mail-libre-is.rst:533
msgid ""
"Log into database as mailadmin and run this command, using the dovecot "
"generated password string, and set the domain and user email."
msgstr ""
#: ../../../_source/mail-libre-is.rst:536
msgid "Note, upstream docs are missing \"(\" and \")\" for VALUES."
msgstr ""
#: ../../../_source/mail-libre-is.rst:546
msgid "Add a User Alias"
msgstr ""
#: ../../../_source/mail-libre-is.rst:547
msgid ""
"Example to add an alias. The first email should be the alias, the second "
"email is where it should go to."
msgstr ""
#: ../../../_source/mail-libre-is.rst:558
msgid "Change a User Password"
msgstr ""
#: ../../../_source/mail-libre-is.rst:559
msgid "Generate string for new password:"
msgstr ""
#: ../../../_source/mail-libre-is.rst:565
msgid "Use that string:"
msgstr ""
#: ../../../_source/mail-libre-is.rst:573
msgid "Delete Virtual Domain"
msgstr ""
#: ../../../_source/mail-libre-is.rst:581
msgid "Delete User"
msgstr ""
#: ../../../_source/mail-libre-is.rst:589
msgid "Delete Alias"
msgstr ""
#: ../../../_source/mail-libre-is.rst:597
msgid "Other" msgid "Other"
msgstr "" msgstr ""
#: ../../../_source/mail-libre-is.rst:478 #: ../../../_source/mail-libre-is.rst:598
msgid "Perhaps these too." msgid "Perhaps these too."
msgstr "" msgstr ""

View file

@ -476,6 +476,123 @@ DNS
Set up DNS. Set up DNS.
Administration
==============
Now that everything is working...
Log into the database using the mailadmin databse password:
.. code-block:: sh
mariadb -u mailadmin -p mailserver
List Virtual Domains
--------------------
.. code-block:: sql
SELECT * FROM virtual_domains;
List Virtual Users
------------------
.. code-block:: sql
SELECT * FROM virtual_users;
List Virtual Aliases
--------------------
.. code-block:: sql
SELECT * FROM virtual_aliases;
Add Virtual Domain
------------------
Add the domain:
.. code-block:: sql
INSERT INTO virtual_domains (name) VALUES ("example.org");
Add a Mail User
---------------
Generate a password with dovecot:
.. code-block:: sh
sudo dovecot pw -s BLF-CRYPT
Log into database as mailadmin and run this command, using the dovecot
generated password string, and set the domain and user email.
Note, upstream docs are missing "(" and ")" for VALUES.
.. code-block:: sql
INSERT INTO virtual_users (domain_id, email, password) VALUES
((SELECT id FROM virtual_domains WHERE name='example.org'),
'john@example.org','{BLF-CRYPT}$2y$05$.We…');
Add a User Alias
----------------
Example to add an alias. The first email should be the alias,
the second email is where it should go to.
.. code-block:: sql
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES
( (SELECT id FROM virtual_domains WHERE name='example.org'),
'melissa@example.org', 'juila@example.net');
Change a User Password
----------------------
Generate string for new password:
.. code-block:: sh
sudo dovecot pw -s BLF-CRYPT
Use that string:
.. code-block:: sql
UPDATE virtual_users SET password='{BLF-CRYPT}$2y$05$.We…' WHERE email='email@address';
Delete Virtual Domain
---------------------
.. code-block:: sql
DELETE FROM virtual_domains where name='example.org';
Delete User
-----------
.. code-block:: sql
DELETE FROM virtual_users WHERE email='john@example.org';
Delete Alias
------------
.. code-block:: sql
DELETE FROM virtual_aliases WHERE source='melissa@example.org';
Other Other
===== =====
Perhaps these too. Perhaps these too.