Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6bc79dd09c | |||
| 53af06c974 |
@@ -4,6 +4,7 @@ certbot::client::webserver: ausyd1nxvm2057.main.unkin.net
|
|||||||
profiles_dns_upstream_forwarder_unkin:
|
profiles_dns_upstream_forwarder_unkin:
|
||||||
- 198.18.200.7
|
- 198.18.200.7
|
||||||
profiles_dns_upstream_forwarder_consul:
|
profiles_dns_upstream_forwarder_consul:
|
||||||
|
- 198.18.200.5
|
||||||
- 198.18.19.14
|
- 198.18.19.14
|
||||||
profiles_dns_upstream_forwarder_k8s:
|
profiles_dns_upstream_forwarder_k8s:
|
||||||
- 198.18.19.20
|
- 198.18.19.20
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
---
|
|
||||||
profiles::postfix::gateway::myhostname: 'mta2.edge.unkin.net'
|
|
||||||
profiles::pki::vault::alt_names:
|
|
||||||
- mta2.edge.unkin.net
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
---
|
|
||||||
profiles::postfix::gateway::myhostname: 'mta1.edge.unkin.net'
|
|
||||||
profiles::pki::vault::alt_names:
|
|
||||||
- mta1.edge.unkin.net
|
|
||||||
@@ -147,18 +147,6 @@ profiles::yum::global::repos:
|
|||||||
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/postgresql/common/redhat/rhel-%{facts.os.release.major}-%{facts.os.architecture}
|
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/postgresql/common/redhat/rhel-%{facts.os.release.major}-%{facts.os.architecture}
|
||||||
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/postgresql/keys/PGDG-RPM-GPG-KEY-RHEL
|
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/postgresql/keys/PGDG-RPM-GPG-KEY-RHEL
|
||||||
|
|
||||||
# Rspamd repositories
|
|
||||||
rspamd:
|
|
||||||
ensure: absent
|
|
||||||
name: rspamd
|
|
||||||
descr: rspamd repository
|
|
||||||
target: /etc/yum.repos.d/rspamd.repo
|
|
||||||
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/rspamd/rpm-stable/centos-%{facts.os.release.major}/x86_64
|
|
||||||
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/rspamd/rpm/rspamd.asc
|
|
||||||
gpgcheck: 1
|
|
||||||
repo_gpgcheck: 1
|
|
||||||
mirrorlist: absent
|
|
||||||
|
|
||||||
# Ceph repositories
|
# Ceph repositories
|
||||||
ceph:
|
ceph:
|
||||||
ensure: absent
|
ensure: absent
|
||||||
|
|||||||
@@ -1,74 +1,25 @@
|
|||||||
---
|
---
|
||||||
hiera_include:
|
|
||||||
- redis
|
|
||||||
|
|
||||||
profiles::yum::global::repos:
|
# additional altnames
|
||||||
rspamd:
|
profiles::pki::vault::alt_names:
|
||||||
ensure: present
|
- in-mta.main.unkin.net
|
||||||
|
|
||||||
# local redis for rspamd bayes and history; bayes tokens carry a ttl so volatile-ttl can evict
|
|
||||||
redis::maxmemory: '128mb'
|
|
||||||
redis::maxmemory_policy: 'volatile-ttl'
|
|
||||||
|
|
||||||
# local rspamd, deterministic checks only; module defaults cover spf/dkim/dmarc/arc/rbl/phishing/mime_types/fuzzy_check
|
|
||||||
profiles::rspamd::edge::rules:
|
|
||||||
edge.cf: 'https://git.unkin.net/unkin/rspamd-rules/raw/branch/main/edge.cf'
|
|
||||||
profiles::rspamd::edge::local_d:
|
|
||||||
worker-proxy.inc: |
|
|
||||||
bind_socket = "127.0.0.1:11332";
|
|
||||||
milter = yes;
|
|
||||||
timeout = 120s;
|
|
||||||
count = 1;
|
|
||||||
upstream "local" {
|
|
||||||
default = yes;
|
|
||||||
self_scan = yes;
|
|
||||||
}
|
|
||||||
worker-normal.inc: |
|
|
||||||
enabled = false;
|
|
||||||
redis.conf: |
|
|
||||||
servers = "127.0.0.1:6379";
|
|
||||||
actions.conf: |
|
|
||||||
reject = 13;
|
|
||||||
add_header = 6;
|
|
||||||
rewrite_subject = null;
|
|
||||||
greylist = null;
|
|
||||||
greylist.conf: |
|
|
||||||
enabled = false;
|
|
||||||
gpt.conf: |
|
|
||||||
enabled = false;
|
|
||||||
classifier-bayes.conf: |
|
|
||||||
backend = "redis";
|
|
||||||
expire = 8640000;
|
|
||||||
autolearn {
|
|
||||||
spam_threshold = 6.0;
|
|
||||||
ham_threshold = -0.5;
|
|
||||||
check_balance = true;
|
|
||||||
}
|
|
||||||
spamassassin.conf: |
|
|
||||||
ruleset = "/etc/rspamd/rules/*.cf";
|
|
||||||
alpha = 0.1;
|
|
||||||
settings.conf: |
|
|
||||||
smarthost_outbound {
|
|
||||||
priority = high;
|
|
||||||
ip = "103.216.191.185";
|
|
||||||
want_spam = yes;
|
|
||||||
}
|
|
||||||
|
|
||||||
# base postfix configuration (passed to postfix class)
|
# base postfix configuration (passed to postfix class)
|
||||||
postfix::relayhost: 'direct'
|
postfix::relayhost: 'direct'
|
||||||
postfix::myorigin: 'unkin.net'
|
postfix::myorigin: 'main.unkin.net'
|
||||||
postfix::mydestination: 'blank'
|
postfix::mydestination: 'blank'
|
||||||
postfix::mynetworks: '127.0.0.0/8 [::1]/128 103.216.191.185/32'
|
postfix::mynetworks: '127.0.0.0/8 [::1]/128'
|
||||||
postfix::mta: true
|
postfix::mta: true
|
||||||
postfix::manage_aliases: true
|
postfix::manage_aliases: true
|
||||||
|
|
||||||
|
# profile parameters for customization
|
||||||
|
profiles::postfix::gateway::myhostname: 'in-mta.main.unkin.net'
|
||||||
|
|
||||||
# postfix map content (templates)
|
# postfix map content (templates)
|
||||||
profiles::postfix::gateway::relay_recipients_maps:
|
profiles::postfix::gateway::relay_recipients_maps:
|
||||||
'@unkin.net': 'OK'
|
|
||||||
'@main.unkin.net': 'OK'
|
'@main.unkin.net': 'OK'
|
||||||
|
|
||||||
profiles::postfix::gateway::relay_domains_maps:
|
profiles::postfix::gateway::relay_domains_maps:
|
||||||
'unkin.net': 'OK'
|
|
||||||
'main.unkin.net': 'OK'
|
'main.unkin.net': 'OK'
|
||||||
|
|
||||||
profiles::postfix::gateway::postscreen_access_maps:
|
profiles::postfix::gateway::postscreen_access_maps:
|
||||||
@@ -81,28 +32,21 @@ profiles::postfix::gateway::helo_access_maps:
|
|||||||
'unknown': 'REJECT'
|
'unknown': 'REJECT'
|
||||||
'localhost': 'REJECT You are not localhost'
|
'localhost': 'REJECT You are not localhost'
|
||||||
|
|
||||||
profiles::postfix::gateway::smtp_tls_policy_maps:
|
|
||||||
'[mail-in.main.unkin.net]:25': 'secure match=hostname'
|
|
||||||
|
|
||||||
# postfix transports
|
# postfix transports
|
||||||
postfix::transports:
|
postfix::transports:
|
||||||
'unkin.net':
|
|
||||||
ensure: present
|
|
||||||
destination: 'relay'
|
|
||||||
nexthop: '[mail-in.main.unkin.net]:25'
|
|
||||||
'main.unkin.net':
|
'main.unkin.net':
|
||||||
ensure: present
|
ensure: present
|
||||||
destination: 'relay'
|
destination: 'relay'
|
||||||
nexthop: '[mail-in.main.unkin.net]:25'
|
nexthop: 'mail-in.main.unkin.net:25'
|
||||||
|
|
||||||
# postfix virtuals
|
# postfix virtuals
|
||||||
postfix::virtuals:
|
postfix::virtuals:
|
||||||
'root':
|
'root':
|
||||||
ensure: present
|
ensure: present
|
||||||
destination: 'ben@unkin.net'
|
destination: 'ben@main.unkin.net'
|
||||||
'postmaster':
|
'postmaster':
|
||||||
ensure: present
|
ensure: present
|
||||||
destination: 'ben@unkin.net'
|
destination: 'ben@main.unkin.net'
|
||||||
'abuse':
|
'abuse':
|
||||||
ensure: present
|
ensure: present
|
||||||
destination: 'ben@unkin.net'
|
destination: 'ben@main.unkin.net'
|
||||||
|
|||||||
@@ -22,45 +22,27 @@ class SubnetAttributes
|
|||||||
'198.18.26.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # common node0010
|
'198.18.26.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # common node0010
|
||||||
'198.18.27.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # common node0011
|
'198.18.27.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # common node0011
|
||||||
'198.18.28.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # common node0012
|
'198.18.28.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # common node0012
|
||||||
'198.18.29.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # common node0013
|
'198.18.29.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' } # common node0013
|
||||||
'198.18.30.0/24' => { environment: 'prod', region: 'syd2', country: 'au', zone: 'dmz' }, # binarylane syd dmz vpc
|
|
||||||
'198.18.31.0/24' => { environment: 'prod', region: 'mel1', country: 'au', zone: 'dmz' } # binarylane mel dmz vpc
|
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
# Default attributes if no subnet matches, also defined as a constant
|
# Default attributes if no subnet matches, also defined as a constant
|
||||||
DEFAULT_ATTRIBUTES = { environment: 'unknown', region: 'unknown', country: 'unknown' }.freeze
|
DEFAULT_ATTRIBUTES = { environment: 'unknown', region: 'unknown', country: 'unknown' }.freeze
|
||||||
|
|
||||||
# loopbacks and wg /31s sit in syd1 ranges, so they must not decide where a host lives
|
# provide ip to return attributes
|
||||||
SKIPPED_INTERFACES = /\A(lo\z|dum|wg)/.freeze
|
def self.attributes(ip)
|
||||||
|
|
||||||
# primary ip first, then the remaining interfaces in name order
|
|
||||||
def self.from_networking(networking)
|
|
||||||
match(networking['ip']) || interface_match(networking['interfaces'] || {}) || DEFAULT_ATTRIBUTES
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.interface_match(interfaces)
|
|
||||||
interfaces.sort
|
|
||||||
.reject { |name, _interface| name.match?(SKIPPED_INTERFACES) }
|
|
||||||
.flat_map { |_name, interface| addresses(interface) }
|
|
||||||
.lazy.filter_map { |address| match(address) }.first
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.addresses(interface)
|
|
||||||
(interface['bindings'] || []).map { |binding| binding['address'] }
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.match(ip)
|
|
||||||
return unless ip
|
|
||||||
|
|
||||||
addr = IPAddr.new(ip)
|
|
||||||
SUBNET_TO_ATTRIBUTES.each do |subnet, attrs|
|
SUBNET_TO_ATTRIBUTES.each do |subnet, attrs|
|
||||||
return attrs if IPAddr.new(subnet).include?(addr)
|
return attrs if IPAddr.new(subnet).include?(IPAddr.new(ip))
|
||||||
end
|
end
|
||||||
nil
|
|
||||||
|
DEFAULT_ATTRIBUTES
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
subnet_attributes = SubnetAttributes.from_networking(Facter.value(:networking))
|
# Use the primary IP address from facts
|
||||||
|
ip = Facter.value(:networking)['ip']
|
||||||
|
|
||||||
|
# Call the class method directly without creating an instance
|
||||||
|
subnet_attributes = SubnetAttributes.attributes(ip)
|
||||||
|
|
||||||
# Add separate facts for environment, region, and country
|
# Add separate facts for environment, region, and country
|
||||||
Facter.add('environment') { setcode { subnet_attributes[:environment] } }
|
Facter.add('environment') { setcode { subnet_attributes[:environment] } }
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
# ruby modules/libs/test/subnet_facts_check.rb
|
|
||||||
module Facter
|
|
||||||
def self.value(_name)
|
|
||||||
{}
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.add(*); end
|
|
||||||
end
|
|
||||||
load File.expand_path('../lib/facter/subnet_facts.rb', __dir__)
|
|
||||||
|
|
||||||
iface = ->(*addresses) { { 'bindings' => addresses.map { |address| { 'address' => address } } } }
|
|
||||||
|
|
||||||
checks = {
|
|
||||||
'primary ip wins over other interfaces' => [
|
|
||||||
{ 'ip' => '198.18.17.5', 'interfaces' => { 'eth1' => iface.call('198.18.13.5') } }, 'drw1'
|
|
||||||
],
|
|
||||||
'unmatched primary ip falls back to an interface' => [
|
|
||||||
{ 'ip' => '203.0.113.5', 'interfaces' => { 'eth0' => iface.call('203.0.113.5'), 'eth1' => iface.call('198.18.24.11') } }, 'syd1'
|
|
||||||
],
|
|
||||||
'lo, dum and wg interfaces are skipped' => [
|
|
||||||
{ 'ip' => '203.0.113.5',
|
|
||||||
'interfaces' => { 'dum0' => iface.call('198.18.2.161'), 'lo' => iface.call('198.18.19.1'),
|
|
||||||
'wg0' => iface.call('198.18.2.177') } }, 'unknown'
|
|
||||||
],
|
|
||||||
'interfaces are scanned in name order' => [
|
|
||||||
{ 'ip' => '203.0.113.5', 'interfaces' => { 'eth2' => iface.call('198.18.24.1'), 'eth1' => iface.call('198.18.17.1') } }, 'drw1'
|
|
||||||
],
|
|
||||||
'missing ip and interfaces resolve to unknown' => [{}, 'unknown']
|
|
||||||
}
|
|
||||||
|
|
||||||
failures = checks.reject { |_name, (networking, expected)| SubnetAttributes.from_networking(networking)[:region] == expected }
|
|
||||||
failures.each_key { |name| warn "FAIL: #{name}" }
|
|
||||||
abort if failures.any?
|
|
||||||
puts "ok (#{checks.size} checks)"
|
|
||||||
@@ -3,7 +3,8 @@ class profiles::postfix::gateway (
|
|||||||
Stdlib::Absolutepath $tls_key_file = '/etc/pki/tls/vault/certificate.pem',
|
Stdlib::Absolutepath $tls_key_file = '/etc/pki/tls/vault/certificate.pem',
|
||||||
Stdlib::Absolutepath $tls_ca_file = '/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem',
|
Stdlib::Absolutepath $tls_ca_file = '/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem',
|
||||||
String $myhostname = $trusted['certname'],
|
String $myhostname = $trusted['certname'],
|
||||||
String $message_size_limit = '52428800',
|
String $message_size_limit = '133169152',
|
||||||
|
String $mailbox_size_limit = '133169152',
|
||||||
String $local_transport = 'error:No local mail delivery',
|
String $local_transport = 'error:No local mail delivery',
|
||||||
Boolean $enable_postscreen = true,
|
Boolean $enable_postscreen = true,
|
||||||
Array[String] $alias_maps = [
|
Array[String] $alias_maps = [
|
||||||
@@ -11,12 +12,12 @@ class profiles::postfix::gateway (
|
|||||||
'hash:/etc/postfix/aliases',
|
'hash:/etc/postfix/aliases',
|
||||||
],
|
],
|
||||||
Array[String] $postscreen_dnsbl_sites = [
|
Array[String] $postscreen_dnsbl_sites = [
|
||||||
'zen.spamhaus.org=127.0.0.[2..11]*3',
|
'zen.spamhaus.org*3',
|
||||||
'b.barracudacentral.org=127.0.0.2*2',
|
'b.barracudacentral.org=127.0.0.[2..11]*2',
|
||||||
'bl.mailspike.net=127.0.0.2*1',
|
'bl.spameatingmonkey.net*2',
|
||||||
'psbl.surriel.com=127.0.0.2*1',
|
'bl.spamcop.net',
|
||||||
'bl.spameatingmonkey.net=127.0.0.2*2',
|
'dnsbl.sorbs.net',
|
||||||
'bl.spamcop.net=127.0.0.2',
|
'swl.spamhaus.org*-4',
|
||||||
'list.dnswl.org=127.[0..255].[0..255].0*-2',
|
'list.dnswl.org=127.[0..255].[0..255].0*-2',
|
||||||
'list.dnswl.org=127.[0..255].[0..255].1*-4',
|
'list.dnswl.org=127.[0..255].[0..255].1*-4',
|
||||||
'list.dnswl.org=127.[0..255].[0..255].[2..3]*-6',
|
'list.dnswl.org=127.[0..255].[0..255].[2..3]*-6',
|
||||||
@@ -24,6 +25,7 @@ class profiles::postfix::gateway (
|
|||||||
Array[String] $smtpd_client_restrictions = [
|
Array[String] $smtpd_client_restrictions = [
|
||||||
'permit_sasl_authenticated',
|
'permit_sasl_authenticated',
|
||||||
'permit_mynetworks',
|
'permit_mynetworks',
|
||||||
|
'reject_rbl_client zen.spamhaus.org',
|
||||||
],
|
],
|
||||||
Array[String] $smtpd_sender_restrictions = [
|
Array[String] $smtpd_sender_restrictions = [
|
||||||
'permit_sasl_authenticated',
|
'permit_sasl_authenticated',
|
||||||
@@ -45,7 +47,6 @@ class profiles::postfix::gateway (
|
|||||||
'permit_mynetworks',
|
'permit_mynetworks',
|
||||||
'reject_unauth_destination',
|
'reject_unauth_destination',
|
||||||
],
|
],
|
||||||
String $smtpd_milters = 'inet:127.0.0.1:11332',
|
|
||||||
Hash[String, String] $smtp_tls_policy_maps = {},
|
Hash[String, String] $smtp_tls_policy_maps = {},
|
||||||
Hash[String, String] $sender_canonical_maps = {},
|
Hash[String, String] $sender_canonical_maps = {},
|
||||||
Hash[String, String] $sender_access_maps = {},
|
Hash[String, String] $sender_access_maps = {},
|
||||||
@@ -72,7 +73,7 @@ class profiles::postfix::gateway (
|
|||||||
'value' => 'permit_mynetworks, cidr:/etc/postfix/postscreen_access'
|
'value' => 'permit_mynetworks, cidr:/etc/postfix/postscreen_access'
|
||||||
},
|
},
|
||||||
'postscreen_blacklist_action' => {
|
'postscreen_blacklist_action' => {
|
||||||
'value' => 'drop'
|
'value' => 'enforce'
|
||||||
},
|
},
|
||||||
'postscreen_cache_map' => {
|
'postscreen_cache_map' => {
|
||||||
'value' => 'btree:$data_directory/postscreen_cache'
|
'value' => 'btree:$data_directory/postscreen_cache'
|
||||||
@@ -86,10 +87,6 @@ class profiles::postfix::gateway (
|
|||||||
'postscreen_dnsbl_threshold' => {
|
'postscreen_dnsbl_threshold' => {
|
||||||
'value' => '2'
|
'value' => '2'
|
||||||
},
|
},
|
||||||
# dnswl-listed clients (net score <= -1) skip the slow greet tests; el9 postfix 3.5 predates the allowlist rename
|
|
||||||
'postscreen_dnsbl_whitelist_threshold' => {
|
|
||||||
'value' => '-1'
|
|
||||||
},
|
|
||||||
'postscreen_greet_action' => {
|
'postscreen_greet_action' => {
|
||||||
'value' => 'enforce'
|
'value' => 'enforce'
|
||||||
},
|
},
|
||||||
@@ -111,6 +108,9 @@ class profiles::postfix::gateway (
|
|||||||
'alias_database' => {
|
'alias_database' => {
|
||||||
'value' => $alias_maps_string
|
'value' => $alias_maps_string
|
||||||
},
|
},
|
||||||
|
'default_destination_recipient_limit' => {
|
||||||
|
'value' => '1'
|
||||||
|
},
|
||||||
'disable_vrfy_command' => {
|
'disable_vrfy_command' => {
|
||||||
'value' => 'yes'
|
'value' => 'yes'
|
||||||
},
|
},
|
||||||
@@ -129,6 +129,9 @@ class profiles::postfix::gateway (
|
|||||||
'local_transport' => {
|
'local_transport' => {
|
||||||
'value' => $local_transport
|
'value' => $local_transport
|
||||||
},
|
},
|
||||||
|
'mailbox_size_limit' => {
|
||||||
|
'value' => $mailbox_size_limit
|
||||||
|
},
|
||||||
'message_size_limit' => {
|
'message_size_limit' => {
|
||||||
'value' => $message_size_limit
|
'value' => $message_size_limit
|
||||||
},
|
},
|
||||||
@@ -138,20 +141,8 @@ class profiles::postfix::gateway (
|
|||||||
'non_smtpd_milters' => {
|
'non_smtpd_milters' => {
|
||||||
'ensure' => 'blank'
|
'ensure' => 'blank'
|
||||||
},
|
},
|
||||||
'milter_connect_timeout' => {
|
'qmqpd_authorized_clients' => {
|
||||||
'value' => '10s'
|
'value' => '127.0.0.1 [::1]'
|
||||||
},
|
|
||||||
'milter_content_timeout' => {
|
|
||||||
'value' => '60s'
|
|
||||||
},
|
|
||||||
'milter_default_action' => {
|
|
||||||
'value' => 'tempfail'
|
|
||||||
},
|
|
||||||
'milter_mail_macros' => {
|
|
||||||
'value' => 'i {mail_addr} {client_addr} {client_name} {auth_authen}'
|
|
||||||
},
|
|
||||||
'milter_protocol' => {
|
|
||||||
'value' => '6'
|
|
||||||
},
|
},
|
||||||
'recipient_canonical_maps' => {
|
'recipient_canonical_maps' => {
|
||||||
'value' => 'hash:/etc/postfix/recipient_canonical'
|
'value' => 'hash:/etc/postfix/recipient_canonical'
|
||||||
@@ -186,7 +177,7 @@ class profiles::postfix::gateway (
|
|||||||
'smtp_tls_session_cache_database' => {
|
'smtp_tls_session_cache_database' => {
|
||||||
'value' => 'btree:/var/lib/postfix/smtp_tls_session_cache'
|
'value' => 'btree:/var/lib/postfix/smtp_tls_session_cache'
|
||||||
},
|
},
|
||||||
'smtp_send_xforward_command' => {
|
'smtp_use_tls' => {
|
||||||
'value' => 'yes'
|
'value' => 'yes'
|
||||||
},
|
},
|
||||||
'smtpd_banner' => {
|
'smtpd_banner' => {
|
||||||
@@ -220,7 +211,7 @@ class profiles::postfix::gateway (
|
|||||||
'value' => 'check_helo_access hash:/etc/postfix/helo_access, reject_invalid_hostname'
|
'value' => 'check_helo_access hash:/etc/postfix/helo_access, reject_invalid_hostname'
|
||||||
},
|
},
|
||||||
'smtpd_milters' => {
|
'smtpd_milters' => {
|
||||||
'value' => $smtpd_milters
|
'value' => 'inet:127.0.0.1:33333'
|
||||||
},
|
},
|
||||||
'smtpd_recipient_restrictions' => {
|
'smtpd_recipient_restrictions' => {
|
||||||
'value' => join($smtpd_recipient_restrictions, ', ')
|
'value' => join($smtpd_recipient_restrictions, ', ')
|
||||||
@@ -264,10 +255,13 @@ class profiles::postfix::gateway (
|
|||||||
'smtpd_tls_session_cache_timeout' => {
|
'smtpd_tls_session_cache_timeout' => {
|
||||||
'value' => '3600s'
|
'value' => '3600s'
|
||||||
},
|
},
|
||||||
|
'smtpd_use_tls' => {
|
||||||
|
'value' => 'yes'
|
||||||
|
},
|
||||||
'tls_medium_cipherlist' => {
|
'tls_medium_cipherlist' => {
|
||||||
'value' => join([
|
'value' => join([
|
||||||
'ECDSA+AESGCM:ECDH+AESGCM:DH+AESGCM:ECDSA+AES:ECDH+AES:DH+AES',
|
'ECDSA+AESGCM:ECDH+AESGCM:DH+AESGCM:ECDSA+AES:ECDH+AES:DH+AES',
|
||||||
'RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS:!3DES'
|
'ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS'
|
||||||
], ':')
|
], ':')
|
||||||
},
|
},
|
||||||
'tls_preempt_cipherlist' => {
|
'tls_preempt_cipherlist' => {
|
||||||
|
|||||||
@@ -1,68 +0,0 @@
|
|||||||
# local rspamd milter for the mail edge gateways
|
|
||||||
# - local_d: /etc/rspamd/local.d file name => content
|
|
||||||
# - rules: /etc/rspamd/rules file name => url, re-fetched every puppet run; fetch failures keep the last good copy
|
|
||||||
class profiles::rspamd::edge (
|
|
||||||
Hash[String, String] $local_d = {},
|
|
||||||
Hash[String, Stdlib::HTTPSUrl] $rules = {},
|
|
||||||
) {
|
|
||||||
|
|
||||||
package { 'rspamd':
|
|
||||||
ensure => installed,
|
|
||||||
}
|
|
||||||
|
|
||||||
$local_d.each |$name, $content| {
|
|
||||||
file { "/etc/rspamd/local.d/${name}":
|
|
||||||
ensure => file,
|
|
||||||
owner => 'root',
|
|
||||||
group => 'root',
|
|
||||||
mode => '0644',
|
|
||||||
content => $content,
|
|
||||||
require => Package['rspamd'],
|
|
||||||
notify => Service['rspamd'],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
file { '/etc/rspamd/rules':
|
|
||||||
ensure => directory,
|
|
||||||
owner => 'root',
|
|
||||||
group => 'root',
|
|
||||||
mode => '0755',
|
|
||||||
require => Package['rspamd'],
|
|
||||||
}
|
|
||||||
|
|
||||||
$rules.each |$name, $url| {
|
|
||||||
$path = "/etc/rspamd/rules/${name}"
|
|
||||||
|
|
||||||
# empty placeholder so rspamd starts before the first successful fetch
|
|
||||||
file { $path:
|
|
||||||
ensure => file,
|
|
||||||
owner => 'root',
|
|
||||||
group => 'root',
|
|
||||||
mode => '0644',
|
|
||||||
content => '',
|
|
||||||
replace => false,
|
|
||||||
}
|
|
||||||
|
|
||||||
# a failed or unchanged fetch skips the swap without failing the run
|
|
||||||
exec { "rspamd_rules_fetch_${name}":
|
|
||||||
command => "/usr/bin/mv -f ${path}.new ${path}",
|
|
||||||
onlyif => "/usr/bin/curl -fsS --max-time 30 -o ${path}.new ${url} && ! /usr/bin/cmp -s ${path}.new ${path}",
|
|
||||||
require => File[$path],
|
|
||||||
notify => Exec['rspamd_reload'],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# reload keeps the milter answering while config changes apply
|
|
||||||
service { 'rspamd':
|
|
||||||
ensure => running,
|
|
||||||
enable => true,
|
|
||||||
restart => '/usr/bin/systemctl reload rspamd',
|
|
||||||
require => Package['rspamd'],
|
|
||||||
}
|
|
||||||
|
|
||||||
exec { 'rspamd_reload':
|
|
||||||
command => '/usr/bin/systemctl reload rspamd',
|
|
||||||
refreshonly => true,
|
|
||||||
require => Service['rspamd'],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,6 @@ class roles::infra::mail::gateway {
|
|||||||
}else{
|
}else{
|
||||||
include profiles::defaults
|
include profiles::defaults
|
||||||
include profiles::base
|
include profiles::base
|
||||||
include profiles::rspamd::edge
|
|
||||||
include profiles::postfix::gateway
|
include profiles::postfix::gateway
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user