Merge branch 'master' into master

This commit is contained in:
Jason Field 2020-11-23 18:24:20 +00:00 committed by GitHub
commit 31e9ec3f36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 480 additions and 274 deletions

10
.circleci/config.yml Normal file
View File

@ -0,0 +1,10 @@
---
version: 2.1
orbs:
kitchen: sous-chefs/kitchen@2
workflows:
danger:
jobs:
- kitchen/danger:
name: danger
context: Danger-Minimal

1
.envrc Normal file
View File

@ -0,0 +1 @@
use chefworkstation

View File

@ -1,17 +0,0 @@
---
name: Branch Cleanup
# This workflow is triggered on all closed pull requests.
# However the script does not do anything if a merge was not performed.
on:
pull_request:
types: [closed]
env:
NO_BRANCH_DELETED_EXIT_CODE: 0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: jessfraz/branch-cleanup-action@master

89
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,89 @@
---
name: ci
"on":
pull_request:
push:
branches:
- master
jobs:
delivery:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Run Chef Delivery
uses: actionshub/chef-delivery@master
env:
CHEF_LICENSE: accept-no-persist
yamllint:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Run yaml Lint
uses: actionshub/yamllint@master
mdl:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Run Markdown Lint
uses: actionshub/markdownlint@master
dokken:
needs: [mdl, yamllint, delivery]
runs-on: ubuntu-latest
strategy:
matrix:
os:
- 'amazonlinux-2'
- 'debian-9'
- 'debian-10'
- 'centos-7'
- 'centos-8'
- 'fedora-latest'
- 'ubuntu-1604'
- 'ubuntu-1804'
- 'ubuntu-2004'
- 'opensuse-leap-15'
suite:
- 'default'
- 'aliases'
- 'client'
- 'server'
- 'canonical'
- 'sasl-auth-none'
- 'sasl-auth-multiple'
- 'sasl-auth-one'
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@master
- name: Install Chef
uses: actionshub/chef-install@master
- name: Dokken
uses: actionshub/kitchen-dokken@master
env:
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: kitchen.dokken.yml
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
- name: Print debug output on failure
if: failure()
run: |
set -x
sudo journalctl -l --since today
KITCHEN_LOCAL_YAML=kitchen.dokken.yml /usr/bin/kitchen exec ${{ matrix.suite }}-${{ matrix.os }} -c "journalctl -l"
final:
needs: [dokken]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master

View File

@ -1,16 +0,0 @@
name: delivery
on: [push, pull_request]
jobs:
delivery:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Run Chef Delivery
uses: actionshub/chef-delivery@master
env:
CHEF_LICENSE: accept-no-persist

19
.github/workflows/md-links.yml vendored Normal file
View File

@ -0,0 +1,19 @@
---
name: md-links
"on":
pull_request:
push:
branches: [master]
jobs:
md-links:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: markdown-link-check
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-verbose-mode: "yes"
folder-path: "documentation"

28
.github/workflows/stale.yml vendored Normal file
View File

@ -0,0 +1,28 @@
---
name: Mark stale issues and pull requests
"on":
schedule:
- cron: "0 0 * * *"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
close-issue-message: >
Closing due to inactivity.
If this is still an issue please reopen or open another issue.
Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help!
Thanks, Sous-Chefs.
days-before-close: 7
days-before-stale: 365
stale-issue-message: >
Marking stale due to inactivity.
Remove stale label or comment or this will be closed in 7 days.
Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help!
Thanks, Sous-Chefs.

5
.gitignore vendored
View File

@ -1,7 +1,6 @@
*.rbc
.config
InstalledFiles
lib/bundler/man
pkg
test/tmp
test/version_tmp
@ -16,11 +15,11 @@ _Store
*.bk
*.bkup
# editor temp files
# editor files
.idea
.*.sw[a-z]
# ruby/bundler files
# ruby/bundler/rspec files
.ruby-version
.ruby-gemset
.rvmrc

1
.mdlrc Normal file
View File

@ -0,0 +1 @@
rules "~MD013", "~MD024", "~MD025"

20
.overcommit.yml Normal file
View File

@ -0,0 +1,20 @@
---
PreCommit:
TrailingWhitespace:
enabled: true
YamlLint:
enabled: true
Rspec:
enabled: true
required_executable: 'rspec'
Cookstyle:
enabled: true
required_executable: 'cookstyle'
command: ["cookstyle"]
Delivery:
enabled: true
required_executable: 'delivery'
flags: ['local', 'all']
CommitMsg:
HardTabs:
enabled: true

View File

@ -1,49 +0,0 @@
addons:
apt:
sources:
- chef-current-xenial
packages:
- chef-workstation
install: echo "skip bundle install"
env:
- CHEF_LICENSE=accept
branches:
only:
- master
services: docker
env:
matrix:
# - INSTANCE=default-amazonlinux # package install times out
- INSTANCE=default-centos-6
- INSTANCE=default-centos-7
- INSTANCE=default-debian-9
- INSTANCE=default-debian-10
- INSTANCE=default-ubuntu-1604
- INSTANCE=default-ubuntu-1804
#- INSTANCE=canonical-amazonlinux
- INSTANCE=canonical-centos-6
- INSTANCE=canonical-centos-7
- INSTANCE=canonical-debian-9
- INSTANCE=canonical-debian-10
- INSTANCE=canonical-ubuntu-1604
- INSTANCE=canonical-ubuntu-1804
before_script:
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- eval "$(chef shell-init bash)"
- chef --version
script: KITCHEN_LOCAL_YAML=kitchen.dokken.yml kitchen verify ${INSTANCE}
matrix:
include:
- script:
- delivery local all
env:
- UNIT_AND_LINT=1
- CHEF_LICENSE=accept

7
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"recommendations": [
"chef-software.chef",
"rebornix.ruby",
"editorconfig.editorconfig"
]
}

7
.yamllint Normal file
View File

@ -0,0 +1,7 @@
---
extends: default
rules:
line-length:
max: 256
level: warning
document-start: disable

View File

@ -6,6 +6,38 @@ This file is used to list changes made in each version of the postfix cookbook.
- Disabled SSLv3 by default
## 5.4.1 - 2020-10-20
- Ensure all postmap files are rebuilt immediately if needed
## 5.4.0 - 2020-10-11
### Changed
- Sous Chefs Adoption
- Update to use Sous Chefs GH workflow
- Update README to sous-chefs
- Update metadata.rb to Sous Chefs
- Update test-kitchen to Sous Chefs
### Added
- Standardise files with files in sous-chefs/repo-management
- Add Ubuntu 20.04 testing
### Fixed
- Cookstyle fixes
- ChefSpec fixes
- Yamllint fixes
- MDL fixes
- Fix OpenSUSE installation issues
### Removed
- Remove EL 6 testing
- Remove Amazon Linux 1 testing
## 5.3.1 (2018-07-24)
- Fixed sbin issue with Chef13

View File

@ -1 +1,3 @@
Please refer to the Chef Community Code of Conduct at https://www.chef.io/code-of-conduct/
# Community Guidelines
This project follows the Chef Community Guidelines <https://docs.chef.io/community_guidelines.html>

View File

@ -1 +1,4 @@
Please refer to <https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD>
# Contributing
Please refer to
[https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)

47
Dangerfile Normal file
View File

@ -0,0 +1,47 @@
# Reference: http://danger.systems/reference.html
# A pull request summary is required. Add a description of the pull request purpose.
# Changelog must be updated for each pull request that changes code.
# Warnings will be issued for:
# Pull request with more than 400 lines of code changed
# Pull reqest that change more than 5 lines without test changes
# Failures will be issued for:
# Pull request without summary
# Pull requests with code changes without changelog entry
def code_changes?
code = %w(libraries attributes recipes resources files templates)
code.each do |location|
return true unless git.modified_files.grep(/#{location}/).empty?
end
false
end
def test_changes?
tests = %w(spec test kitchen.yml kitchen.dokken.yml)
tests.each do |location|
return true unless git.modified_files.grep(/#{location}/).empty?
end
false
end
failure 'Please provide a summary of your Pull Request.' if github.pr_body.length < 10
warn 'This is a big Pull Request.' if git.lines_of_code > 400
warn 'This is a Table Flip.' if git.lines_of_code > 2000
# Require a CHANGELOG entry for non-test changes.
if !git.modified_files.include?('CHANGELOG.md') && code_changes?
failure 'Please include a CHANGELOG entry.'
end
# Require Major Minor Patch version labels
unless github.pr_labels.grep /minor|major|patch/i
warn 'Please add a release label to this pull request'
end
# A sanity check for tests.
if git.lines_of_code > 5 && code_changes? && !test_changes?
warn 'This Pull Request is probably missing tests.'
end

View File

@ -1,11 +1,19 @@
# postfix Cookbook
[![Build Status](https://travis-ci.org/chef-cookbooks/postfix.svg?branch=master)](https://travis-ci.org/chef-cookbooks/postfix) [![Cookbook Version](https://img.shields.io/cookbook/v/postfix.svg)](https://supermarket.chef.io/cookbooks/postfix)
[![Cookbook Version](https://img.shields.io/cookbook/v/postfix.svg)](https://supermarket.chef.io/cookbooks/postfix)
[![CI State](https://github.com/sous-chefs/postfix/workflows/ci/badge.svg)](https://github.com/sous-chefs/postfix/actions?query=workflow%3Aci)
[![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors)
[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0)
Installs and configures postfix for client or outbound relayhost, or to do SASL authentication.
On RHEL-family systems, sendmail will be replaced with postfix.
## Maintainers
This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If youd like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF).
## Requirements
### Platforms
@ -443,25 +451,27 @@ override_attributes(
)
```
## Maintainers
## Contributors
This cookbook is maintained by Chef's Community Cookbook Engineering team. Our goal is to improve cookbook quality and to aid the community in contributing to cookbooks. To learn more about our team, process, and design goals see our [team documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/COOKBOOK_TEAM.MD). To learn more about contributing to cookbooks like this see our [contributing documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD), or if you have general questions about this cookbook come chat with us in #cookbok-engineering on the [Chef Community Slack](http://community-slack.chef.io/)
This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false)
## License
### Backers
Thank you to all our backers!
**Copyright:** 2009-2017, Chef Software, Inc.
![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600&avatarHeight=40)
```
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
### Sponsors
http://www.apache.org/licenses/LICENSE-2.0
Support this project by becoming a sponsor. Your logo will show up here with a link to your website.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100)

View File

@ -1,2 +1,3 @@
Please refer to
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD
# Testing
Please refer to [the community cookbook documentation on testing](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD).

View File

@ -109,6 +109,9 @@ when 'rhel'
default['postfix']['cafile'] = '/etc/pki/tls/cert.pem'
when 'amazon'
default['postfix']['cafile'] = '/etc/pki/tls/cert.pem'
when 'suse'
default['postfix']['main']['setgid_group'] = 'maildrop'
default['postfix']['main']['daemon_directory'] = '/usr/lib/postfix/bin'
else
default['postfix']['cafile'] = "#{node['postfix']['conf_dir']}/cacert.pem"
end

View File

@ -9,10 +9,7 @@ ehthumbs.db
Icon?
nohup.out
Thumbs.db
# SASS #
########
.sass-cache
.envrc
# EDITORS #
###########
@ -26,10 +23,11 @@ Thumbs.db
*.tmproj
*~
\#*
mkmf.log
REVISION
TAGS*
tmtags
.vscode
.editorconfig
## COMPILED ##
##############
@ -42,22 +40,29 @@ tmtags
*.so
*/rdoc/
a.out
mkmf.log
# Testing #
###########
.circleci/*
.codeclimate.yml
.delivery/*
.foodcritic
.kitchen*
.mdlrc
.overcommit.yml
.rspec
.rubocop.yml
.travis.yml
.watchr
.yamllint
azure-pipelines.yml
Dangerfile
examples/*
features/*
Guardfile
kitchen.yml*
mlc_config.json
Procfile
Rakefile
spec/*
@ -70,6 +75,7 @@ test/*
.gitconfig
.github/*
.gitignore
.gitkeep
.gitmodules
.svn
*/.bzr/*
@ -95,12 +101,13 @@ Gemfile.lock
Policyfile.rb
Policyfile.lock.json
# Cookbooks #
# Documentation #
#############
CHANGELOG*
CONTRIBUTING*
TESTING*
CODE_OF_CONDUCT*
CONTRIBUTING*
documentation/*
TESTING*
UPGRADING*
# Vagrant #
###########

0
documentation/.gitkeep Normal file
View File

View File

@ -1,79 +1,73 @@
---
driver:
name: dokken
privileged: true # because Docker and SystemD/Upstart
privileged: true # because Docker and SystemD
chef_version: <%= ENV['CHEF_VERSION'] || 'current' %>
chef_license: accept-no-persist
env: [CHEF_LICENSE=accept]
transport:
name: dokken
provisioner:
name: dokken
deprecations_as_errors: true
verifier:
name: inspec
platforms:
- name: amazonlinux
driver:
image: dokken/amazonlinux
pid_one_command: /sbin/init
- name: amazonlinux-2
driver:
image: dokken/amazonlinux-2
pid_one_command: /usr/lib/systemd/systemd
- name: amazonlinux-2
driver:
image: dokken/amazonlinux-2
pid_one_command: /usr/lib/systemd/systemd
- name: debian-9
driver:
image: dokken/debian-9
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: debian-9
driver:
image: dokken/debian-9
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: debian-10
driver:
image: dokken/debian-10
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: debian-10
driver:
image: dokken/debian-10
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: centos-7
driver:
image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd
- name: centos-6
driver:
image: dokken/centos-6
pid_one_command: /sbin/init
- name: centos-8
driver:
image: dokken/centos-8
pid_one_command: /usr/lib/systemd/systemd
- name: centos-7
driver:
image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd
- name: fedora-latest
driver:
image: dokken/fedora-latest
pid_one_command: /usr/lib/systemd/systemd
- name: centos-8
driver:
image: dokken/centos-8
pid_one_command: /usr/lib/systemd/systemd
- name: ubuntu-16.04
driver:
image: dokken/ubuntu-16.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: fedora-latest
driver:
image: dokken/fedora-latest
pid_one_command: /usr/lib/systemd/systemd
- name: ubuntu-18.04
driver:
image: dokken/ubuntu-18.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: ubuntu-16.04
driver:
image: dokken/ubuntu-16.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: ubuntu-20.04
driver:
image: dokken/ubuntu-20.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: ubuntu-18.04
driver:
image: dokken/ubuntu-18.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: opensuse-leap-15
driver:
image: dokken/opensuse-leap-15
pid_one_command: /bin/systemd
- name: opensuse-leap-15
driver:
image: dokken/opensuse-leap-15
pid_one_command: /bin/systemd

View File

@ -1,92 +1,89 @@
---
driver:
name: vagrant
provisioner:
name: chef_zero
product_name: chef
enforce_idempotency: true
multiple_converge: 2
deprecations_as_errors: true
chef_license: accept-no-persist
verifier:
name: inspec
platforms:
- name: amazonlinux
driver_config:
box: mvbcoding/awslinux
- name: amazonlinux-2
- name: centos-6
- name: centos-7
- name: centos-8
- name: debian-9
run_list: apt::default
- name: debian-10
run_list: apt::default
- name: fedora-latest
- name: opensuse-leap-15
- name: ubuntu-16.04
run_list: apt::default
- name: ubuntu-18.04
run_list: apt::default
- name: ubuntu-20.04
suites:
- name: default
run_list:
- recipe[postfix]
- name: default
run_list:
- recipe[postfix]
- name: aliases
run_list:
- recipe[postfix::aliases]
- name: aliases
run_list:
- recipe[postfix::aliases]
- name: client
run_list:
- recipe[postfix::client]
- name: client
run_list:
- recipe[postfix::client]
- name: server
run_list:
- recipe[postfix::server]
- name: server
run_list:
- recipe[postfix::server]
- name: canonical
run_list:
- recipe[postfix]
attributes:
postfix:
recipient_canonical_map_entries:
john: john@doe.com
- name: canonical
run_list:
- recipe[test::net_setup]
- recipe[postfix]
attributes:
postfix:
recipient_canonical_map_entries:
john: john@doe.com
- name: sasl_auth_none
run_list:
- recipe[postfix::sasl_auth]
attributes:
postfix:
main:
relayhost: "localhost"
smtp_sasl_auth_enable: "yes"
- name: sasl_auth_none
run_list:
- recipe[postfix::sasl_auth]
attributes:
postfix:
main:
relayhost: "localhost"
smtp_sasl_auth_enable: "yes"
- name: sasl_auth_multiple
run_list:
- recipe[postfix::sasl_auth]
attributes:
postfix:
main:
relayhost: "localhost"
smtp_sasl_auth_enable: "yes"
sasl:
relayhost1:
username: "kitchenuser"
password: "not-a-real-thing"
relayhost2:
username: "anotherkitchenuser"
password: "yet-not-a-real-thing"
- name: sasl_auth_multiple
run_list:
- recipe[postfix::sasl_auth]
attributes:
postfix:
main:
relayhost: "localhost"
smtp_sasl_auth_enable: "yes"
sasl:
relayhost1:
username: "kitchenuser"
password: "not-a-real-thing"
relayhost2:
username: "anotherkitchenuser"
password: "yet-not-a-real-thing"
- name: sasl_auth_one
run_list:
- recipe[postfix::sasl_auth]
attributes:
postfix:
main:
relayhost: "localhost"
smtp_sasl_auth_enable: "yes"
sasl:
relayhost:
username: "kitchenuser"
password: "not-a-real-thing"
- name: sasl_auth_one
run_list:
- recipe[postfix::sasl_auth]
attributes:
postfix:
main:
relayhost: "localhost"
smtp_sasl_auth_enable: "yes"
sasl:
relayhost:
username: "kitchenuser"
password: "not-a-real-thing"

View File

@ -1,14 +1,20 @@
name 'postfix'
maintainer 'Chef Software, Inc.'
maintainer_email 'cookbooks@chef.io'
license 'Apache-2.0'
description 'Installs and configures postfix for client or outbound relayhost, or to do SASL auth'
version '5.3.1'
name 'postfix'
maintainer 'Sous Chefs'
maintainer_email 'help@sous-chefs.org'
license 'Apache-2.0'
description 'Installs and configures postfix for client or outbound relayhost, or to do SASL auth'
version '5.4.1'
source_url 'https://github.com/sous-chefs/postfix'
issues_url 'https://github.com/sous-chefs/postfix/issues'
chef_version '>= 12.15'
%w(ubuntu debian redhat centos amazon oracle scientific smartos fedora freebsd).each do |os|
supports os
end
source_url 'https://github.com/chef-cookbooks/postfix'
issues_url 'https://github.com/chef-cookbooks/postfix/issues'
chef_version '>= 12.15'
supports 'amazon'
supports 'centos'
supports 'debian'
supports 'fedora'
supports 'freebsd'
supports 'oracle'
supports 'redhat'
supports 'scientific'
supports 'smartos'
supports 'ubuntu'

View File

@ -2,7 +2,7 @@
# Cookbook:: common
# Recipe:: default
#
# Copyright:: 2009-2019, Chef Software, Inc.
# Copyright:: 2009-2020, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -19,7 +19,14 @@
include_recipe 'postfix::_attributes'
package node['postfix']['packages']
# use multi-package when we can
if node['os'] == 'linux'
package node['postfix']['packages']
else
node['postfix']['packages'].each do |pkg|
package pkg
end
end
package 'procmail' if node['postfix']['use_procmail']
@ -35,6 +42,8 @@ when 'rhel', 'fedora', 'amazon'
notifies :start, 'service[postfix]'
not_if '/usr/bin/test /etc/alternatives/mta -ef /usr/sbin/sendmail.postfix'
end
when 'suse'
file '/var/adm/postfix.configured'
when 'omnios'
manifest_path = ::File.join(Chef::Config[:file_cache_path], 'manifest-postfix.xml')
@ -122,11 +131,11 @@ unless node['postfix']['sender_canonical_map_entries'].empty?
owner 'root'
group node['root_group']
mode '0644'
notifies :run, 'execute[update-postfix-sender_canonical]'
notifies :run, 'execute[update-postfix-sender_canonical]', :immediately
notifies :reload, 'service[postfix]'
end
node.normal['postfix']['main']['sender_canonical_maps'] = "hash:#{node['postfix']['conf_dir']}/sender_canonical" unless node['postfix']['main'].key?('sender_canonical_maps')
node.default['postfix']['main']['sender_canonical_maps'] = "hash:#{node['postfix']['conf_dir']}/sender_canonical" unless node['postfix']['main'].key?('sender_canonical_maps')
end
execute 'update-postfix-smtp_generic' do
@ -139,11 +148,11 @@ unless node['postfix']['smtp_generic_map_entries'].empty?
owner 'root'
group node['root_group']
mode '0644'
notifies :run, 'execute[update-postfix-smtp_generic]'
notifies :run, 'execute[update-postfix-smtp_generic]', :immediately
notifies :reload, 'service[postfix]'
end
node.normal['postfix']['main']['smtp_generic_maps'] = "hash:#{node['postfix']['conf_dir']}/smtp_generic" unless node['postfix']['main'].key?('smtp_generic_maps')
node.default['postfix']['main']['smtp_generic_maps'] = "hash:#{node['postfix']['conf_dir']}/smtp_generic" unless node['postfix']['main'].key?('smtp_generic_maps')
end
execute 'update-postfix-recipient_canonical' do
@ -156,11 +165,11 @@ unless node['postfix']['recipient_canonical_map_entries'].empty?
owner 'root'
group node['root_group']
mode '0644'
notifies :run, 'execute[update-postfix-recipient_canonical]'
notifies :run, 'execute[update-postfix-recipient_canonical]', :immediately
notifies :reload, 'service[postfix]'
end
node.normal['postfix']['main']['recipient_canonical_maps'] = "hash:#{node['postfix']['conf_dir']}/recipient_canonical" unless node['postfix']['main'].key?('recipient_canonical_maps')
node.default['postfix']['main']['recipient_canonical_maps'] = "hash:#{node['postfix']['conf_dir']}/recipient_canonical" unless node['postfix']['main'].key?('recipient_canonical_maps')
end
%w( main master ).each do |cfg|

View File

@ -23,5 +23,5 @@ end
template node['postfix']['access_db'] do
source 'access.erb'
notifies :run, 'execute[update-postfix-access]'
notifies :run, 'execute[update-postfix-access]', :immediately
end

View File

@ -25,5 +25,5 @@ end
template node['postfix']['aliases_db'] do
source 'aliases.erb'
notifies :run, 'execute[update-postfix-aliases]'
notifies :run, 'execute[update-postfix-aliases]', :immediately
end

View File

@ -39,6 +39,6 @@ else
relayhost = results.map { |n| n['ipaddress'] }.first
end
node.normal['postfix']['main']['relayhost'] = "[#{relayhost}]#{relayhost_port}"
node.default['postfix']['main']['relayhost'] = "[#{relayhost}]#{relayhost_port}"
include_recipe 'postfix'

View File

@ -1,4 +1,3 @@
# encoding: utf-8
# Copyright:: 2012-2019, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -25,5 +25,5 @@ end
template node['postfix']['relay_restrictions_db'] do
source 'relay_restrictions.erb'
notifies :run, 'execute[update-postfix-relay-restrictions]'
notifies :run, 'execute[update-postfix-relay-restrictions]', :immediately
end

View File

@ -28,11 +28,7 @@ case node['platform_family']
when 'debian'
sasl_pkgs = %w(libsasl2-2 libsasl2-modules ca-certificates)
when 'rhel'
sasl_pkgs = if node['platform_version'].to_i < 6
%w(cyrus-sasl cyrus-sasl-plain openssl)
else
%w(cyrus-sasl cyrus-sasl-plain ca-certificates)
end
sasl_pkgs = %w(cyrus-sasl cyrus-sasl-plain ca-certificates)
when 'amazon'
sasl_pkgs = %w(cyrus-sasl cyrus-sasl-plain ca-certificates)
when 'fedora'

View File

@ -25,5 +25,5 @@ end
template node['postfix']['transport_db'] do
source 'transport.erb'
notifies :run, 'execute[update-postfix-transport]'
notifies :run, 'execute[update-postfix-transport]', :immediately
end

View File

@ -23,6 +23,6 @@ end
template node['postfix']['virtual_alias_db'] do
source 'virtual_aliases.erb'
notifies :run, 'execute[update-postfix-virtual-alias]'
notifies :run, 'execute[update-postfix-virtual-alias]', :immediately
notifies :restart, 'service[postfix]'
end

View File

@ -23,6 +23,6 @@ end
template node['postfix']['virtual_alias_domains_db'] do
source 'virtual_aliases_domains.erb'
notifies :run, 'execute[update-postfix-virtual-alias-domains]'
notifies :run, 'execute[update-postfix-virtual-alias-domains]', :immediately
notifies :restart, 'service[postfix]'
end

View File

@ -5,9 +5,9 @@ describe 'postfix::default' do
stub_command('/usr/bin/test /etc/alternatives/mta -ef /usr/sbin/sendmail.postfix').and_return(true)
end
context 'on Centos 6' do
context 'on Centos 8' do
cached(:chef_run) do
ChefSpec::SoloRunner.new(platform: 'centos', version: 6.9).converge(described_recipe)
ChefSpec::SoloRunner.new(platform: 'centos', version: '8').converge(described_recipe)
end
it '[COOK-4423] renders file main.cf with /etc/pki/tls/cert.pem' do

View File

@ -0,0 +1,3 @@
sysctl 'net.ipv6.conf.lo.disable_ipv6' do
value 0
end

View File

@ -1,4 +1,3 @@
# encoding: utf-8
# Copyright:: 2012-2019, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,4 +1,3 @@
# encoding: utf-8
# Copyright:: 2012-2019, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");