-
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly fix aliases quoting logic (#206)
We were previously incorrectly adding double quotes for the alias values. According to the man page it's not required. However, there is a requirement if its a command being pipe. In addition, the man page mentions this for the alias name: The name is a local address (no domain part). Use double quotes when the name contains any special characters such as whitespace, `#', `:', or `@'. The name is folded to lowercase, in order to make database lookups case insensitive. This includes logic to support this automatically. - Add new tests for aliases testing all types - Convert all serverspec tests to inspec - Add Github actions - Update platforms to test Signed-off-by: Lance Albertson <lance@osuosl.org>
- Loading branch information
Showing
30 changed files
with
224 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
name: ci | ||
|
||
"on": | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint-unit: | ||
uses: sous-chefs/.github/.github/workflows/lint-unit.yml@3.0.0 | ||
permissions: | ||
actions: write | ||
checks: write | ||
pull-requests: write | ||
statuses: write | ||
|
||
integration: | ||
needs: 'lint-unit' | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
os: | ||
- almalinux-8 | ||
- almalinux-9 | ||
- amazonlinux-2023 | ||
- centos-stream-9 | ||
- debian-11 | ||
- debian-12 | ||
- opensuse-leap-15 | ||
- rockylinux-8 | ||
- rockylinux-9 | ||
- ubuntu-2004 | ||
- ubuntu-2204 | ||
- ubuntu-2404 | ||
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@v4 # v4 | ||
- name: Install Chef | ||
uses: actionshub/chef-install@2.0.4 | ||
- name: Dokken | ||
uses: actionshub/test-kitchen@2.1.0 | ||
env: | ||
CHEF_LICENSE: accept-no-persist | ||
KITCHEN_LOCAL_YAML: kitchen.dokken.yml | ||
with: | ||
suite: ${{ matrix.suite }} | ||
os: ${{ matrix.os }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# sysctl missing on SUSE | ||
package 'procps' if platform_family?('suse') | ||
|
||
sysctl 'net.ipv6.conf.lo.disable_ipv6' do | ||
value 0 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
control 'aliases' do | ||
describe file '/etc/aliases' do | ||
its('content') do | ||
should cmp <<~EOF | ||
# | ||
# Auto-generated by Chef. | ||
# Local modifications will be overwritten. | ||
# | ||
# See man 5 aliases for format | ||
postmaster: root | ||
foo1: bar | ||
"foo@bar": foo | ||
foo2: "|/usr/bin/bar" | ||
foo3: foo,bar | ||
foo4: foo@example.com | ||
foo5: foo,bar | ||
EOF | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name: aliases |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
recipient_canonical = | ||
case os.family | ||
when 'suse' | ||
'/etc/postfix/recipient_canonical.lmdb' | ||
else | ||
'/etc/postfix/recipient_canonical.db' | ||
end | ||
|
||
control 'canonical' do | ||
describe file recipient_canonical do | ||
it { should be_file } | ||
end | ||
|
||
describe file '/etc/postfix/main.cf' do | ||
its('content') { should match(%r{^\s*recipient_canonical_maps\s*=.*\/etc\/postfix\/recipient_canonical\s*$}) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name: canonical |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
include_controls 'default' | ||
|
||
control 'client' do | ||
describe file '/etc/postfix/main.cf' do | ||
its('content') { should match /Configured as client/ } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name: client | ||
depends: | ||
- name: default | ||
path: test/integration/default |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
control 'default' do | ||
describe package 'postfix' do | ||
it { should be_installed } | ||
end | ||
|
||
describe service 'postfix' do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
|
||
describe file '/etc/postfix/main.cf' do | ||
its('content') { should match(/^# Auto-generated by Chef/) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name: default |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
test/integration/sasl_auth_multiple/controls/sasl_auth_multiple.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
control 'sasl_auth_multiple' do | ||
describe file '/etc/postfix/sasl_passwd' do | ||
its('content') do | ||
should cmp <<~EOF | ||
# Auto-generated by Chef. | ||
# Local modifications will be overwritten. | ||
relayhost1 kitchenuser:not-a-real-thing | ||
relayhost2 anotherkitchenuser:yet-not-a-real-thing | ||
smtp_sasl_passwd : | ||
smtp_sasl_user_name : | ||
EOF | ||
end | ||
end | ||
|
||
describe postfix_conf '/etc/postfix/main.cf' do | ||
its('smtp_sasl_password_maps') { should eq 'hash:/etc/postfix/sasl_passwd' } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name: sasl_auth_multiple |
Oops, something went wrong.