Commit Graph

91 Commits

Author SHA1 Message Date
42cf518c80 build(version): bump version 0.1.0rc1 → 0.1.0rc2 v0.1.0rc2 0.1.0rc2 2022-02-19 05:35:03 +00:00
Jon
2fdd4a8411 Merge branch '1-tracing-features' into 'development'
feat: ensure tracing is possible and lock down ssl ciphers

See merge request nofusscomputing/projects/docker-mail!9
2022-02-19 05:25:24 +00:00
e8eb6f906f fix(backup.sh): exclude unix sockets from backup
MR !9
2022-02-19 12:52:23 +09:30
acccf24774 fix(backup): ssl dir renamed to certs
MR !9
2022-02-19 12:51:51 +09:30
22a987a513 feat(docker_container): Ensure amavis data is a volume
The amavis data is required to be kept between containers.
set '/var/lib/amavis' as a docker volume.

MR !9
2022-02-19 12:32:50 +09:30
9f7ccabfa5 feat(amavis): don't allow user to send banned email
This configuration blocks the user from sending an email that w
would otherwise be blocked. in this instance the user is notified.

MR !9
2022-02-19 12:23:20 +09:30
c3739c4f19 feat(amavis): Don't allow user to send spam/virus
With this configuration if the user attempts to send spam or a
virus, the message will be quarantined and the user will be
notified of the issue.

MR !9
2022-02-19 12:16:20 +09:30
f6b7bae3eb feat(amavis): move policy bank to own config file
MR !9
2022-02-19 12:14:58 +09:30
7ec9750216 feat(amavis): Add received header to message
For tracing purposes, added the amavis received header to the message.

MR !9
2022-02-19 11:47:04 +09:30
93378dee86 fix(backup): /var/spool/postfix needs to be backed up
As this folder contains the mta folders and queue. It must be
backed up as mail could be lost that is awaiting delivery.

MR !9
2022-02-19 11:29:44 +09:30
43f6a356bd fix(sa-learn): amavis can't do bayes check if not mask 777
Service amavis even though part of group vmail who has mark 770
on '/var/spool/spamassassin', can't write lockfile to do a bayes
check.

Set '/var/spool/spamassassin' mask to be `777` with owner
`debian-spamd:vmail` recursive. so that amavis bayes check works.

MR !9
2022-02-19 11:21:04 +09:30
e9fb4123e9 fix(dovecot): sieve extensions debug error.
Sieve extensions set to:
    -vacation
        Remove vaction extension as this has the potential to leak to
        external users. this could be re-enabled if it could be blocked
        from leaving the server and only being available within the
        same domain
    -enotify
        Remove enotify extension as this has the potential to leak to
        external users. this could be re-enabled if it could be blocked
        from leaving the server and only being available within the
        same domain
    -editheader
        editheader disabled, as the user should not be able to edit
        message headers as this could remove message validity.
    imap4flags
        Enable imap4flags so that the user can flag messages as they
        desire.

MR !9
2022-02-19 11:02:36 +09:30
2a222df778 feat(ssl_tls): updated dovecot and postfix accepted ciphers
used https://ssl-config.mozilla.org/ to generate recommended
ciphers config for dovecot and postfix.

postfix set to use medium ciphers due to possibility of smtp
servers not being updated to latest.

MR !9
2022-02-19 10:41:53 +09:30
3741b92606 ci(docker_hub): fix rc release must be tagged 'dev'
A release candidate is not a stable release and therefore not
suitable for the 'latest' tag.
Tag a release candidate as 'dev'.

MR !9
2022-02-19 10:26:52 +09:30
396cb15add feat(dovecot): Disable SSL/TLS protocol logging
Disabled due to no actual output being useful. if required by an
end user, they can enable.

MR !9
2022-02-19 10:16:40 +09:30
e9718c97a6 fix(cron): sa-learn must run as spamd user
MR !9
2022-02-19 10:12:26 +09:30
967fd04fe7 fix(bayes_learn): ensure journal is synced after scan
MR !9
2022-02-19 10:11:31 +09:30
fbdf6efab7 fix(file_permission): set spamd to own spamassassin folder
Folder belongs to spamd user. this was required so that amavis spam bayes learning could read the files.

MR !9
2022-02-19 10:10:46 +09:30
7f7a259a82 fix(local_group): amavis and opendkim added to vmail
users require access to vmail group data.

MR !9
2022-02-19 10:07:41 +09:30
24f10af6d6 feat(postfix): prevent anonymous users on submission
Users are required to login to send an E-Mail. Prevented
anonymous user access

MR !9
2022-02-19 09:00:10 +09:30
274ade2d84 feat(dovecot): log SSL/TLS porotocol errors
Visibility is required to view and fault find SSL/TLS errors.

MR !9
2022-02-19 08:50:01 +09:30
478336ca68 feat(dovecot): log failed authentication attempts
Visibility is required for failed authentication attempts. Provides
an ability to use fail2ban and to fault find an end user auth issue.

MR !9
2022-02-19 08:49:06 +09:30
Jon
1581d45d89 Merge branch 'fix-dockerfile-syntax-error' into 'development'
fix(build): corrected syntax error in dockerfile

See merge request nofusscomputing/projects/docker-mail!8
2022-02-18 05:30:21 +00:00
Jon
db03fc2efa fix(build): corrected syntax error in dockerfile
MR !8
2022-02-18 05:25:59 +00:00
Jon
08d9a9efc1 Merge branch '1-lock-down' into 'development'
fix: lock down access to mail server

See merge request nofusscomputing/projects/docker-mail!7
2022-02-18 05:03:03 +00:00
3bca896c29 ci: Add dockerhub url to environment
MR !7
2022-02-18 14:25:56 +09:30
4554e9e66d feat(postfix): specify my_networks as localhost ONLY
mynetworks set to only be localhost as accepted/trusted.

MR !7
2022-02-18 14:16:28 +09:30
5f7095f274 fix(postfix): only use the servers order of tls ciphers
Don't allow a client to specify which TLS ciphers to use. They may
pick a less secure one.
MR !7
2022-02-18 14:08:38 +09:30
41e03936cc feat(postfix): no compression or renegotiation
Client should not attempt to rengotiation of TLS.
MAN states that compression during tls not nessacarly benificial.

MR !7
2022-02-18 13:49:39 +09:30
3120ecf2f5 fix(logrotate): ensure log rotate runs
Deleted the standard logrotate job from cron.daily and created
a new cron job to force run logrotate at `00:01`

MR !7
2022-02-18 13:46:27 +09:30
6625d72a48 fix(logrotate): don't specify log extension
MR !7
2022-02-18 13:42:00 +09:30
edadc4779e fix(dovecot): ensure quota syntax is correct
removed extra brace left from previous quota fix commit.

MR !7
2022-02-18 13:15:35 +09:30
f636c45681 test: add netstat to docker container for debugging
MR !7
2022-02-18 13:11:20 +09:30
b3d80b41ca fix(mailbox_quota): ensure user quota visible.
Mail quota was not visible in Thunderbird. bug was havinf two
`quota =` rules. adjusted to `quota2=` for shared quota to diplay,
however, had no effect in display shared quota.

Disabled shared in the meantime.

MR !7
2022-02-18 13:11:20 +09:30
4c37932bf7 feat(submission): check user quota recipient restriction
Check the users quota before accepting the mail for delivery.
If the user belongs to the server, the user wont send the message,
nor save it for it only to be rejected at a later stage.

Current rules and order as follows:
    1. reject_non_fqdn_recipient
        Require recipient to be in FQDN format so the message can
        be routed.
    2. reject_unknown_recipient_domain
        Prevent mail from being sent to a random location that can't
        be found.
    3. check_policy_service,unix:private/quota
        If the mail is for a local user and their mailbox is full, reject
        the mail.
        This allows the sender not to recieve a bounce message for
        a message that wasn't actually sent.
    4. permit_sasl_authenticated
        A user of the mail server can send E-Mail to anyone as long as
        it passes the filters above.
    5. reject
        Reject any further mail, as they clearly are not a user of the
        mail server.

MR !7
2022-02-18 13:11:20 +09:30
f90daea454 feat(postfix): enforce only reaying mail for auth destination
Mail server should only relay mail for domains and users it hosts. default is to reject.

Rules and order as follows:
    1. reject_non_fqdn_recipient
        Require the recipient to be in FQDN format for relaying
        and routing reasons including locating user.
    2. permit_auth_destination
        Only accept mail to be routed if authorized.
    3. reject
        Don't accept any further mail for relaying.

MR !7
2022-02-18 13:11:20 +09:30
1b168f07d5 feat(postfix): enforce SMTPD recipient restrictions
Filter mail based on recipient restrictions. default is to filter then
reject the remaining.

This is a default rule and submission requires it's own rule specified.

rules and order as follows:
    1. permit_mynetworks
        Allow local mail host to send to whomever.
    2. reject_non_fqdn_recipient
        must use a FQDN so that the recipient can be identified.
    3. reject_unknown_recipient_domain
        Only accept mail for the domains we host.
    4. reject_unauth_destination
        reject mail for domains we don't host and before any policy
        checks are done. This prevents additional processes from
        spawning that would otherwise be unused.
    5. check_policy_service,unix:private/policyd-spf
        bounce the mail that fails spf check. likely to be a non-smtp
        server.
    6. check_policy_service unix:private/quota
        Check the recipients quota before delivery. if fails, bounce
        the mail.
    7. permit_auth_destination
        Only accept mail for domains we host. This rule placed after
        the bounces, so that filtering can be done first.
    8. reject
        Hard reject as the recipient doesn't belong to this host.

MR !7
2022-02-18 12:09:20 +09:30
58f42a7913 feat(postfix): Enforce SMTPD sender restrictions
Default is to accept all mail from sender after filtering.

smtpd_sender_restrictions rules and order are as follows:
    1. permit_mynetworks
        permit my network (localhost). Placed first as sometimes the
        sender will not be a FQDN sender. (i.e. cron)
    2. reject_non_fqdn_sender
        bounce mail where sender not in format of FQDN.
    3. reject
        Reject all remaining senders

MR !7
2022-02-18 11:58:59 +09:30
8c68163e9d feat(postfix): introduce smtpd helo restrictions
Default is permit.
Rule order as follows:
    1. permit_mynetworks
        My network (localhost) is exempt from restriction
    2. reject_invalid_helo_hostname
        Don't allow a connection from an invalid host.
    3. permit
        Allow the remaining hosts not booted.

MR !7
2022-02-18 11:45:43 +09:30
64258f2cd8 feat(postfix): enforce smtpd client restrictions
Default is reject.
order of rules as follows:
    1. reject_unauth_destination
        if postfix doesn't own the destination, bounce
    2. reject_unauth_pipelining
        not punch through commands.
    3. permit_mynetworks,
        set as rule 3 after the above rejects, so that if a rouge
        process on the server attempts to send, it is blocked.
    4. permit_auth_destination,
        Only accept a connection if the mailserver is the destination.
    5. reject
        Reject all remaining mail as it's clearly not for this host.

MR !7
2022-02-18 11:42:32 +09:30
8f938bd3ce feat(quota_status): use a unix socket for postfix
There is no requirement to open an additional port so that postfix can
can check the dovecot quota.

The socket is created in postfix's service directory with dovecot as the
owner and vmail as the group. setting it this way enables ls command to
display who the owner is for debugging purposes.
Postfix is a member of group vmail.

MR !7
2022-02-18 11:35:06 +09:30
18944ab54d build(version): bump version 0.1.0rc0 → 0.1.0rc1 v0.1.0rc1 2022-02-17 04:05:00 +00:00
Jon
91d65302cb Merge branch '1-message-authenticity' into 'development'
feat: add dkim, spf and dmarc validation

See merge request nofusscomputing/projects/docker-mail!6
2022-02-17 03:57:25 +00:00
Jon
bde6c054bb refactor: conf config values updated
To fail a message for spf policy, `fail` is the value not false.

MR !6
2022-02-17 03:52:02 +00:00
a71e7691a2 docs(spf): added basic spf guide
MR !6
2022-02-17 13:16:52 +09:30
ac706ed28b test: mail hostname set to non-existent domain
Don't use a legigimate domain. as this is for testing only, set to null

MR !6
2022-02-17 12:38:04 +09:30
92e4e4b2d5 feat(amavis): added DKIM verification
DKIM varification added to amavis milter.

MR !6
2022-02-17 12:37:12 +09:30
245aa724d2 feat(spf): conduct spf check for inbound smtp
NOTE: currently a failed SPF check does not block the message.
currently set to add header for testing purposes.

MR !6
2022-02-17 12:13:41 +09:30
Jon
fb909c009a Merge branch '1-docker-hub-dev-push' into 'development'
ci(docker_hub): fix dev push

See merge request nofusscomputing/projects/docker-mail!5
2022-02-16 06:07:32 +00:00
27ad07ead3 ci(docker_hub): fix dev push
Wasn't using the right cariable to check for dev push and the
commands were in the wrong order.

MR !5
2022-02-16 15:34:18 +09:30