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>
This commit is contained in:
Lance Albertson
2025-01-29 14:51:57 -08:00
committed by GitHub
parent 6cb80c3be7
commit 1cd55ab40d
30 changed files with 224 additions and 250 deletions

View File

@@ -0,0 +1,17 @@
control 'sasl_auth_none' do
describe file '/etc/postfix/sasl_passwd' do
its('content') do
should cmp <<~EOF
# Auto-generated by Chef.
# Local modifications will be overwritten.
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

View File

@@ -0,0 +1 @@
name: sasl_auth_none

View File

@@ -1,31 +0,0 @@
# Copyright:: 2012-2019, 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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.
#
require_relative './spec_helper'
describe 'postfix::sasl_auth' do
let(:sasl_passwd_file) { '/etc/postfix/sasl_passwd' }
it 'manages postfix sasl_passwd' do
expect(file(sasl_passwd_file).content).to match(/^# Auto-generated by Chef/)
end
it 'configures postfix to use the sasl_passwd file' do
expect(file('/etc/postfix/main.cf').content).to match(/^\s*smtp_sasl_password_maps\s*=.*#{sasl_passwd_file}\s*$/)
end
it 'configures postfix sasl_passwd with nothing in it' do
expect(file(sasl_passwd_file).content).to match(/^# This file is generated by Chef for .*\n/)
end
end