Use the "new" way to set up sasl in the postfix cookbook

This commit is contained in:
Greg Karekinian 2025-09-09 15:28:20 +02:00
parent 9712697569
commit 0fe6d0bd06

View File

@ -10,13 +10,11 @@ return if node.run_list.roles.include?("email_server")
smtp_credentials = Chef::EncryptedDataBagItem.load('credentials', 'smtp') smtp_credentials = Chef::EncryptedDataBagItem.load('credentials', 'smtp')
node.default['postfix']['sasl']['smtp_sasl_user_name'] = smtp_credentials['user_name'] node.default["postfix"]["sasl"] = {
node.default['postfix']['sasl']['smtp_sasl_passwd'] = smtp_credentials['password'] smtp_credentials["relayhost"] => {
node.default['postfix']['sasl_password_file'] = "#{node['postfix']['conf_dir']}/sasl_passwd" "username" => smtp_credentials["user_name"],
# Postfix doesn't support smtps relayhost, use STARTSSL instead "password" => smtp_credentials["password"]
node.default['postfix']['main']['relayhost'] = smtp_credentials['relayhost'] }
node.default['postfix']['main']['smtp_sasl_auth_enable'] = 'yes' }
node.default['postfix']['main']['smtp_sasl_password_maps'] = "hash:#{node['postfix']['sasl_password_file']}"
node.default['postfix']['main']['smtp_sasl_security_options'] = 'noanonymous'
include_recipe 'postfix::default' include_recipe 'postfix::default'