Skip to content

Commit

Permalink
Merge pull request #74 from jordiprats/master
Browse files Browse the repository at this point in the history
mastercf rhel8
  • Loading branch information
jordiprats authored Oct 11, 2019
2 parents b5b9a04 + a3b96f3 commit eed2334
Show file tree
Hide file tree
Showing 8 changed files with 267 additions and 59 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 0.2.40

* Added master.cf options for **RHEL 8**

## 0.2.39

* Added **RHEL 8** support
Expand Down
37 changes: 2 additions & 35 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
$in_flow_delay = '1s',
$setgid_group = $postfix::params::setgid_group_default,
$readme_directory = $postfix::params::readme_directory_default,
$smtp_fallback_relay = undef,
$smtp_fallback_relay = [],
$postfix_username_uid = $postfix_username_uid_default,
$postfix_username_gid = $postfix_username_gid_default,
$add_default_smtpd_instance = true,
Expand Down Expand Up @@ -93,40 +93,7 @@
path => '/bin:/sbin:/usr/bin:/usr/sbin',
}

validate_array($mynetworks)

if($biff)
{
validate_bool($biff)
}

if($append_dot_mydomain)
{
validate_bool($append_dot_mydomain)
}

if($readme_directory)
{
validate_string($readme_directory)
}

validate_string($myorigin)

validate_string($mydomain)

if($recipient_delimiter)
{
validate_string($recipient_delimiter)
}

validate_array($mydestination)

if($smtp_fallback_relay!=undef)
{
validate_array($smtp_fallback_relay)
}

validate_re($home_mailbox, [ '^Maildir/$', '^Mailbox$', '^$' ], 'Not a supported home_mailbox - valid values: Mailbox, Maildir/ or empty string')
# validate_re($home_mailbox, [ '^Maildir/$', '^Mailbox$', '^$' ], 'Not a supported home_mailbox - valid values: Mailbox, Maildir/ or empty string')

user { $postfix_username:
ensure => 'present',
Expand Down
16 changes: 2 additions & 14 deletions manifests/instance.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
$type,
$command,
$service = $name,
$opts = undef,
$args = undef,
$opts = {},
$args = [],
$private = '-',
$unpriv = '-',
$chroot = '-',
Expand All @@ -13,18 +13,6 @@
$order = '42',
) {

#service type private unpriv chroot wakeup maxproc command + args

if($opts!=undef)
{
validate_hash($opts)
}

if($args!=undef)
{
validate_array($args)
}

concat::fragment{ "/etc/postfix/master.cf ${service} ${type} ${command}":
target => '/etc/postfix/master.cf',
order => $order,
Expand Down
255 changes: 255 additions & 0 deletions manifests/mastercf.pp
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,261 @@
command => 'scache',
order => '24',
}
}
/^8.*$/:
{
# smtp inet n - n - - smtpd
# pickup unix n - n 60 1 pickup
# cleanup unix n - n - 0 cleanup
# qmgr unix n - n 300 1 qmgr
# tlsmgr unix - - n 1000? 1 tlsmgr
# rewrite unix - - n - - trivial-rewrite
# bounce unix - - n - 0 bounce
# defer unix - - n - 0 bounce
# trace unix - - n - 0 bounce
# verify unix - - n - 1 verify
# flush unix n - n 1000? 0 flush
# proxymap unix - - n - - proxymap
# proxywrite unix - - n - 1 proxymap
# smtp unix - - n - - smtp
# relay unix - - n - - smtp
# -o syslog_name=postfix/$service_name
# showq unix n - n - - showq
# error unix - - n - - error
# retry unix - - n - - error
# discard unix - - n - - discard
# local unix - n n - - local
# virtual unix - n n - - virtual
# lmtp unix - - n - - lmtp
# anvil unix - - n - 1 anvil
# scache unix - - n - 1 scache

# smtp inet n - n - - smtpd
if($add_default_smtpd_instance)
{
# service type private unpriv chroot wakeup maxproc command + args
# smtp inet n - n - - smtpd
postfix::instance { 'smtp inet':
service => 'smtp',
type => 'inet',
private => 'n',
chroot => 'n',
command => 'smtpd',
order => '01',
}
}

# pickup unix n - n 60 1 pickup
postfix::instance { 'pickup':
type => 'unix',
private => 'n',
chroot => 'n',
wakeup => '60',
maxproc => '1',
command => 'pickup',
order => '02',
}

# cleanup unix n - n - 0 cleanup
postfix::instance { 'cleanup':
type => 'unix',
private => 'n',
chroot => 'n',
maxproc => '0',
command => 'cleanup',
order => '03',
}


# qmgr unix n - n 300 1 qmgr
postfix::instance { 'qmgr':
type => 'unix',
private => 'n',
chroot => 'n',
wakeup => '300',
maxproc => '1',
command => 'qmgr',
order => '04',
}

# tlsmgr unix - - n 1000? 1 tlsmgr
postfix::instance { 'tlsmgr':
type => 'unix',
chroot => 'n',
wakeup => '1000?',
maxproc => '1',
command => 'tlsmgr',
order => '05',
}

# rewrite unix - - n - - trivial-rewrite
postfix::instance { 'rewrite':
type => 'unix',
chroot => 'n',
command => 'trivial-rewrite',
order => '06',
}

# bounce unix - - n - 0 bounce
postfix::instance { 'bounce':
type => 'unix',
chroot => 'n',
maxproc => '0',
command => 'bounce',
order => '07',
}

# defer unix - - n - 0 bounce
postfix::instance { 'defer':
type => 'unix',
chroot => 'n',
maxproc => '0',
command => 'bounce',
order => '08',
}

# trace unix - - n - 0 bounce
postfix::instance { 'trace':
type => 'unix',
chroot => 'n',
maxproc => '0',
command => 'bounce',
order => '09',
}

# verify unix - - n - 1 verify
postfix::instance { 'verify':
type => 'unix',
chroot => 'n',
maxproc => '1',
command => 'verify',
order => '10',
}

# flush unix n - n 1000? 0 flush
postfix::instance { 'flush':
type => 'unix',
private => 'n',
chroot => 'n',
wakeup => '1000?',
maxproc => '0',
command => 'flush',
order => '11',
}

# proxymap unix - - n - - proxymap
postfix::instance { 'proxymap':
type => 'unix',
chroot => 'n',
command => 'proxymap',
order => '12',
}

# proxywrite unix - - n - 1 proxymap
postfix::instance { 'proxywrite':
type => 'unix',
chroot => 'n',
maxproc => '1',
command => 'proxymap',
order => '13',
}

# smtp unix - - n - - smtp
postfix::instance { 'smtp unix':
service => 'smtp',
type => 'unix',
chroot => 'n',
command => 'smtp',
order => '14',
}

# relay unix - - n - - smtp
postfix::instance { 'relay':
type => 'unix',
chroot => 'n',
command => 'smtp',
order => '15',
opts => { 'syslog_name' => 'postfix/$service_name' },
}

# showq unix n - n - - showq
postfix::instance { 'showq':
type => 'unix',
private => 'n',
chroot => 'n',
command => 'showq',
order => '16',
}

# error unix - - n - - error
postfix::instance { 'error':
type => 'unix',
chroot => 'n',
command => 'error',
order => '17',
}

# retry unix - - n - - error
postfix::instance { 'retry':
type => 'unix',
chroot => 'n',
command => 'error',
order => '18',
}

# discard unix - - n - - discard
postfix::instance { 'discard':
type => 'unix',
chroot => 'n',
command => 'discard',
order => '19',
}

# local unix - n n - - local
postfix::instance { 'local':
type => 'unix',
unpriv => 'n',
chroot => 'n',
command => 'local',
order => '20',
}

# virtual unix - n n - - virtual
postfix::instance { 'virtual':
type => 'unix',
unpriv => 'n',
chroot => 'n',
command => 'virtual',
order => '21',
}

# lmtp unix - - n - - lmtp
postfix::instance { 'lmtp':
type => 'unix',
chroot => 'n',
command => 'lmtp',
order => '22',
}

# anvil unix - - n - 1 anvil
postfix::instance { 'anvil':
type => 'unix',
chroot => 'n',
maxproc => '1',
command => 'anvil',
order => '23',
}

# scache unix - - n - 1 scache
postfix::instance { 'scache':
type => 'unix',
chroot => 'n',
maxproc => '1',
command => 'scache',
order => '24',
}


}
default: { fail('Unsupported RHEL/CentOS version!') }
}
Expand Down
6 changes: 0 additions & 6 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
$enable = true,
) inherits postfix::params {

validate_bool($manage_docker_service)
validate_bool($manage_service)
validate_bool($enable)

validate_re($ensure, [ '^running$', '^stopped$' ], "Not a valid daemon status: ${ensure}")

$is_docker_container_var=getvar('::eyp_docker_iscontainer')
$is_docker_container=str2bool($is_docker_container_var)

Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eyp-postfix",
"version": "0.2.39",
"version": "0.2.40",
"author": "eyp",
"summary": "postfix management - relay or multidomain mailserver",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion templates/main.cf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ mynetworks = <%= @mynetworks.join(",") %>
relayhost = <% if ! @relayhost_mx_lookup %>[<% end %><%= @relayhost %><% if ! @relayhost_mx_lookup %>]<% end %>
<% end -%>

<% if defined?(@smtp_fallback_relay) -%>
<% if @smtp_fallback_relay.any? -%>
smtp_fallback_relay = <%= @smtp_fallback_relay.join(',') %>
<% end -%>

Expand Down
4 changes: 2 additions & 2 deletions templates/mastercf/masterservice.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# <%= @comment %>
<% end -%>
<%= @service %> <%= @type %> <%= @private %> <%= @unpriv %> <%= @chroot %> <%= @wakeup %> <%= @maxproc %> <%= @command %>
<%- if defined?(@opts) -%>
<%- if @opts.any? -%>
<%- @opts.each do | key, value | -%>
-o <%= key %>=<%= value %>
<%- end -%>
<%- end -%>
<%- if defined?(@args) -%>
<%- if @args.any? -%>
<%- @args.each do | value | -%>
<%= value %>
<%- end -%>
Expand Down

0 comments on commit eed2334

Please sign in to comment.