Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ntpsec user/group for Ubuntu >= 23.10 #254

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 2 additions & 0 deletions files/usr.sbin.ntpd.apparmor
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 12 additions & 0 deletions spec/unit/attributes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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') }

Expand Down
Loading