44 lines
		
	
	
		
			931 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			931 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
#
 | 
						|
# Cookbook:: kosmos_email
 | 
						|
# Recipe:: default
 | 
						|
#
 | 
						|
 | 
						|
domain   = node["email"]["domain"]
 | 
						|
hostname = node["email"]["hostname"]
 | 
						|
root_dir = node["email"]["root_directory"]
 | 
						|
ip_addr  = node["knife_zero"]["host"]
 | 
						|
extra_hostnames = ["smtp.#{domain}", "imap.#{domain}"]
 | 
						|
 | 
						|
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
 | 
						|
  domain ([hostname]+extra_hostnames)
 | 
						|
  auth "gandi_dns"
 | 
						|
  deploy_hook "systemctl reload postfix.service && systemctl reload dovecot.service"
 | 
						|
  action :create
 | 
						|
end
 | 
						|
 | 
						|
firewall_rule "private network access" do
 | 
						|
  command  :allow
 | 
						|
  protocol :tcp
 | 
						|
  source   "10.1.1.0/24"
 | 
						|
end
 | 
						|
 | 
						|
include_recipe 'unbound'
 | 
						|
include_recipe 'kosmos_email::opendkim'
 | 
						|
include_recipe 'kosmos_email::spamassassin'
 | 
						|
include_recipe 'kosmos_email::postfix'
 | 
						|
include_recipe 'kosmos_email::dovecot'
 |