Commit fa2f200a authored by Mickaël Canévet's avatar Mickaël Canévet
Browse files

Merge pull request #98 from mremy/master

Use RHEL SELinux type for /etc/aliases
parents ca91225b a6700444
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ class postfix::files {
    content => "# file managed by puppet\n",
    notify  => Exec['newaliases'],
    replace => false,
    seltype => $postfix::params::seltype,
    seltype => $postfix::params::aliasesseltype,
  }

  # Aliases
+7 −0
Original line number Diff line number Diff line
class postfix::params {
  case $::osfamily {
    'RedHat': {
      $aliasesseltype = $::operatingsystemmajrelease ? {
        '4'     => 'etc_t',
        /5/     => 'postfix_etc_t',
        /6|7/   => 'etc_aliases_t',
        default => undef,
      }

      $seltype = $::operatingsystemmajrelease ? {
        '4'     => 'etc_t',
        /5|6|7/ => 'postfix_etc_t',
+11 −1
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ describe 'postfix' do
            ) }
        else
          it { is_expected.to contain_file('/etc/mailname').with_seltype('postfix_etc_t').with_content("foo.example.com\n") }
          it { is_expected.to contain_file('/etc/aliases').with_seltype('postfix_etc_t').with_content("# file managed by puppet\n") }
          it { is_expected.to contain_file('/etc/postfix/master.cf').with_seltype('postfix_etc_t') }
          it { is_expected.to contain_file('/etc/postfix/main.cf').with_seltype('postfix_etc_t') }

@@ -45,6 +44,7 @@ describe 'postfix' do

          case facts[:operatingsystemmajrelease]
          when '7'
            it { is_expected.to contain_file('/etc/aliases').with_seltype('etc_aliases_t').with_content("# file managed by puppet\n") }
            it {
              is_expected.to contain_service('postfix').with(
                :ensure    => 'running',
@@ -52,7 +52,17 @@ describe 'postfix' do
                :hasstatus => 'true',
                :restart   => '/bin/systemctl reload postfix'
              ) }
          when '6'
            it { is_expected.to contain_file('/etc/aliases').with_seltype('etc_aliases_t').with_content("# file managed by puppet\n") }
            it {
              is_expected.to contain_service('postfix').with(
                :ensure    => 'running',
                :enable    => 'true',
                :hasstatus => 'true',
                :restart   => '/etc/init.d/postfix reload'
              ) }
          else
            it { is_expected.to contain_file('/etc/aliases').with_seltype('postfix_etc_t').with_content("# file managed by puppet\n") }
            it {
              is_expected.to contain_service('postfix').with(
                :ensure    => 'running',