Add email service #526

Merged
raucao merged 30 commits from feature/email into master 2024-01-10 12:09:22 +00:00
2 changed files with 14 additions and 12 deletions
Showing only changes of commit daadd9374f - Show all commits

View File

@ -5,11 +5,23 @@
domain = node["email"]["domain"]
hostname = node["email"]["hostname"]
root_dir = node["email"]["root_directory"]
ip_addr = node["knife_zero"]["host"]
node.override["set_fqdn"] = hostname
include_recipe "hostname"
user "vmail" do
gid "mail"
system true
manage_home false
end
directory root_dir do
owner "vmail"
group "mail"
end
tls_cert_for hostname do
auth "gandi_dns"
action :create

View File

@ -15,6 +15,7 @@ end
domain = node["email"]["domain"]
hostname = node["email"]["hostname"]
root_dir = node["email"]["root_directory"]
ip_addr = node["knife_zero"]["host"]
ldap_search_base = node["email"]["ldap_search_base"]
@ -22,17 +23,6 @@ ldap_user_filter = "(&(objectClass=person)(mailRoutingAddress=%u))"
credentials = Chef::EncryptedDataBagItem.load('credentials', 'email')
user "vmail" do
gid "mail"
system true
manage_home false
end
directory "/var/vmail" do
owner "vmail"
group "mail"
end
template "/etc/dovecot/dovecot.conf" do
source "dovecot.conf.erb"
mode 0644
@ -70,7 +60,7 @@ template "/etc/dovecot/conf.d/10-mail.conf" do
variables mail_uid: "vmail",
mail_gid: "mail",
mail_location: "mbox:~/mail:INBOX=~/mail/INBOX",
mail_home: "/var/vmail/%d/%n"
mail_home: "#{root_dir}/%d/%n"
notifies :restart, "service[dovecot]", :delayed
end