Jakub Czajka [Sun, 27 Nov 2022 09:19:15 +0000 (10:19 +0100)]
[matrix] Enable delegation.
A matrix server is typically available under a subdomain eg.
matrix.<domain>. This commit makes it available additionally simply
under <domain>. Users can now be addressed as @<user>:<domain>. Note,
that this does not work when asked explicitly about server's name.
Jakub Czajka [Sun, 27 Nov 2022 09:17:37 +0000 (10:17 +0100)]
[matrix] Proxy communication through `nginx`.
This commit configures `nginx` to act as a reverse proxy for
matrix. `nginx` receives requests on ports 443 (client) and
8448 (other matrix instances) and forwards them to localhost:8008 for
matrix to process.
Jakub Czajka [Sun, 6 Nov 2022 15:22:19 +0000 (16:22 +0100)]
[postfix] Authenticate with dovecot SASL.
`postfix` authenticates MAIL FROM and RCPT TO addresses. This commit
routes this authentication through `dovecot` SASL. It queries the
address book for credentials.
Jakub Czajka [Mon, 1 May 2023 09:42:56 +0000 (11:42 +0200)]
[postfix] Deliver to addresses found in the address book.
`postfix` relays to local mailbox only if the RCPT TO domain can be
found in `$mydestination` and RCPT TO address can be found in
`$alias_maps`. This commit sets these variables to query the address
book.
Jakub Czajka [Sun, 6 Nov 2022 15:00:28 +0000 (16:00 +0100)]
[dovecot] Document SPF and DMARC DNS records.
SPF DNS records specify which IP addresses may send email on behalf of
the domain. DMARC DNS records specify what happens when mail cannot be
delivered.
Jakub Czajka [Sun, 6 Nov 2022 14:48:03 +0000 (15:48 +0100)]
[postfix] Fill missing header fields.
Gmail requires a `MessageId` header field. However, not all clients
set this field and gmail reject emails. This commit instructs
`postfix` to add missing headers fields (eg. `MessageId`).
Jakub Czajka [Sat, 29 Oct 2022 22:22:28 +0000 (00:22 +0200)]
[dovecot] Enable virtual mailboxes.
Virtual mailboxes are mailboxes created for new users automatically
based on their credentials. Userdb lookups aren't necessary.
Directories for virtual mailboxes are owned by a single system
user (`vmail`). This commit enables virtual mailboxes in `dovecot`:
- Static userdb instead of SQL query.
- Username column as the primary key of the address book. It has to be
unique to prevent virtual mailboxes overlapping.
Jakub Czajka [Sat, 15 Oct 2022 12:43:18 +0000 (14:43 +0200)]
[dovecot] Secure connections with TLS.
TLS connections need to be secured with SSL certificates. `dovecot`
generates self-signed SSL certificates. This commit switches `dovecot`
and `postfix` to SSL certificates signed by Let's Encrypt CA.
Jakub Czajka [Fri, 7 Oct 2022 17:31:10 +0000 (19:31 +0200)]
[postfix] Rewrite sender for outgoing email.
`myorigin` specifies the address of outgoing email (user@domain). It
defaults to `$myhostname = gethostname()`. This allows rewriting the
sender of outgoing email without changing configuration.
Jakub Czajka [Sun, 25 Sep 2022 19:35:16 +0000 (21:35 +0200)]
[sshd] Disable reverse DNS checks.
By default `sshd` compares the IP address of the client with the
result of a reverse DNS query for that address. However, many clients
do not have reverse DNS records. This commit disables the check.
Jakub Czajka [Sun, 25 Sep 2022 17:44:41 +0000 (19:44 +0200)]
[sshd] Limit the number of alive messages.
`sshd` keeps idle connection alive for `ClientAliveInterval` seconds
and then sends `ClientAliveCountMax` alive messages. If client does
not respond, `sshd` terminates the connection. This commit limits the
number of alive messages to 1.
Note: `ClientAliveCountMax` applies only to SSH protocol 2.
Jakub Czajka [Sun, 25 Sep 2022 15:27:55 +0000 (17:27 +0200)]
[sshd] Listen on a non-standard port.
By default `sshd` listens on port 22. Most attack scripts are written
for this configuration. This commit changes the port to 72, which is
not used by any other popular service.
Jakub Czajka [Sun, 25 Sep 2022 15:11:45 +0000 (17:11 +0200)]
[sshd] Disable password authentication.
Client can authenticate with `sshd` through one of following
authentication methods (corresponding sshd_config option in brackets):
- host-based (`HostbasedAuthentication`),
- public key (`PubkeyAuthentication`),
- challenge-response (`ChallengeResponseAuthentication`),
- password (`PasswordAuthentication`).
By default, only `PubkeyAuthentication` and `PasswordAuthentication`
are enabled. This commit disables `PasswordAuthentication`. Users
can now login only using public key authentication.