102 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
14c6541dfb
email_server: Drop showing diagnostics/repair and roundcube config
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-01-31 18:46:04 -05:00
Sunil Mohan Adapa
9a2d66c62f
email_server: Drop some unused code
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-01-31 18:45:56 -05:00
Sunil Mohan Adapa
ece2a1db33
email_server: Rename dovecot TLS configuration file for consistency
Tests:

- Configuration parameters are set properly after fresh app setup according to
'doveconf'.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-14 18:22:57 -05:00
Sunil Mohan Adapa
9a8b57efd4
email_server: Adjust TLS configuration parameters
- Don't add TLS debugging information to Received: header.

- Drop unused fingerprint digest configuration. They are only used when
smtpd_tls_security_level is set to 'fingerprint' in which case certifying
authorities are ignored.

- Drop alterations to TLS low/high cipher lists. They are not used since
tls_ciphers are all set to 'medium'.

Tests:

- No configuration errors are reported by postfix in its logs after startup.

- 'postconf' shows that the new configuration parameters are set properly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-14 18:22:54 -05:00
Sunil Mohan Adapa
e43e144040
email_server: Re-implement TLS configuration
- Use LetsEncrypt component to perform TLS certificate copying instead of custom
implementation.

- Use two components to copy the certificates to dovecot and postfix separately.

- Add support for multiple domains using SNI. Provide all the certificates. Use
primary domain's certificate as the fallback certificate.

- Drop the diagnose/repair approach due to its complexity.

Tests:

- Installing the app works. After installation, all TLS parameters are show as
expected by 'postconf' command and 'doveconf' command.

- A default domain is selected by default. This will reflect as primary domain
in TLS certificate configuration.

- When primary domain is changed, the configuration is updated to reflect the
default certificate path but SNI configuration is unchanged in dovecot and
postfix.

- Postfix and dovecot are restarted after setup.

- There are no configuration error shows in postfix/dovecot logs.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-14 18:22:51 -05:00
Sunil Mohan Adapa
4b024b269b
email_server: Fix issue with handling domain removal
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-14 18:22:48 -05:00
Sunil Mohan Adapa
4ec1e15fc1
email_server: Include postfix package in packages list
- Mostly for consistency. Will be useful when uninstall action is implemented.

Tests:

- Installation of email server app works without errors.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-14 18:22:45 -05:00
Sunil Mohan Adapa
4d73d7eb7f
email_server: Merge domain configuration with app view
Test:

- Submit the domain form unchanged. Message is printed that settings are
unchanged.

- Submit the domain form with changes. Message is printed that domain has been
updated. Configuration reflects the new domain.

- On page load, the current domain is shown in the domain configuration form.

- Clicking the repair button the service alert section triggers the repair
operations as seen in the console.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-06 17:39:55 -05:00
Sunil Mohan Adapa
ae882fea70
email_server: Simplify domain configuration form
- By default, receive mail for all the domains on the system.

- Allow user to select a primary domain. This domain is used for TLS
certificate, automatically adding domain to sender address, etc.

- Don't expose postfix configuration parameters.

Tests:

- On installation, the domain list populated in postfix. Primary domain is
the one set in the config module. If it is not set, any other domain from
configured domains is taken.

- When not installed, adding/removing domains does not cause errors.

- Changing the domain in the domain view works. mydomain has the primary domain
set. myhostname has primary domain set. mydestination has default values and in
addition has all the domains on the system.

- /etc/mailname is populated with the primary domain.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-06 17:39:43 -05:00
Sunil Mohan Adapa
a3d4d99b33
*: Drop use of module level version
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-04 16:38:08 -05:00
Sunil Mohan Adapa
fb40bb7f42
*: Drop module level package_conflicts and use component API
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-04 16:37:03 -05:00
Sunil Mohan Adapa
781d8fa18b
*: Drop use of managed_services, rely on Daemon component
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-04 16:35:57 -05:00
Sunil Mohan Adapa
4bf57c5707
*: Drop use of managed_packages and rely on Packages component
- For zoph, drop dependency on php7.4 as it will cause issues for future
versions of php. The dependency was a hack and not needed for Bullseye and
higher.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-12-04 16:34:52 -05:00
Sunil Mohan Adapa
6429806114
email_server: Don't get domain name during initialization
This keeps the LE module working better when the domain name is changed after
startup.

Tests:

- Untested. The module is not enabled yet. LE functionality in email server is
not fully functional.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-15 10:13:00 -05:00
Sunil Mohan Adapa
d6a9392704
email_server: Use rollback journal for aliases sqlite DB
WAL journaling mode is causing problems with postfix unable to open the database
despite ownership and permission changes. Default is the DELETE rollback journal
mode. The former gives more performance but in our case, writes are very rare
and the DB is used mostly just for reads.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 19:44:48 -04:00
Sunil Mohan Adapa
8d7bac70c9
email_server: Setup /var/mail, drop home setup view
Creating home directories is no longer necessary. We store all mail in /var/mail
and don't allow use of direct access to mail folder.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 19:40:55 -04:00
Sunil Mohan Adapa
88e372b8f8
email_server: dovecot: Don't deliver mail to home directory
Delivering mail to home directory is only needed when users are expected to
login via terminal and use command line tools for accessing their email. In
FreedomBox, we expect users to use GUI tools such as Thunderbird and K-9 Mail to
access their mail. So, POP3 and IMAP access sufficient.

Not trying to compatible with command line mail tools means that high
performance mailbox storage formats can be chosen. This is important to ensure
that accessing mail via IMAP is fast. In future, we can consider enabling full
text search using Apache Solr.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 19:40:47 -04:00
Sunil Mohan Adapa
afc958a884
email_server: dovecot: Authenticate using PAM instead of LDAP
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 19:40:38 -04:00
Sunil Mohan Adapa
cb8c23c28d
email_server: Lookup LDAP local recipients via PAM
Most modern setups simply use to PAM to lookup local recipients instead of
integrating directly with LDAP. libnss-ldapd package that we install and
configure connects the password database with LDAP. Anyone then using PAM need
not be aware of LDAP integration. This reduces extra configuration and many
problems that come along with it.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 19:40:30 -04:00
Sunil Mohan Adapa
d0cf01fb29
email_server: Don't use user IDs when performing lookups
- Typical mail systems are configured to work on usernames or virtual usernames.
UIDs/GIDs are only needed at the final moment when delivering mails to user
inboxes that need to have proper UID/GID set.

- This makes it easy for dovecot to simply use PAM authentication instead of
having to use LDAP.

- Trying to hide UID from email headers is no longer necessary. Received: header
is important for debugging mail delivery across the chain. Don't miss out.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 19:40:19 -04:00
Sunil Mohan Adapa
8cb100be79
email_server: yapf formatting
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 19:10:34 -04:00
Sunil Mohan Adapa
a2038e98d6
email_server: action: Refactor for simplicity
- Parse arguments in a readable way.

- Convert decorator into simple call.

- Make a simple call instead of looking for subcommand.

- Don't setup logging in global scope.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 19:10:17 -04:00
Sunil Mohan Adapa
220149e6e0
email_server: domains: Add validation to form
- Based on what is already done in domains.py at the time of setting the
configuration.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 18:44:55 -04:00
Sunil Mohan Adapa
e85001f01f
email_server: domains: Use Django forms and views
- Eliminate error-prone custom code and styling.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 18:44:41 -04:00
Sunil Mohan Adapa
b62dd2442c
email_server: Minor refactor of license statement in templates
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 18:44:22 -04:00
Sunil Mohan Adapa
b3143ba201
email_server: homedir: Fix styling to not show everything as header
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 18:43:58 -04:00
Sunil Mohan Adapa
10c9156a29
email_server: Remove tabs from the interface
- All the views are reachable using buttons.

- Add title to the domains page as tabs are removed.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 18:43:40 -04:00
Sunil Mohan Adapa
94a6a9b8aa
email_server: domains: Add button for domain management form
- It will dropped from tabs.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 18:43:25 -04:00
Sunil Mohan Adapa
bb82dbdaa5
email_server: rspamd: Turn spam management link to a button
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 18:43:06 -04:00
Sunil Mohan Adapa
77a0d54632
email_server: tls: Drop unimplemented TLS forms/view
- In FreedomBox we will obtain and manage certificates automatically. No need
for forms to manage TLS certificates

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-03 18:42:41 -04:00
Sunil Mohan Adapa
31b438e5fd
email_server: aliases: Refactor for simpler organization
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 16:15:54 -04:00
Sunil Mohan Adapa
f2279ab58a
email_server: aliases: Fix showing empty alias list message
- Trim the button labels.

- Style the usual buttons as default buttons.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 16:15:51 -04:00
Sunil Mohan Adapa
db1df5ce6b
email_server: aliases: Minor refactor to list view
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 16:15:48 -04:00
Sunil Mohan Adapa
6eb5980f84
email_server: aliases: Minor refactoring to DB schema
- Use the IntergrityError exception instead of a complex query to ignore an
already existing alias.

- When retrieving existing aliases, use explicit list of columns instead of * so
that schema updates adding columns won't fail the code using the row results.

- Use terminology used by post fix. "name" for the name of the alias. "value"
for the mapping.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 16:15:44 -04:00
Sunil Mohan Adapa
778d22ac49
email_server: aliases: Minor refactoring
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 16:15:39 -04:00
Sunil Mohan Adapa
6e8b825d44
email_server: aliases: Drop hash DB and use sqlite3 directly
- Postfix has the ability to use sqlite3 databases directly. There is no need to
synchronize to a hash db and then use that.

- Store the aliases database in /var/lib/postfix/. This will make backup and
restore easier and remove dependence on FreedomBox and its data directory.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 16:15:26 -04:00
Sunil Mohan Adapa
91f18a0e52
email_server: yapf formatting
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 16:14:58 -04:00
Sunil Mohan Adapa
c742d18f3c
email_server: aliases: Drop unused regex
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:24 -04:00
Sunil Mohan Adapa
3e7037d0ea
email_server: aliases: Drop unused sanitizing method
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:21 -04:00
Sunil Mohan Adapa
c89a7fdb9d
email_server: aliases: Drop unnecessary sanitizing
- In the list form, the values are already sanitized as they are retrieved from
the database. Don't refuse to manage existing aliases that don't fit the format.

- In the create form, the form already sanitizes as necessary.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:18 -04:00
Sunil Mohan Adapa
6e236a41a8
email_server: aliases: Move sanitizing to form
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:16 -04:00
Sunil Mohan Adapa
19d45514de
email_server: aliases: Drop validation already done by form
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:12 -04:00
Sunil Mohan Adapa
f5d1cb474f
email_server: aliases: Using Django forms instead of custom forms
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:09 -04:00
Sunil Mohan Adapa
b0e460b433
email_server: aliases: Add method for checking of an alias is taken
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:06 -04:00
Sunil Mohan Adapa
b0d3bdb170
email_server: Reduce the size of headings for aliases/homedir pages
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 15:23:03 -04:00
Sunil Mohan Adapa
54b9a93400
email_server: Add heading for manage aliases page
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 11:03:57 -04:00
Sunil Mohan Adapa
9c7c39e61d
email_server: Remove aliases view from tabs list
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 11:03:27 -04:00
Sunil Mohan Adapa
b20d5a96c3
email_server: Add button for managing aliases
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 11:03:21 -04:00
Sunil Mohan Adapa
8ac0751f5b
email_server: Turn home view into a simple page rather than a tab
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 11:03:00 -04:00
Sunil Mohan Adapa
b7445e659b
email_server: Add button for setting up home directory
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-10-30 11:02:46 -04:00