Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ffe8bf6
Configure Postfix
quentinmit May 23, 2019
de4437e
Make /etc/scripts
quentinmit May 23, 2019
0c88576
Enable postfix
quentinmit May 23, 2019
579ff3c
Only accept mail on some VIPs
quentinmit May 23, 2019
cda3e5b
Install Postfix LDAP plugin
quentinmit May 23, 2019
7368b54
Use non-deprecated way to specify multiple packages
quentinmit May 23, 2019
f0f5272
Specify now-required smtpd_relay_restrictions
quentinmit May 23, 2019
f35bd7f
Configure Postfix with variable LDAP server
quentinmit May 24, 2019
05f8473
Reload postfix when config changes
quentinmit May 24, 2019
003949f
Install procmail
quentinmit May 25, 2019
53968ae
Install scripts's version of /etc/aliases
quentinmit May 29, 2019
e4eedf1
Delay postfix startup until network is online
quentinmit May 29, 2019
39ec12c
Create postfix unit override directory
quentinmit May 29, 2019
fa65200
Install and run Spamassassin
quentinmit May 29, 2019
c2a11ac
Configure spamass-milter
quentinmit May 29, 2019
a055fa1
Configure spamassassin
quentinmit May 29, 2019
fa72caa
Section null must be specified explicitly
quentinmit May 29, 2019
6c72056
Install prune-mailq
quentinmit Jun 24, 2019
e17d0e5
Generate postfix virtual_alias_domains from vips
quentinmit Jul 20, 2019
f532d23
Incoming mail blocks are now in LDAP
quentinmit Sep 5, 2019
c599ee6
authorized_submit_users is now in LDAP
quentinmit Sep 5, 2019
f7053d5
Install a bunch of packages from F20 on F30
quentinmit Dec 20, 2019
a7b99f9
Updating Postfix conf to forward messages to other server if current …
jkoppel Feb 1, 2020
ca1cf48
Only bind the VIPs for the current codename
quentinmit Feb 1, 2020
492fbb0
Adding transport-maps-ldap.cf to template list
jkoppel Feb 1, 2020
89eb801
Disable virtual_alias_maps for vhosts on another pool. Otherwise the …
quentinmit Feb 1, 2020
17af442
Make other pools into relay domains
quentinmit Feb 1, 2020
6d28907
cleanup checks virtual_alias_maps before both relay_domains and trans…
quentinmit Feb 1, 2020
8af2d41
Route mail for user@scripts.mit.edu based on user.scripts.mit.edu's pool
quentinmit Feb 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Configure Postfix
  • Loading branch information
quentinmit authored and dehnert committed Dec 11, 2020
commit ffe8bf61adb9ca181702e9a8a53b4252afce554c
28 changes: 28 additions & 0 deletions ansible/roles/real-postfix/files/postfix/blocked_users
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
raskar
maoting
bsu
delian
buechley
cssa
mitlti
paxters
crhie
baker-foundation
11.309j
kgsa
jains
unfolding
4.332
asme
alisono
laublab
eltahirgroup
early-warning
blackhistory
seek
braintrust
newmanlab
game
lebanon
crpg
scioly
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
server_host = ldapi://%2fvar%2frun%2fslapd-scripts.socket/
search_base = ou=People,dc=scripts,dc=mit,dc=edu
query_filter = (&(objectClass=posixAccount)(uid=%s))
result_attribute = scriptsMailboxCommand
bind = no
version = 3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
root /usr/bin/procmail /etc/scripts/root-procmailrc
2 changes: 2 additions & 0 deletions ansible/roles/real-postfix/files/postfix/mailq_users
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nrpe
munin
45 changes: 45 additions & 0 deletions ansible/roles/real-postfix/files/postfix/main.cf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#biff = no

# appending .domain is the MUA's job.
#append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = scripts.mit.edu
mydestination = scripts.mit.edu, scripts, $myhostname, scripts-test.mit.edu, scripts-test, localhost
relayhost =
mynetworks_style = host
mailbox_command_maps =
texthash:/etc/postfix/mailbox_command_maps,
ldap:/etc/postfix/mailbox-command-maps-ldap.cf
mailbox_size_limit = 0
message_size_limit = 41943040
recipient_delimiter = +
inet_interfaces = $myhostname, scripts.mit.edu, scripts-vhosts.mit.edu
readme_directory = /usr/share/doc/postfix/README_FILES
sample_directory = /usr/share/doc/postfix/samples
sendmail_path = /usr/sbin/sendmail
html_directory = no
setgid_group = postdrop
command_directory = /usr/sbin
manpage_directory = /usr/share/man
daemon_directory = /usr/libexec/postfix
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
queue_directory = /var/spool/postfix
mail_owner = postfix
virtual_alias_domains = !scripts.mit.edu, !scripts, !$myhostname, !scripts-test.mit.edu, !scripts-test, !localhost, scripts-vhosts.mit.edu, ldap:/etc/postfix/virtual-alias-domains-ldap.cf
virtual_alias_maps = ldap:/etc/postfix/virtual-alias-maps-ldap-reserved.cf, ldap:/etc/postfix/virtual-alias-maps-ldap.cf
data_directory = /var/lib/postfix
authorized_flush_users = fail
authorized_mailq_users = /etc/postfix/mailq_users
authorized_submit_users = !/etc/postfix/blocked_users, static:all
non_smtpd_milters = unix:/run/spamass-milter/postfix/sock
# "all" is the default, but if we do not specify it, Fedora's packaging
# will add the wrong value here.
inet_protocols = all
# note: as of 21 Oct 2015, our IPv6 addresses do not have rDNS and are rejected by Gmail
smtp_address_preference = ipv4
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Find any vhost with a name or alias matching the domain of the e-mail
# address. We're queried with only the domain portion to determine whether
# we accept mail at all for a given domain. If we have no matching vhost
# and return no records, Postfix will reject mail with a "Relay access denied"
# error, unless the domain is configured in $mydestination. We don't match
# the scripts.mit.edu vhost here because otherwise it'll be treated as a
# virtual alias domain and once we resolve an address to a scripts account,
# we'll end up resolving the locker@scripts.mit.edu address to go to the
# owners of the scripts.mit.edu vhost. The value we return (if we return
# anything at all) is supposedly arbitrary. We choose to return the same
# value we were queried with (the domain whose mail we host). Protocol
# version 3 is necessary to use ldapi.

server_host = ldapi://%2fvar%2frun%2fslapd-scripts.socket/
search_base = ou=VirtualHosts,dc=scripts,dc=mit,dc=edu
query_filter = (&(objectClass=scriptsVhost)(|(scriptsVhostName=%s)(scriptsVhostAlias=%s))(!(scriptsVhostName=scripts.mit.edu)))
result_attribute = scriptsVhostName
result_format = %S
bind = no
version = 3

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
server_host = ldapi://%2fvar%2frun%2fslapd-scripts.socket/
search_base = ou=VirtualHosts,dc=scripts,dc=mit,dc=edu
query_filter = (&(objectClass=scriptsVhost)(|(scriptsVhostName=%d)(scriptsVhostAlias=%d))(!(scriptsVhostName=scripts.mit.edu))(scriptsReservedMail=%u))
result_attribute = scriptsVhostName
result_format = %U
bind = no
version = 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Find any vhost with a name or alias matching the domain of the
# e-mail address. We're queried with an entire e-mail address, but
# are only interested in checking whether the domain portion
# corresponds to a vhost; we'll simply deliver any mail for the vhost
# to its owner, appending the original lefthand side of the address as
# an extension. %d extracts only the domain. We don't match the
# scripts.mit.edu vhost here because we don't want to first resolve an
# arbitrary address to a scripts account, and then end up sending
# their mail to the owners of the scripts.mit.edu vhost. The uid
# attribute, generated by the CoS template
# cn=vhostOwnerCoS,ou=VirtualHosts,dc=scripts,dc=mit,dc=edu, is the
# name of the locker that owns the vhost. Protocol version 3 is
# necessary to use ldapi.

server_host = ldapi://%2fvar%2frun%2fslapd-scripts.socket/
search_base = ou=VirtualHosts,dc=scripts,dc=mit,dc=edu
query_filter = (&(objectClass=scriptsVhost)(|(scriptsVhostName=%d)(scriptsVhostAlias=%d))(!(scriptsVhostName=scripts.mit.edu)))
result_attribute = uid
result_format = %s+%U
bind = no
version = 3

2 changes: 2 additions & 0 deletions ansible/roles/real-postfix/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: reload postfix
service: name=postfix state=reloaded
13 changes: 13 additions & 0 deletions ansible/roles/real-postfix/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
- name: Install postfix
dnf: name=postfix state=present
- name: Install postfix configuration files
copy:
src: postfix/
dest: /etc/postfix/
notify: reload postfix
- name: Install root's procmailrc
template:
src: root-procmailrc.j2
dest: /etc/scripts/root-procmailrc
# TODO: Move blocked users from /etc/aliases into LDAP as scriptsMailboxCommand: /bin/false
4 changes: 4 additions & 0 deletions ansible/roles/real-postfix/templates/root-procmailrc.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:0
! {% for maintainer in maintainers|rejectattr('root_mail', 'none') -%}
Comment thread
dehnert marked this conversation as resolved.
{{ maintainer.root_mail|default(maintainer.username + '@mit.edu') }}{{ '' if loop.last else ', ' }}
{%- endfor %}