Skip to content

Commit 16e1e56

Browse files
committed
Add mail
1 parent 6217d67 commit 16e1e56

File tree

13 files changed

+495
-0
lines changed

13 files changed

+495
-0
lines changed

argocd/applications/mail.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: mail
5+
spec:
6+
project: default
7+
source:
8+
repoURL: [email protected]:hashbang/gitops.git
9+
path: mail/
10+
targetRevision: HEAD
11+
destination:
12+
server: https://kubernetes.default.svc
13+
namespace: mail

argocd/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ resources:
1818
- applications/external-dns.yaml
1919
- applications/ingress-nginx.yaml
2020
- applications/ircd.yaml
21+
- applications/mail.yaml
2122
- applications/monitoring.yaml
2223
- applications/userdb-api.yaml
2324
- applications/webirc.yaml

cert-manager-issuers/prod_issuer.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ spec:
1515
- selector:
1616
dnsZones:
1717
- "irc.hashbang.sh"
18+
- "mail.hashbang.sh"
1819
dns01:
1920
route53:
2021
region: us-west-2

mail/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Mail
2+
3+
https://github.com/hashbang/docker-postfix
4+
5+
Delivers mail to the shell servers

mail/certificate.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: cert-manager.io/v1alpha2
2+
kind: Certificate
3+
metadata:
4+
namespace: mail
5+
name: mail.hashbang.sh
6+
spec:
7+
secretName: mail-certs
8+
dnsNames:
9+
- mail.hashbang.sh
10+
issuerRef:
11+
name: letsencrypt-prod
12+
kind: ClusterIssuer

mail/files/main.cf

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
2+
biff = no
3+
4+
# appending .domain is the MUA's job.
5+
append_dot_mydomain = no
6+
7+
# Uncomment the next line to generate "delayed mail" warnings
8+
#delay_warning_time = 4h
9+
10+
readme_directory = no
11+
12+
# TLS parameters
13+
smtpd_tls_cert_file = /etc/postfix/certs/tls.crt
14+
smtpd_tls_key_file = /etc/postfix/certs/tls.key
15+
smtpd_use_tls=yes
16+
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
17+
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
18+
# smtpd_tls_CAfile = /etc/postfix/certs/cacert.pem
19+
smtpd_tls_security_level = may
20+
smtpd_tls_auth_only = no
21+
smtpd_tls_loglevel = 1
22+
smtpd_tls_received_header = yes
23+
smtpd_tls_session_cache_timeout = 3600s
24+
smtp_tls_security_level = dane
25+
smtp_tls_note_starttls_offer = yes
26+
smtp_dns_support_level = dnssec
27+
28+
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
29+
# information on enabling SSL in the smtp client.
30+
31+
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
32+
33+
myhostname = mail.hashbang.sh
34+
relay_domains = hashbang.sh
35+
mydestination = mail.hashbang.sh, hashbang.sh, localhost.hashbang.sh, localhost
36+
mynetworks = 127.0.0.0/8 46.4.114.111
37+
relayhost =
38+
alias_maps = hash:/etc/aliases
39+
alias_database = hash:/etc/aliases
40+
myorigin = $mydomain
41+
mailbox_size_limit = 0
42+
recipient_delimiter = +
43+
inet_interfaces = all
44+
45+
virtual_alias_maps = pgsql:/etc/postfix/userdb-aliases.cf
46+
47+
message_size_limit = 52428800
48+
49+
compatibility_level = 2
50+
51+
# Support PROXY from load balancer
52+
postscreen_upstream_proxy_protocol = haproxy

mail/files/master.cf

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
#
2+
# Postfix master process configuration file. For details on the format
3+
# of the file, see the master(5) manual page (command: "man 5 master" or
4+
# on-line: http://www.postfix.org/master.5.html).
5+
#
6+
# Do not forget to execute "postfix reload" after editing this file.
7+
#
8+
# ==========================================================================
9+
# service type private unpriv chroot wakeup maxproc command + args
10+
# (yes) (yes) (no) (never) (100)
11+
# ==========================================================================
12+
smtp inet n - y - 1 postscreen
13+
smtpd pass - - y - - smtpd
14+
#dnsblog unix - - y - 0 dnsblog
15+
#tlsproxy unix - - y - 0 tlsproxy
16+
#submission inet n - y - - smtpd
17+
# -o syslog_name=postfix/submission
18+
# -o smtpd_tls_security_level=encrypt
19+
# -o smtpd_sasl_auth_enable=yes
20+
# -o smtpd_tls_auth_only=yes
21+
# -o smtpd_reject_unlisted_recipient=no
22+
# -o smtpd_client_restrictions=$mua_client_restrictions
23+
# -o smtpd_helo_restrictions=$mua_helo_restrictions
24+
# -o smtpd_sender_restrictions=$mua_sender_restrictions
25+
# -o smtpd_recipient_restrictions=
26+
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
27+
# -o milter_macro_daemon_name=ORIGINATING
28+
#smtps inet n - y - - smtpd
29+
# -o syslog_name=postfix/smtps
30+
# -o smtpd_tls_wrappermode=yes
31+
# -o smtpd_sasl_auth_enable=yes
32+
# -o smtpd_reject_unlisted_recipient=no
33+
# -o smtpd_client_restrictions=$mua_client_restrictions
34+
# -o smtpd_helo_restrictions=$mua_helo_restrictions
35+
# -o smtpd_sender_restrictions=$mua_sender_restrictions
36+
# -o smtpd_recipient_restrictions=
37+
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
38+
# -o milter_macro_daemon_name=ORIGINATING
39+
#628 inet n - y - - qmqpd
40+
pickup unix n - y 60 1 pickup
41+
cleanup unix n - y - 0 cleanup
42+
qmgr unix n - n 300 1 qmgr
43+
#qmgr unix n - n 300 1 oqmgr
44+
tlsmgr unix - - y 1000? 1 tlsmgr
45+
rewrite unix - - y - - trivial-rewrite
46+
bounce unix - - y - 0 bounce
47+
defer unix - - y - 0 bounce
48+
trace unix - - y - 0 bounce
49+
verify unix - - y - 1 verify
50+
flush unix n - y 1000? 0 flush
51+
proxymap unix - - n - - proxymap
52+
proxywrite unix - - n - 1 proxymap
53+
smtp unix - - y - - smtp
54+
relay unix - - y - - smtp
55+
-o syslog_name=postfix/$service_name
56+
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
57+
showq unix n - y - - showq
58+
error unix - - y - - error
59+
retry unix - - y - - error
60+
discard unix - - y - - discard
61+
local unix - n n - - local
62+
virtual unix - n n - - virtual
63+
lmtp unix - - y - - lmtp
64+
anvil unix - - y - 1 anvil
65+
scache unix - - y - 1 scache
66+
postlog unix-dgram n - n - 1 postlogd
67+
#
68+
# ====================================================================
69+
# Interfaces to non-Postfix software. Be sure to examine the manual
70+
# pages of the non-Postfix software to find out what options it wants.
71+
#
72+
# Many of the following services use the Postfix pipe(8) delivery
73+
# agent. See the pipe(8) man page for information about ${recipient}
74+
# and other message envelope options.
75+
# ====================================================================
76+
#
77+
# maildrop. See the Postfix MAILDROP_README file for details.
78+
# Also specify in main.cf: maildrop_destination_recipient_limit=1
79+
#
80+
maildrop unix - n n - - pipe
81+
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
82+
#
83+
# ====================================================================
84+
#
85+
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
86+
#
87+
# Specify in cyrus.conf:
88+
# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
89+
#
90+
# Specify in main.cf one or more of the following:
91+
# mailbox_transport = lmtp:inet:localhost
92+
# virtual_transport = lmtp:inet:localhost
93+
#
94+
# ====================================================================
95+
#
96+
# Cyrus 2.1.5 (Amos Gouaux)
97+
# Also specify in main.cf: cyrus_destination_recipient_limit=1
98+
#
99+
#cyrus unix - n n - - pipe
100+
# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
101+
#
102+
# ====================================================================
103+
# Old example of delivery via Cyrus.
104+
#
105+
#old-cyrus unix - n n - - pipe
106+
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
107+
#
108+
# ====================================================================
109+
#
110+
# See the Postfix UUCP_README file for configuration details.
111+
#
112+
uucp unix - n n - - pipe
113+
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
114+
#
115+
# Other external delivery methods.
116+
#
117+
ifmail unix - n n - - pipe
118+
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
119+
bsmtp unix - n n - - pipe
120+
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
121+
scalemail-backend unix - n n - 2 pipe
122+
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
123+
mailman unix - n n - - pipe
124+
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
125+
${nexthop} ${user}

mail/files/userdb-aliases.cf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
domain = hashbang.sh
2+
hosts = postgresql://mail:[email protected]:25060/userdb?sslmode=require
3+
dbname = userdb
4+
query = select name || '@' || host from passwd where name = '%u'

mail/kustomization.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
namespace: mail
4+
resources:
5+
- namespace.yaml
6+
- resources.yaml
7+
- certificate.yaml
8+
configMapGenerator:
9+
- name: mail-config
10+
files:
11+
- files/main.cf
12+
- files/master.cf
13+
- files/userdb-aliases.cf
14+
generators:
15+
- secret-generator.yaml
16+
images:
17+
- name: hashbang/postfix
18+
digest: sha256:1c9491593e383b95cde6c75a82abcfe2e12e4a26b1656abeaac0bf1f8209b9ee
19+
- name: alpine
20+
newTag: alpine:3.12.0
21+
digest: sha256:a15790640a6690aa1730c38cf0a440e2aa44aaca9b0e8931a9f2b0d7cc90fd65

mail/namespace.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: mail

0 commit comments

Comments
 (0)