Commit Graph

116 Commits

Author SHA1 Message Date
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
Jon
e4e5078ba5 Merge branch '1-docker-hub-dev-push' into 'development'
fix: merge request to dev to create dev dockerhub tag

See merge request nofusscomputing/projects/docker-mail!4
2022-02-16 05:53:38 +00:00
be42d0ad3b docs: Addied initial documentation for dkim
Explains how to configure, generate keys and how to change keys.

MR !4
2022-02-16 15:14:54 +09:30
53e0cdd171 refactor(amavis): move dkim key config to own file
using a seperate file for the DKIM key configuration enables the user
to easily configure with their settings.

MR !4
2022-02-16 14:17:26 +09:30
f6cf41eaed test: adjust dkim key length
RFC6376  https://datatracker.ietf.org/doc/html/rfc6376#section-3.3.3
Specifies a key must be between 512 bits to 2048 bits.
However RSA Keys must be minimum of 1024 bits.

MR !4
2022-02-16 13:09:22 +09:30
aafd9acca9 ci(docker_hub): ensure build and DH push works on merge
fix the merge request dockerhub build.

var CI_COMMIT_BRANCH is not available in a merge request pipleine.
adjusted the pipline to run if development branch with a commit message
starting with Merge branch.
this enables usage of variable CI_COMMIT_BRANCH.

MR !4
2022-02-16 12:13:31 +09:30
Jon
bb44b67682 Merge branch '1-dkim-signing' into 'development'
feat: add dkim signing

See merge request nofusscomputing/projects/docker-mail!2
2022-02-16 02:23:29 +00:00
3e30b2780e refactor: ci code review suggestions
ensured the MR to dev would run for building the docker container.

MR !2
2022-02-16 11:46:54 +09:30
7f6de5ee2a build(dockerignore): added docker ignore file
Ignore all files and directories not applicable to the build.

MR !2
2022-02-16 11:34:29 +09:30
36808960ce ci(docker_hub): push a dev and latest tag to docker hub
When a git tag occurs, the image will also be tagged 'latest' and be
pushed to docker hub.

When a merge request occurs on the development branch, the image
will also be tagged 'dev' and be pushed to dockerhub.

MR !2
2022-02-16 11:20:57 +09:30
76c899e285 ci(docker_hub): removed duplicate rules section
There were two rules sections, combined both into a single section.

MR !2
2022-02-16 11:07:30 +09:30
b795fe5b67 feat(posfix): configure submission to dkim sign
All E-Mail submission (tcp/587) will be dkim signed if the domain is
matched in the amavis config '90-dkim'

MR !2
2022-02-16 10:42:31 +09:30
88ea42996d test(docker_compose): adjust ssl to be certs DIR
The directory was renamed from '/ssl' to '/certs'

MR !2
2022-02-16 10:37:41 +09:30
b9b2527a42 feat(amavis): Configured dkim
Default config is for domain example.org, which
is the testing domain.

User will be required to customise '90-dkim' with thier
own domain configuration, including generating dkim signing certificates.

MR !2
2022-02-16 10:36:47 +09:30
d8e51085a1 refactor(amavis): seperate config for socket
added the socket config to it's own file for clarity and to distinguish
a custom change from default.

MR !2
2022-02-16 10:34:23 +09:30
09aabeb68a refactor(ssl): Moved /ssl to /certs
As this directory not only contains the SSL Certs,
the dkim certs as well, renamed to make more sense.

MR !2
2022-02-16 10:29:21 +09:30
72ee475be7 feat(dkim): Added OpenDKIM to image
OpenDKIM is required to sign the emails.

MR !2
2022-02-16 10:26:50 +09:30
Jon
23830c8551 ci(docker_container): set to allow failure
The docker container does not need to be built as part
of the CI/CD process, as it's not used.

MR !2
2022-02-14 07:06:55 +00:00
5f8dea24d9 build(version): bump version 0.0.2 → 0.1.0rc0 v0.1.0rc0 2022-02-14 06:15:23 +00:00
Jon
7fc7c1ea13 Merge branch '1-initial-container' into 'development'
build: Initial mail server docker image

See merge request nofusscomputing/projects/docker-mail!1
2022-02-14 06:10:14 +00:00
Jon
99e61d0f11 ci(detached_pipeline): stop MR jobs
MR !1
2022-02-14 06:01:52 +00:00
6a61efe229 docs(README): updated readme
MR !1
2022-02-14 15:01:46 +09:30
f80c02ba15 ci(build): Added docker container build job
Builds the container and pushes to local gitlab registry

MR !1
2022-02-14 14:30:54 +09:30
b01bab033f refactor: readme linting errors
MR !1
2022-02-14 11:48:47 +09:30
b536a5e4b4 ci(gitlab-ci): updated to current dev commit
required that md lint works and that the correct nfc_bot details display.

MR !1
2022-02-14 11:41:01 +09:30
3a3f2098c7 feat(spam-learn): add duration to email
MR !1
2022-02-14 11:35:26 +09:30