diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dd810a5..5ca71ff7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the ntp cookbook. ## Unreleased +Since ubuntu 23.10[Mantic Minotaur] the ntp user is ntpsec + ## 5.2.2 - *2024-07-15* Update ntpd package for Enterprise Linux 9 (ie Oracle, Rocky, Alma) diff --git a/attributes/default.rb b/attributes/default.rb index 40a49a3b..098e5934 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -47,6 +47,9 @@ if platform?('debian') && node['platform_version'].to_i >= 12 default['ntp']['var_owner'] = 'ntpsec' default['ntp']['var_group'] = 'ntpsec' +elsif platform?('ubuntu') && Gem::Version.new(node['platform_version']) >= Gem::Version.new('23.10') + default['ntp']['var_owner'] = 'ntpsec' + default['ntp']['var_group'] = 'ntpsec' else default['ntp']['var_owner'] = 'ntp' default['ntp']['var_group'] = 'ntp' diff --git a/files/usr.sbin.ntpd.apparmor b/files/usr.sbin.ntpd.apparmor index a9eb5a9d..3988c41b 100644 --- a/files/usr.sbin.ntpd.apparmor +++ b/files/usr.sbin.ntpd.apparmor @@ -58,6 +58,8 @@ /etc/ntp.keys r, /etc/ntp/** r, + /etc/ntpsec/** r, + /etc/ntp.drift rwl, /etc/ntp.drift.TEMP rwl, /etc/ntp/drift* rwl, diff --git a/spec/unit/attributes_spec.rb b/spec/unit/attributes_spec.rb index 8e720711..a1e693d1 100644 --- a/spec/unit/attributes_spec.rb +++ b/spec/unit/attributes_spec.rb @@ -209,6 +209,18 @@ end end + describe 'on Ubuntu >= 23.10' do + let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '24.04').converge('ntp::default') } + + it 'sets the var_owner to ntpsec' do + expect(ntp['var_owner']).to eq('ntpsec') + end + + it 'sets the var_group to ntpsec' do + expect(ntp['var_group']).to eq('ntpsec') + end + end + describe 'on the CentOS 7 platform' do cached(:chef_run) { ChefSpec::SoloRunner.new(platform: 'centos', version: '7').converge('ntp::default') }