Mercurial > repos > other > Puppet
changeset 329:f5ce1a5542ee
Fix localhost IMAP on IPv6 (used by Webmail)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 08 Mar 2020 11:14:58 +0000 |
parents | e48167ee504f |
children | 0cccb75d7639 |
files | modules/dovecot/manifests/init.pp modules/dovecot/templates/99-imap-only.conf.epp modules/dovecot/templates/99-imap-only.conf.erb |
diffstat | 3 files changed, 37 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- /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
--- 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