# HG changeset patch # User IBBoard # Date 1583666098 0 # Node ID f5ce1a5542eed84799a9ba28e98a2b8b8cd3a6a0 # Parent e48167ee504fe4382fe1b53a6948fac222737c98 Fix localhost IMAP on IPv6 (used by Webmail) diff -r e48167ee504f -r f5ce1a5542ee modules/dovecot/manifests/init.pp --- a/modules/dovecot/manifests/init.pp Sat Mar 07 15:40:25 2020 +0000 +++ b/modules/dovecot/manifests/init.pp Sun Mar 08 11:14:58 2020 +0000 @@ -13,7 +13,13 @@ require => Package['dovecot'], } file { '/etc/dovecot/conf.d/99-imap-only.conf': - content => template('dovecot/99-imap-only.conf.erb'), + content => epp('dovecot/99-imap-only.conf.epp', + { + imapserver_ip => $imapserver_ip, + imapserver_proxy => $imapserver_proxy, + proxy_upstream => $proxy_upstream + } + ), } file { '/etc/dovecot/conf.d/99-extra.conf': content => 'mail_location = maildir:/var/mail/vhosts/%d/%n:INBOX=/var/mail/vhosts/%d/%n/Inbox diff -r e48167ee504f -r f5ce1a5542ee modules/dovecot/templates/99-imap-only.conf.epp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/dovecot/templates/99-imap-only.conf.epp Sun Mar 08 11:14:58 2020 +0000 @@ -0,0 +1,30 @@ +<%- | Stdlib::IP::Address $imapserver_ip, + Optional[Stdlib::IP::Address::V6] $imapserver_proxy = undef, + Optional[Array[Stdlib::IP::Address]] $proxy_upstream = [] + | +-%> +protocols = imap +service imap-login { + # Only allow IMAP locally and IMAPS externally + inet_listener imap { + # FIXME: Needs to be ::1 + address = <% if $imapserver_ip =~ Stdlib::IP::Address::V6 { %>::1<% } else { %>127.0.0.1<% } %> + } + inet_listener imaps { + address = <%= $imapserver_ip %> + ssl = yes + } +<% if $imapserver_proxy { -%> + # If we're running a 6-to-4 proxy then add it on the proxy IP + inet_listener imaps_proxy { + address = <%= $imapserver_proxy %> + port = 993 + ssl = yes + haproxy = yes + } +<% } -%> +} +<% if $imapserver_proxy { -%> +# And set the trusted proxy servers if we're using them +haproxy_trusted_networks = <%= $proxy_upstream.join(' ') %> +<% } -%> \ No newline at end of file diff -r e48167ee504f -r f5ce1a5542ee modules/dovecot/templates/99-imap-only.conf.erb --- a/modules/dovecot/templates/99-imap-only.conf.erb Sat Mar 07 15:40:25 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -protocols = imap -service imap-login { - # Only allow IMAP locally and IMAPS externally - inet_listener imap { - address = 127.0.0.1 - } - inet_listener imaps { - address = <%= @imapserver_ip %> - ssl = yes - } -<% if @imapserver_proxy -%> - # If we're running a 6-to-4 proxy then add it on the proxy IP - inet_listener imaps_proxy { - address = <%= @imapserver_proxy %> - port = 993 - ssl = yes - haproxy = yes - } -<% end -%> -} -<% if @imapserver_proxy -%> -# And set the trusted proxy servers if we're using them -haproxy_trusted_networks = <%= @proxy_upstream.join(' ') %> -<% end -%> \ No newline at end of file