-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Author: Scott Lampert <[email protected]>
- Add fix for ntp.leapseconds apparmor error Fixes [COOK-3023]
- Loading branch information
Charles Johnson
committed
Oct 24, 2013
1 parent
ba2102d
commit 72ba36f
Showing
8 changed files
with
158 additions
and
14 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
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# vim:syntax=apparmor | ||
# | ||
# Maintained by Chef | ||
# | ||
# Updated for Ubuntu by: Jamie Strandboge <[email protected]> | ||
# ------------------------------------------------------------------ | ||
# | ||
# Copyright (C) 2002-2005 Novell/SUSE | ||
# Copyright (C) 2009-2012 Canonical Ltd. | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of version 2 of the GNU General Public | ||
# License published by the Free Software Foundation. | ||
# | ||
# ------------------------------------------------------------------ | ||
|
||
#include <tunables/global> | ||
#include <tunables/ntpd> | ||
/usr/sbin/ntpd { | ||
#include <abstractions/base> | ||
#include <abstractions/nameservice> | ||
#include <abstractions/user-tmp> | ||
|
||
capability ipc_lock, | ||
capability net_bind_service, | ||
capability setgid, | ||
capability setuid, | ||
capability sys_chroot, | ||
capability sys_resource, | ||
capability sys_time, | ||
capability sys_nice, | ||
|
||
network inet dgram, | ||
network inet6 dgram, | ||
network inet stream, | ||
network inet6 stream, | ||
|
||
@{PROC}/net/if_inet6 r, | ||
@{PROC}/*/net/if_inet6 r, | ||
@{NTPD_DEVICE} rw, | ||
|
||
/usr/sbin/ntpd rmix, | ||
|
||
/etc/ntp.conf r, | ||
/etc/ntp.conf.dhcp r, | ||
/etc/ntpd.conf r, | ||
/etc/ntpd.conf.tmp r, | ||
/var/lib/ntp/ntp.conf.dhcp r, | ||
|
||
/etc/ntp.leapseconds r, | ||
|
||
/etc/ntp.keys r, | ||
/etc/ntp/** r, | ||
|
||
/etc/ntp.drift rwl, | ||
/etc/ntp.drift.TEMP rwl, | ||
/etc/ntp/drift* rwl, | ||
/var/lib/ntp/*drift rw, | ||
/var/lib/ntp/*drift.TEMP rw, | ||
|
||
/var/log/ntp w, | ||
/var/log/ntp.log w, | ||
/var/log/ntpd w, | ||
/var/log/ntpstats/clockstats* rwl, | ||
/var/log/ntpstats/loopstats* rwl, | ||
/var/log/ntpstats/peerstats* rwl, | ||
/var/log/ntpstats/rawstats* rwl, | ||
/var/log/ntpstats/sysstats* rwl, | ||
|
||
/{,var/}run/ntpd.pid w, | ||
|
||
# samba4 ntp signing socket | ||
/{,var/}run/samba/ntp_signd/socket rw, | ||
|
||
# For use with clocks that report via shared memory (e.g. gpsd), | ||
# you may need to give ntpd access to all of shared memory, though | ||
# this can be considered dangerous. See https://launchpad.net/bugs/722815 | ||
# for details. To enable, add this to local/usr.sbin.ntpd: | ||
# capability ipc_owner, | ||
|
||
# Site-specific additions and overrides. See local/README for details. | ||
#include <local/usr.sbin.ntpd> | ||
} |
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,30 @@ | ||
# | ||
# Cookbook Name:: ntp | ||
# Recipe:: apparmor | ||
# Author:: Scott Lampert (<[email protected]>) | ||
# | ||
# Copyright 2013, Scott Lampert | ||
# | ||
# 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. | ||
|
||
service 'apparmor' do | ||
action :nothing | ||
end | ||
|
||
cookbook_file '/etc/apparmor.d/usr.sbin.ntpd' do | ||
source 'usr.sbin.ntpd.apparmor' | ||
owner 'root' | ||
group 'root' | ||
mode '0644' | ||
notifies :restart, 'service[apparmor]' | ||
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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'spec_helper' | ||
|
||
describe 'ntp::apparmor' do | ||
let(:chef_run) { ChefSpec::ChefRunner.new.converge('recipe[ntp::apparmor]') } | ||
|
||
it 'creates the apparmor file' do | ||
expect(chef_run).to create_cookbook_file '/etc/apparmor.d/usr.sbin.ntpd' | ||
file = chef_run.cookbook_file('/etc/apparmor.d/usr.sbin.ntpd') | ||
expect(file).to be_owned_by('root', 'root') | ||
end | ||
|
||
it 'restarts the apparmor service' do | ||
chef_run.cookbook_file('/etc/apparmor.d/usr.sbin.ntpd').should notify('service[apparmor]', :restart) | ||
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