Add support for almalinux10 (#210)
This commit is contained in:
parent
61a3fae922
commit
9e05c0f0be
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@ -24,6 +24,7 @@ jobs:
|
|||||||
os:
|
os:
|
||||||
- almalinux-8
|
- almalinux-8
|
||||||
- almalinux-9
|
- almalinux-9
|
||||||
|
- almalinux-10
|
||||||
- amazonlinux-2023
|
- amazonlinux-2023
|
||||||
- centos-stream-9
|
- centos-stream-9
|
||||||
- debian-11
|
- debian-11
|
||||||
|
@ -4,6 +4,8 @@ This file is used to list changes made in each version of the postfix cookbook.
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- Use LMDB instead of hash on el10
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
## 6.2.2 - *2025-01-30*
|
## 6.2.2 - *2025-01-30*
|
||||||
|
@ -13,9 +13,10 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
default['postfix']['packages'] = value_for_platform(
|
||||||
default['postfix']['packages'] = %w(postfix)
|
amazon: { '>= 2023' => %w(postfix postfix-lmdb) },
|
||||||
|
default: %w(postfix)
|
||||||
|
)
|
||||||
# Generic cookbook attributes
|
# Generic cookbook attributes
|
||||||
default['postfix']['mail_type'] = 'client'
|
default['postfix']['mail_type'] = 'client'
|
||||||
default['postfix']['relayhost_role'] = 'relayhost'
|
default['postfix']['relayhost_role'] = 'relayhost'
|
||||||
@ -37,11 +38,19 @@ default['postfix']['master_template_source'] = 'postfix'
|
|||||||
default['postfix']['sender_canonical_map_entries'] = {}
|
default['postfix']['sender_canonical_map_entries'] = {}
|
||||||
default['postfix']['smtp_generic_map_entries'] = {}
|
default['postfix']['smtp_generic_map_entries'] = {}
|
||||||
default['postfix']['recipient_canonical_map_entries'] = {}
|
default['postfix']['recipient_canonical_map_entries'] = {}
|
||||||
default['postfix']['access_db_type'] = 'hash'
|
|
||||||
default['postfix']['aliases_db_type'] = 'hash'
|
default['postfix']['db_type'] = value_for_platform(
|
||||||
default['postfix']['transport_db_type'] = 'hash'
|
%w(centos redhat almalinux rocky oracle) => { '>= 10' => 'lmdb' },
|
||||||
default['postfix']['virtual_alias_db_type'] = 'hash'
|
amazon: { '>= 2023' => 'lmdb' },
|
||||||
default['postfix']['virtual_alias_domains_db_type'] = 'hash'
|
%w(opensuseleap suse) => { '>= 15' => 'lmdb' },
|
||||||
|
default: 'hash'
|
||||||
|
)
|
||||||
|
|
||||||
|
default['postfix']['access_db_type'] = lazy { node['postfix']['db_type'] }
|
||||||
|
default['postfix']['aliases_db_type'] = lazy { node['postfix']['db_type'] }
|
||||||
|
default['postfix']['transport_db_type'] = lazy { node['postfix']['db_type'] }
|
||||||
|
default['postfix']['virtual_alias_db_type'] = lazy { node['postfix']['db_type'] }
|
||||||
|
default['postfix']['virtual_alias_domains_db_type'] = lazy { node['postfix']['db_type'] }
|
||||||
|
|
||||||
case node['platform']
|
case node['platform']
|
||||||
when 'smartos'
|
when 'smartos'
|
||||||
@ -96,6 +105,9 @@ default['postfix']['main']['smtp_sasl_auth_enable'] = 'no'
|
|||||||
default['postfix']['main']['mailbox_size_limit'] = 0
|
default['postfix']['main']['mailbox_size_limit'] = 0
|
||||||
default['postfix']['main']['mynetworks'] = nil
|
default['postfix']['main']['mynetworks'] = nil
|
||||||
default['postfix']['main']['inet_interfaces'] = 'loopback-only'
|
default['postfix']['main']['inet_interfaces'] = 'loopback-only'
|
||||||
|
default['postfix']['main']['default_database_type'] = lazy { node['postfix']['db_type'] }
|
||||||
|
default['postfix']['main']['alias_database'] = lazy { "#{node['postfix']['db_type']}:#{node['postfix']['aliases_db']}" }
|
||||||
|
default['postfix']['main']['alias_maps'] = lazy { "#{node['postfix']['db_type']}:#{node['postfix']['aliases_db']}" }
|
||||||
|
|
||||||
# Conditional attributes, also reference _attributes recipe
|
# Conditional attributes, also reference _attributes recipe
|
||||||
case node['platform_family']
|
case node['platform_family']
|
||||||
@ -407,4 +419,4 @@ default['postfix']['aliases'] = if platform?('freebsd')
|
|||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
|
|
||||||
default['postfix']['main']['smtpd_relay_restrictions'] = "hash:#{node['postfix']['relay_restrictions_db']}, reject" if node['postfix']['use_relay_restrictions_maps']
|
default['postfix']['main']['smtpd_relay_restrictions'] = lazy { "#{node['postfix']['db_type']}:#{node['postfix']['relay_restrictions_db']}, reject" if node['postfix']['use_relay_restrictions_maps'] }
|
||||||
|
@ -29,24 +29,24 @@ end
|
|||||||
|
|
||||||
if node['postfix']['main']['smtp_sasl_auth_enable'] == 'yes'
|
if node['postfix']['main']['smtp_sasl_auth_enable'] == 'yes'
|
||||||
node.default_unless['postfix']['sasl_password_file'] = "#{node['postfix']['conf_dir']}/sasl_passwd"
|
node.default_unless['postfix']['sasl_password_file'] = "#{node['postfix']['conf_dir']}/sasl_passwd"
|
||||||
node.default_unless['postfix']['main']['smtp_sasl_password_maps'] = "hash:#{node['postfix']['sasl_password_file']}"
|
node.default_unless['postfix']['main']['smtp_sasl_password_maps'] = "#{node['postfix']['db_type']}:#{node['postfix']['sasl_password_file']}"
|
||||||
node.default_unless['postfix']['main']['smtp_sasl_security_options'] = 'noanonymous'
|
node.default_unless['postfix']['main']['smtp_sasl_security_options'] = 'noanonymous'
|
||||||
node.default_unless['postfix']['sasl']['smtp_sasl_user_name'] = ''
|
node.default_unless['postfix']['sasl']['smtp_sasl_user_name'] = ''
|
||||||
node.default_unless['postfix']['sasl']['smtp_sasl_passwd'] = ''
|
node.default_unless['postfix']['sasl']['smtp_sasl_passwd'] = ''
|
||||||
node.default_unless['postfix']['main']['relayhost'] = ''
|
node.default_unless['postfix']['main']['relayhost'] = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
node.default_unless['postfix']['main']['alias_maps'] = ["hash:#{node['postfix']['aliases_db']}"] if node['postfix']['use_alias_maps']
|
node.default_unless['postfix']['main']['alias_maps'] = ["#{node['postfix']['db_type']}:#{node['postfix']['aliases_db']}"] if node['postfix']['use_alias_maps']
|
||||||
|
|
||||||
node.default_unless['postfix']['main']['transport_maps'] = ["hash:#{node['postfix']['transport_db']}"] if node['postfix']['use_transport_maps']
|
node.default_unless['postfix']['main']['transport_maps'] = ["#{node['postfix']['db_type']}:#{node['postfix']['transport_db']}"] if node['postfix']['use_transport_maps']
|
||||||
|
|
||||||
node.default_unless['postfix']['main']['access_maps'] = ["hash:#{node['postfix']['access_db']}"] if node['postfix']['use_access_maps']
|
node.default_unless['postfix']['main']['access_maps'] = ["#{node['postfix']['db_type']}:#{node['postfix']['access_db']}"] if node['postfix']['use_access_maps']
|
||||||
|
|
||||||
node.default_unless['postfix']['main']['virtual_alias_maps'] = ["#{node['postfix']['virtual_alias_db_type']}:#{node['postfix']['virtual_alias_db']}"] if node['postfix']['use_virtual_aliases']
|
node.default_unless['postfix']['main']['virtual_alias_maps'] = ["#{node['postfix']['virtual_alias_db_type']}:#{node['postfix']['virtual_alias_db']}"] if node['postfix']['use_virtual_aliases']
|
||||||
|
|
||||||
node.default_unless['postfix']['main']['virtual_alias_domains'] = ["#{node['postfix']['virtual_alias_domains_db_type']}:#{node['postfix']['virtual_alias_domains_db']}"] if node['postfix']['use_virtual_aliases_domains']
|
node.default_unless['postfix']['main']['virtual_alias_domains'] = ["#{node['postfix']['virtual_alias_domains_db_type']}:#{node['postfix']['virtual_alias_domains_db']}"] if node['postfix']['use_virtual_aliases_domains']
|
||||||
|
|
||||||
node.default_unless['postfix']['main']['smtpd_relay_restrictions'] = "hash:#{node['postfix']['relay_restrictions_db']}, reject" if node['postfix']['use_relay_restrictions_maps']
|
node.default_unless['postfix']['main']['smtpd_relay_restrictions'] = "#{node['postfix']['db_type']}:#{node['postfix']['relay_restrictions_db']}, reject" if node['postfix']['use_relay_restrictions_maps']
|
||||||
|
|
||||||
node.default_unless['postfix']['main']['maildrop_destination_recipient_limit'] = 1 if node['postfix']['master']['maildrop']['active']
|
node.default_unless['postfix']['main']['maildrop_destination_recipient_limit'] = 1 if node['postfix']['master']['maildrop']['active']
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ unless node['postfix']['sender_canonical_map_entries'].empty?
|
|||||||
notifies :reload, 'service[postfix]'
|
notifies :reload, 'service[postfix]'
|
||||||
end
|
end
|
||||||
|
|
||||||
node.default['postfix']['main']['sender_canonical_maps'] = "hash:#{node['postfix']['conf_dir']}/sender_canonical" unless node['postfix']['main'].key?('sender_canonical_maps')
|
node.default['postfix']['main']['sender_canonical_maps'] = "#{node['postfix']['db_type']}:#{node['postfix']['conf_dir']}/sender_canonical" unless node['postfix']['main'].key?('sender_canonical_maps')
|
||||||
end
|
end
|
||||||
|
|
||||||
execute 'update-postfix-smtp_generic' do
|
execute 'update-postfix-smtp_generic' do
|
||||||
@ -172,7 +172,7 @@ unless node['postfix']['smtp_generic_map_entries'].empty?
|
|||||||
notifies :reload, 'service[postfix]'
|
notifies :reload, 'service[postfix]'
|
||||||
end
|
end
|
||||||
|
|
||||||
node.default['postfix']['main']['smtp_generic_maps'] = "hash:#{node['postfix']['conf_dir']}/smtp_generic" unless node['postfix']['main'].key?('smtp_generic_maps')
|
node.default['postfix']['main']['smtp_generic_maps'] = "#{node['postfix']['db_type']}:#{node['postfix']['conf_dir']}/smtp_generic" unless node['postfix']['main'].key?('smtp_generic_maps')
|
||||||
end
|
end
|
||||||
|
|
||||||
execute 'update-postfix-recipient_canonical' do
|
execute 'update-postfix-recipient_canonical' do
|
||||||
@ -189,7 +189,7 @@ unless node['postfix']['recipient_canonical_map_entries'].empty?
|
|||||||
notifies :reload, 'service[postfix]'
|
notifies :reload, 'service[postfix]'
|
||||||
end
|
end
|
||||||
|
|
||||||
node.default['postfix']['main']['recipient_canonical_maps'] = "hash:#{node['postfix']['conf_dir']}/recipient_canonical" unless node['postfix']['main'].key?('recipient_canonical_maps')
|
node.default['postfix']['main']['recipient_canonical_maps'] = "#{node['postfix']['db_type']}:#{node['postfix']['conf_dir']}/recipient_canonical" unless node['postfix']['main'].key?('recipient_canonical_maps')
|
||||||
end
|
end
|
||||||
|
|
||||||
service 'postfix' do
|
service 'postfix' do
|
||||||
|
@ -18,8 +18,8 @@ node['postfix']['maps'].each do |type, maps|
|
|||||||
package "postfix-#{type}" if %w(pgsql mysql ldap cdb).include?(type)
|
package "postfix-#{type}" if %w(pgsql mysql ldap cdb).include?(type)
|
||||||
end
|
end
|
||||||
|
|
||||||
if platform?('redhat') && node['platform_version'].to_i == 8
|
if platform_family?('rhel') && node['platform_version'].to_i >= 8
|
||||||
package "postfix-#{type}" if %w(pgsql mysql ldap cdb).include?(type)
|
package "postfix-#{type}" if %w(pgsql mysql ldap cdb lmdb).include?(type)
|
||||||
end
|
end
|
||||||
|
|
||||||
separator = if %w(pgsql mysql ldap memcache sqlite).include?(type)
|
separator = if %w(pgsql mysql ldap memcache sqlite).include?(type)
|
||||||
@ -32,7 +32,7 @@ node['postfix']['maps'].each do |type, maps|
|
|||||||
command "postmap #{file}"
|
command "postmap #{file}"
|
||||||
environment PATH: "#{ENV['PATH']}:/opt/omni/bin:/opt/omni/sbin" if platform_family?('omnios')
|
environment PATH: "#{ENV['PATH']}:/opt/omni/bin:/opt/omni/sbin" if platform_family?('omnios')
|
||||||
action :nothing
|
action :nothing
|
||||||
end if %w(btree cdb dbm hash sdbm).include?(type)
|
end if %w(btree cdb dbm hash lmdb sdbm).include?(type)
|
||||||
template "#{file}-#{type}" do
|
template "#{file}-#{type}" do
|
||||||
path file
|
path file
|
||||||
source 'maps.erb'
|
source 'maps.erb'
|
||||||
@ -41,7 +41,7 @@ node['postfix']['maps'].each do |type, maps|
|
|||||||
map: content,
|
map: content,
|
||||||
separator: separator
|
separator: separator
|
||||||
)
|
)
|
||||||
notifies :run, "execute[update-postmap-#{file}]" if %w(btree cdb dbm hash sdbm).include?(type)
|
notifies :run, "execute[update-postmap-#{file}]" if %w(btree cdb dbm hash lmdb sdbm).include?(type)
|
||||||
notifies :restart, 'service[postfix]'
|
notifies :restart, 'service[postfix]'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,6 +2,12 @@ recipient_canonical =
|
|||||||
case os.family
|
case os.family
|
||||||
when 'suse'
|
when 'suse'
|
||||||
'/etc/postfix/recipient_canonical.lmdb'
|
'/etc/postfix/recipient_canonical.lmdb'
|
||||||
|
when 'redhat'
|
||||||
|
if os.release.to_i >= 10
|
||||||
|
'/etc/postfix/recipient_canonical'
|
||||||
|
else
|
||||||
|
'/etc/postfix/recipient_canonical.db'
|
||||||
|
end
|
||||||
else
|
else
|
||||||
'/etc/postfix/recipient_canonical.db'
|
'/etc/postfix/recipient_canonical.db'
|
||||||
end
|
end
|
||||||
|
@ -13,7 +13,9 @@ control 'sasl_auth_multiple' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
db_type = ((os.family == 'redhat' && os.release.to_i >= 10) || (os.family == 'suse' && os.release.to_i >= 15)) ? 'lmdb' : 'hash'
|
||||||
|
|
||||||
describe postfix_conf '/etc/postfix/main.cf' do
|
describe postfix_conf '/etc/postfix/main.cf' do
|
||||||
its('smtp_sasl_password_maps') { should eq 'hash:/etc/postfix/sasl_passwd' }
|
its('smtp_sasl_password_maps') { should eq "#{db_type}:/etc/postfix/sasl_passwd" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -11,7 +11,9 @@ control 'sasl_auth_none' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
db_type = ((os.family == 'redhat' && os.release.to_i >= 10) || (os.family == 'suse' && os.release.to_i >= 15)) ? 'lmdb' : 'hash'
|
||||||
|
|
||||||
describe postfix_conf '/etc/postfix/main.cf' do
|
describe postfix_conf '/etc/postfix/main.cf' do
|
||||||
its('smtp_sasl_password_maps') { should eq 'hash:/etc/postfix/sasl_passwd' }
|
its('smtp_sasl_password_maps') { should eq "#{db_type}:/etc/postfix/sasl_passwd" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -12,7 +12,9 @@ control 'sasl_auth_one' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
db_type = ((os.family == 'redhat' && os.release.to_i >= 10) || (os.family == 'suse' && os.release.to_i >= 15)) ? 'lmdb' : 'hash'
|
||||||
|
|
||||||
describe postfix_conf '/etc/postfix/main.cf' do
|
describe postfix_conf '/etc/postfix/main.cf' do
|
||||||
its('smtp_sasl_password_maps') { should eq 'hash:/etc/postfix/sasl_passwd' }
|
its('smtp_sasl_password_maps') { should eq "#{db_type}:/etc/postfix/sasl_passwd" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user