diff --git a/README.markdown b/README.markdown index dbe53bc..1292df0 100644 --- a/README.markdown +++ b/README.markdown @@ -43,6 +43,7 @@ class {'postfix': * `relayhost_port` This sets the port for the relay host specified with the `relayhost` parameter. The default is `undef` which leaves the port specifier off the end of the relayhost setting. This parameter does nothing if the `relayhost` parameter is not set. * `daemon_directory` Sets the directory with Postfix support programs and daemon programs are installed. The default is specific for each operating system. It's _not_ recommended that this parameter be changed. * `inet_interfaces` Sets the network interface for postfix to bind do. The default value is `localhost` +* `inet_protocols` Sets the network internet protocol for postfix to utilise. The default value is `all` # Attribution diff --git a/manifests/init.pp b/manifests/init.pp index 4aca743..3de5f0c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -35,6 +35,7 @@ $relayhost_port = undef, $daemon_directory = $::postfix::params::daemon_directory, $inet_interfaces = $::postfix::params::inet_interfaces, + $inet_protocols = $::postfix::params::inet_protocols, ) inherits postfix::params { if $remove_sendmail { diff --git a/manifests/params.pp b/manifests/params.pp index c43806e..55c0298 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -48,4 +48,5 @@ $sendmailcf_package = 'sendmail-cf' $sendmail_service = 'sendmail' $inet_interfaces = 'localhost' + $inet_protocols = 'all' } diff --git a/spec/classes/postfix_spec.rb b/spec/classes/postfix_spec.rb index 6cc0d49..b5b5af6 100644 --- a/spec/classes/postfix_spec.rb +++ b/spec/classes/postfix_spec.rb @@ -98,6 +98,15 @@ ) } end + describe 'when setting inet_protocols' do + let :params do + { :inet_protocols => 'all' } + end + it { should contain_file('postfix_config').with_content( + %r{^inet_protocols = all$} + ) } + end + end end diff --git a/templates/main.cf.erb b/templates/main.cf.erb index 0377e4f..1aa44ed 100644 --- a/templates/main.cf.erb +++ b/templates/main.cf.erb @@ -120,8 +120,12 @@ myorigin = <%= @myorigin %> #inet_interfaces = $myhostname, localhost inet_interfaces = <%= @inet_interfaces %> -# Enable IPv4, and IPv6 if supported -inet_protocols = all +# Enable IPv4 and/or IPv6 +# Options: +# all - IPv4 and IPv6 +# ipv4 - IPv4 only +# ipv6 - IPv6 only +inet_protocols = <%= @inet_protocols %> # The proxy_interfaces parameter specifies the network interface # addresses that this mail system receives mail on by way of a