puppetlabs-ntp-4.1.1/000755 000766 000024 00000000000 12625175233 014740 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/CHANGELOG.md000644 000766 000024 00000016052 12625175216 016556 0ustar00bmjenstaff000000 000000 ## Supported Release 4.1.1 ### Summary This is a bugfix release to address security vulnerability CVE-2013-5211. #### Bugfixes - Changes the default behavior to disable monitoring as part of the solution for CVE-2013-5211. ## 2015-07-21 - Supported Release 4.1.0 ### Summary This release updates metadata to support new version of puppet enterprise, as well as new features, bugfixes, and test improvements. #### Features - Adds Solaris 10 support - Adds Fedora 20, 21, 22 compatibility #### Bugfixes - Fix default configuration for Debian (MODULES-2087) - Fix to ensure log file is created before service starts - Fixes SLES params for SLES 10, 11, 12 ## 2015-05-26 - Supported Release 4.0.0 ### Summary This release drops puppet 2.7 support and older stdlib support. It also includes the addition of 12 new properties, as well as numerous bug fixes and other improvements. #### Backwards-incompatible changes - UDLC (Undisciplined local clock) is now no longer enabled by default on anything (previous was enabled on non-virtual). - Puppet 2.7 no longer supported - puppetlabs-stdlib less than 4.5.0 no longer supported #### Features - Readme, Metadata, and Contribution documentation improvements - Acceptance test improvements - Added the `broadcastclient` property - Added the `disable_auth` property - Added `broadcastclient` property - Added `disable_auth` property - Added `fudge` property - Added `peers` property - Added `udlc_stratum` property - Added `tinker` property - Added `minpoll` property - Added `maxpoll` property - Added `stepout` property - Added `leapfile` property #### Bugfixes - Removing equal sign as delimiter in ntp.conf for the logfile parameter. - Add package_manage parameter, which is set to false by default on FreeBSD - Fixed an issue with the `is_virtual` property - Fixed debian wheezy issue - Fix for Redhat to disable ntp restart due to dhcp ntp server updates ##2014-11-04 - Supported Release 3.3.0 ###Summary This release adds support for SLES 12. ####Features - Added support for SLES 12 ##2014-10-02 - Supported Release 3.2.1 ###Summary This is a bug-fix release addressing the security concerns of setting /etc/ntp to mode 0755 recursively. ####Bugfixes - Do not recursively set ownership/mode of /etc/ntp ##2014-09-10 - Supported Release 3.2.0 ###Summary This is primarily a feature release. It adds a few new parameters to class `ntp` and adds support for Solaris 11. ####Features - Add the `$interfaces` parameter to `ntp` - Add support for Solaris 10 and 11 - Synchronized files with modulesync - Test updates - Add the `$iburst_enable` parameter to `ntp` ####Bugfixes - Fixes for strict variables - Remove dependency on stdlib4 ##2014-06-06 - Release 3.1.2 ###Summary This is a supported release. This release fixes a manifest typo. ##2014-06-06 - Release 3.1.1 ###Summary This is a bugfix release to get around dependency issues in PMT 3.6. This version has a dependency on puppetlabs-stdlib >= 4 so PE3.2.x is no longer supported. ####Bugfixes - Remove deprecated Modulefile as it was causing duplicate dependencies with PMT. ##2014-05-14 - Release 3.1.0 ###Summary This release adds `disable_monitor` so you can disable the monitor functionality of NTP, which was recently used in NTP amplification attacks. It also adds support for RHEL7 and Ubuntu 14.04. ####Features - Add `disable_monitor` ####Bugfixes #####Known Bugs * No known bugs ##2014-04-09 - Supported Release 3.0.4 ###Summary This is a supported release. The only functional change in this release is to split up the restrict defaults to be per operating system so that we can provide safer defaults for AIX, to resolve cases where IPv6 are disabled. ####Features - Rework restrict defaults. ####Bugfixes - Fix up a comment. - Fix a test to work better on PE. #####Known Bugs * No known bugs ##2014-03-04 - Supported Release 3.0.3 ###Summary This is a supported release. Correct stdlib compatibility ####Bugfixes - Remove `dirname()` call for correct stdlib compatibility. - Improved tests ####Known Bugs * No known bugs ## 2014-02-13 - Release 3.0.2 ###Summary No functional changes: Update the README and allow custom gem sources. ## 2013-12-17 - Release 3.0.1 ### Summary Work around a packaging bug with symlinks, no other functional changes. ## 2013-12-13 - Release 3.0.0 ### Summary Final release of 3.0, enjoy! ## 2013-10-14 - Version 3.0.0-rc1 ###Summary This release changes the behavior of restrict and adds AIX osfamily support. ####Backwards-incompatible Changes: `restrict` no longer requires you to pass in parameters as: restrict => [ 'restrict x', 'restrict y' ] but just as: restrict => [ 'x', 'y' ] As the template now prefixes each line with restrict. ####Features - Change the behavior of `restrict` so you no longer need the restrict keyword. - Add `udlc` parameter to enable undisciplined local clock regardless of the machines status as a virtual machine. - Add AIX support. ####Fixes - Use class{} instead of including and then anchoring. (style) - Extend Gentoo coverage to Facter 1.7. --- ##2013-09-05 - Version 2.0.1 ###Summary Correct the LICENSE file. ####Bugfixes - Add in the appropriate year and name in LICENSE. ##2013-07-31 - Version 2.0.0 ###Summary The 2.0 release focuses on merging all the distro specific templates into a single reusable template across all platforms. To aid in that goal we now allow you to change the driftfile, ntp keys, and perferred_servers. ####Backwards-incompatible changes As all the distro specific templates have been removed and a unified one created you may be missing functionality you previously relied on. Please test carefully before rolling out globally. Configuration directives that might possibly be affected: - `filegen` - `fudge` (for virtual machines) - `keys` - `logfile` - `restrict` - `restrictkey` - `statistics` - `trustedkey` ####Features: - All templates merged into a single template. - NTP Keys support added. - Add preferred servers support. - Parameters in `ntp` class: - `driftfile`: path for the ntp driftfile. - `keys_enable`: Enable NTP keys feature. - `keys_file`: Path for the NTP keys file. - `keys_trusted`: Which keys to trust. - `keys_controlkey`: Which key to use for the control key. - `keys_requestkey`: Which key to use for the request key. - `preferred_servers`: Array of servers to prefer. - `restrict`: Array of restriction options to apply. --- ###2013-07-15 - Version 1.0.1 ####Bugfixes - Fix deprecated warning in `autoupdate` parameter. - Correctly quote is_virtual fact. ##2013-07-08 - Version 1.0.0 ####Features - Completely refactored to split across several classes. - rspec-puppet tests rewritten to cover more options. - rspec-system tests added. - ArchLinux handled via osfamily instead of special casing. - parameters in `ntp` class: - `autoupdate`: deprecated in favor of directly setting package_ensure. - `panic`: set to false if you wish to allow large clock skews. --- ##2011-11-10 Dan Bode - 0.0.4 * Add Amazon Linux as a supported platform * Add unit tests ##2011-06-16 Jeff McCune - 0.0.3 * Initial release under puppetlabs puppetlabs-ntp-4.1.1/checksums.json000644 000766 000024 00000006060 12625175233 017622 0ustar00bmjenstaff000000 000000 { "CHANGELOG.md": "de3c459d0c249ceae8db35a98638f166", "CONTRIBUTING.md": "e2b8e8e433fc76b3798b7fe435f49375", "Gemfile": "e6e6eb07f0bfc9bb1e328895ca49b3f5", "LICENSE": "f0b6fdc310531526f257378d7bad0044", "README.markdown": "e46b936e8a0157df45ef309cee743321", "Rakefile": "d953eb985f82600dc3b9ac6e1f2cfe64", "lib/puppet/parser/functions/ntp_dirname.rb": "109e37ef3261f95ae19fcbccb280042d", "manifests/config.pp": "2df5fe992ff94d9e07356323f257fc68", "manifests/init.pp": "23521935af954259edfa52b187fe4d69", "manifests/install.pp": "853d4da4189e06aa4d34bb6b4c85cafc", "manifests/params.pp": "5b7824167c27895d9d3fbfaec431eda0", "manifests/service.pp": "201d71e9052f6d6960c435ca2b25e32c", "metadata.json": "b6df8e23769a89e6b5e79be65c1c721b", "spec/acceptance/class_spec.rb": "5c23f02ba486f3efd0cab3933ae35027", "spec/acceptance/disable_monitoring_spec.rb": "48c7b847c936ad7609b022d49f560348", "spec/acceptance/nodesets/centos-59-x64.yml": "57eb3e471b9042a8ea40978c467f8151", "spec/acceptance/nodesets/centos-64-x64-pe.yml": "ec075d95760df3d4702abea1ce0a829b", "spec/acceptance/nodesets/centos-64-x64.yml": "092dd2c588a9f87fa1fb12997c0723ef", "spec/acceptance/nodesets/centos-65-x64.yml": "3e5c36e6aa5a690229e720f4048bb8af", "spec/acceptance/nodesets/default.yml": "092dd2c588a9f87fa1fb12997c0723ef", "spec/acceptance/nodesets/fedora-18-x64.yml": "80e41b1ee16ea489f53164bfdae58855", "spec/acceptance/nodesets/fedora-21-x64.yml": "2743fddcdb44a531095cd990e6827e7a", "spec/acceptance/nodesets/sles-11-x64.yml": "44e4c6c15c018333bfa9840a5e702f66", "spec/acceptance/nodesets/sles-12-64.yml": "d3ebd30c7bfd1785c9dac1cd3985ec47", "spec/acceptance/nodesets/ubuntu-server-10044-x64.yml": "75e86400b7889888dc0781c0ae1a1297", "spec/acceptance/nodesets/ubuntu-server-12042-x64.yml": "d30d73e34cd50b043c7d14e305955269", "spec/acceptance/nodesets/ubuntu-server-1404-x64.yml": "5f0aed10098ac5b78e4217bb27c7aaf0", "spec/acceptance/nodesets/ubuntu-server-14042-x64.yml": "0d09228a22009fdc1c2191624615c933", "spec/acceptance/ntp_config_spec.rb": "edbace14948865cb42a039c70227dde0", "spec/acceptance/ntp_install_spec.rb": "af677fe15707b4855eb608a38764c452", "spec/acceptance/ntp_parameters_spec.rb": "00d214bb9ca0b0fda1ad70096c96b7e1", "spec/acceptance/ntp_service_spec.rb": "d23648818cb2cb79a1cde5ff6cb7bce4", "spec/acceptance/preferred_servers_spec.rb": "7ece249e784fa5eb0bedfead9b41a85f", "spec/acceptance/restrict_spec.rb": "f4cbe9a4a750cef409d69d11758d24d7", "spec/acceptance/unsupported_spec.rb": "46473b42539794169b7d5c6a0b10f089", "spec/classes/ntp_spec.rb": "5c2d1021f0c0b40f0529c537bdbd7ff8", "spec/spec.opts": "a600ded995d948e393fbe2320ba8e51c", "spec/spec_helper.rb": "94d340a9699e5ec2d1f2d1217635e749", "spec/spec_helper_acceptance.rb": "21e8ec77078cbcf2c2ed5b952d047b0f", "spec/unit/puppet/provider/README.markdown": "e52668944ee6af2fb5d5b9e798342645", "spec/unit/puppet/type/README.markdown": "de26a7643813abd6c2e7e28071b1ef94", "templates/ntp.conf.erb": "b2466668ac0672af6e5d91e51448623e", "tests/init.pp": "d398e7687ec1d893ef23d1b7d2afc094" }puppetlabs-ntp-4.1.1/CONTRIBUTING.md000644 000766 000024 00000017435 12625174641 017205 0ustar00bmjenstaff000000 000000 Checklist (and a short version for the impatient) ================================================= * Commits: - Make commits of logical units. - Check for unnecessary whitespace with "git diff --check" before committing. - Commit using Unix line endings (check the settings around "crlf" in git-config(1)). - Do not check in commented out code or unneeded files. - The first line of the commit message should be a short description (50 characters is the soft limit, excluding ticket number(s)), and should skip the full stop. - Associate the issue in the message. The first line should include the issue number in the form "(#XXXX) Rest of message". - The body should provide a meaningful commit message, which: - uses the imperative, present tense: "change", not "changed" or "changes". - includes motivation for the change, and contrasts its implementation with the previous behavior. - Make sure that you have tests for the bug you are fixing, or feature you are adding. - Make sure the test suites passes after your commit: `bundle exec rspec spec/acceptance` More information on [testing](#Testing) below - When introducing a new feature, make sure it is properly documented in the README.md * Submission: * Pre-requisites: - Make sure you have a [GitHub account](https://github.com/join) - [Create a ticket](https://tickets.puppetlabs.com/secure/CreateIssue!default.jspa), or [watch the ticket](https://tickets.puppetlabs.com/browse/) you are patching for. * Preferred method: - Fork the repository on GitHub. - Push your changes to a topic branch in your fork of the repository. (the format ticket/1234-short_description_of_change is usually preferred for this project). - Submit a pull request to the repository in the puppetlabs organization. The long version ================ 1. Make separate commits for logically separate changes. Please break your commits down into logically consistent units which include new or changed tests relevant to the rest of the change. The goal of doing this is to make the diff easier to read for whoever is reviewing your code. In general, the easier your diff is to read, the more likely someone will be happy to review it and get it into the code base. If you are going to refactor a piece of code, please do so as a separate commit from your feature or bug fix changes. We also really appreciate changes that include tests to make sure the bug is not re-introduced, and that the feature is not accidentally broken. Describe the technical detail of the change(s). If your description starts to get too long, that is a good sign that you probably need to split up your commit into more finely grained pieces. Commits which plainly describe the things which help reviewers check the patch and future developers understand the code are much more likely to be merged in with a minimum of bike-shedding or requested changes. Ideally, the commit message would include information, and be in a form suitable for inclusion in the release notes for the version of Puppet that includes them. Please also check that you are not introducing any trailing whitespace or other "whitespace errors". You can do this by running "git diff --check" on your changes before you commit. 2. Sending your patches To submit your changes via a GitHub pull request, we _highly_ recommend that you have them on a topic branch, instead of directly on "master". It makes things much easier to keep track of, especially if you decide to work on another thing before your first change is merged in. GitHub has some pretty good [general documentation](http://help.github.com/) on using their site. They also have documentation on [creating pull requests](http://help.github.com/send-pull-requests/). In general, after pushing your topic branch up to your repository on GitHub, you can switch to the branch in the GitHub UI and click "Pull Request" towards the top of the page in order to open a pull request. 3. Update the related GitHub issue. If there is a GitHub issue associated with the change you submitted, then you should update the ticket to include the location of your branch, along with any other commentary you may wish to make. Testing ======= Getting Started --------------- Our puppet modules provide [`Gemfile`](./Gemfile)s which can tell a ruby package manager such as [bundler](http://bundler.io/) what Ruby packages, or Gems, are required to build, develop, and test this software. Please make sure you have [bundler installed](http://bundler.io/#getting-started) on your system, then use it to install all dependencies needed for this project, by running ```shell % bundle install Fetching gem metadata from https://rubygems.org/........ Fetching gem metadata from https://rubygems.org/.. Using rake (10.1.0) Using builder (3.2.2) -- 8><-- many more --><8 -- Using rspec-system-puppet (2.2.0) Using serverspec (0.6.3) Using rspec-system-serverspec (1.0.0) Using bundler (1.3.5) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. ``` NOTE some systems may require you to run this command with sudo. If you already have those gems installed, make sure they are up-to-date: ```shell % bundle update ``` With all dependencies in place and up-to-date we can now run the tests: ```shell % rake spec ``` This will execute all the [rspec tests](http://rspec-puppet.com/) tests under [spec/defines](./spec/defines), [spec/classes](./spec/classes), and so on. rspec tests may have the same kind of dependencies as the module they are testing. While the module defines in its [Modulefile](./Modulefile), rspec tests define them in [.fixtures.yml](./fixtures.yml). Some puppet modules also come with [beaker](https://github.com/puppetlabs/beaker) tests. These tests spin up a virtual machine under [VirtualBox](https://www.virtualbox.org/)) with, controlling it with [Vagrant](http://www.vagrantup.com/) to actually simulate scripted test scenarios. In order to run these, you will need both of those tools installed on your system. You can run them by issuing the following command ```shell % rake spec_clean % rspec spec/acceptance ``` This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml), install puppet, copy this module and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb) and then run all the tests under [spec/acceptance](./spec/acceptance). Writing Tests ------------- XXX getting started writing tests. If you have commit access to the repository =========================================== Even if you have commit access to the repository, you will still need to go through the process above, and have someone else review and merge in your changes. The rule is that all changes must be reviewed by a developer on the project (that did not write the code) to ensure that all changes go through a code review process. Having someone other than the author of the topic branch recorded as performing the merge is the record that they performed the code review. Additional Resources ==================== * [Getting additional help](http://puppetlabs.com/community/get-help) * [Writing tests](http://projects.puppetlabs.com/projects/puppet/wiki/Development_Writing_Tests) * [Patchwork](https://patchwork.puppetlabs.com) * [General GitHub documentation](http://help.github.com/) * [GitHub pull request documentation](http://help.github.com/send-pull-requests/) puppetlabs-ntp-4.1.1/Gemfile000644 000766 000024 00000002477 12625174641 016247 0ustar00bmjenstaff000000 000000 source ENV['GEM_SOURCE'] || "https://rubygems.org" def location_for(place, fake_version = nil) if place =~ /^(git:[^#]*)#(.*)/ [fake_version, { :git => $1, :branch => $2, :require => false }].compact elsif place =~ /^file:\/\/(.*)/ ['>= 0', { :path => File.expand_path($1), :require => false }] else [place, { :require => false }] end end group :development, :unit_tests do gem 'rspec-core', '3.1.7', :require => false gem 'puppetlabs_spec_helper', :require => false gem 'simplecov', :require => false gem 'puppet_facts', :require => false gem 'json', :require => false end group :system_tests do if beaker_version = ENV['BEAKER_VERSION'] gem 'beaker', *location_for(beaker_version) end if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] gem 'beaker-rspec', *location_for(beaker_rspec_version) else gem 'beaker-rspec', :require => false end gem 'serverspec', :require => false gem 'beaker-puppet_install_helper', :require => false end if facterversion = ENV['FACTER_GEM_VERSION'] gem 'facter', facterversion, :require => false else gem 'facter', :require => false end if puppetversion = ENV['PUPPET_GEM_VERSION'] gem 'puppet', puppetversion, :require => false else gem 'puppet', :require => false end # vim:ft=ruby puppetlabs-ntp-4.1.1/lib/000755 000766 000024 00000000000 12625175233 015506 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/LICENSE000644 000766 000024 00000026122 12625174641 015752 0ustar00bmjenstaff000000 000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [2013] [Puppet Labs] 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. puppetlabs-ntp-4.1.1/manifests/000755 000766 000024 00000000000 12625175233 016731 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/metadata.json000644 000766 000024 00000004101 12625175233 017407 0ustar00bmjenstaff000000 000000 { "name": "puppetlabs-ntp", "version": "4.1.1", "author": "Puppet Labs", "summary": "Installs, configures, and manages the NTP service.", "license": "Apache Version 2.0", "source": "https://github.com/puppetlabs/puppetlabs-ntp", "project_page": "https://github.com/puppetlabs/puppetlabs-ntp", "issues_url": "https://tickets.puppetlabs.com/browse/MODULES", "dependencies": [ {"name":"puppetlabs/stdlib","version_requirement":">= 4.6.0 < 5.0.0"} ], "data_provider": null, "operatingsystem_support": [ { "operatingsystem": "RedHat", "operatingsystemrelease": [ "5", "6", "7" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ "5", "6", "7" ] }, { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ "5", "6", "7" ] }, { "operatingsystem": "Scientific", "operatingsystemrelease": [ "5", "6", "7" ] }, { "operatingsystem": "Fedora", "operatingsystemrelease": [ "20", "21", "22" ] }, { "operatingsystem": "SLES", "operatingsystemrelease": [ "10 SP4", "11 SP1", "12" ] }, { "operatingsystem": "Debian", "operatingsystemrelease": [ "6", "7" ] }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "10.04", "12.04", "14.04" ] }, { "operatingsystem": "Solaris", "operatingsystemrelease": [ "11" ] }, { "operatingsystem": "AIX", "operatingsystemrelease": [ "5.3", "6.1", "7.1" ] } ], "requirements": [ { "name": "pe", "version_requirement": ">= 3.7.0 < 2015.3.0" }, { "name": "puppet", "version_requirement": ">= 3.0.0 < 5.0.0" } ], "description": "NTP Module for Debian, Ubuntu, CentOS, RHEL, OEL, Fedora, FreeBSD, ArchLinux and Gentoo." } puppetlabs-ntp-4.1.1/Rakefile000644 000766 000024 00000000766 12625174641 016420 0ustar00bmjenstaff000000 000000 require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' PuppetLint.configuration.fail_on_warnings = true PuppetLint.configuration.send('relative') PuppetLint.configuration.send('disable_80chars') PuppetLint.configuration.send('disable_class_inherits_from_params_class') PuppetLint.configuration.send('disable_documentation') PuppetLint.configuration.send('disable_single_quote_string_with_variables') PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] puppetlabs-ntp-4.1.1/README.markdown000644 000766 000024 00000023411 12625175216 017443 0ustar00bmjenstaff000000 000000 #ntp ####Table of Contents 1. [Overview](#overview) 2. [Module Description - What the module does and why it is useful](#module-description) 3. [Setup - The basics of getting started with ntp](#setup) 4. [Usage - Configuration options and additional functionality](#usage) 5. [Reference - An under-the-hood peek at what the module is doing and how](#reference) 5. [Limitations - OS compatibility, etc.](#limitations) 6. [Development - Guide for contributing to the module](#development) ##Overview The ntp module installs, configures, and manages the NTP service. ##Module Description The ntp module handles installing, configuring, and running NTP across a range of operating systems and distributions. ##Setup ###Beginning with ntp `include '::ntp'` is enough to get you up and running. If you wish to pass in parameters specifying which servers to use, then: ```puppet class { '::ntp': servers => [ 'ntp1.corp.com', 'ntp2.corp.com' ], } ``` ##Usage All interaction with the ntp module can be done through the main ntp class. This means you can simply toggle the options in `::ntp` to have full functionality of the module. ###I just want NTP, what's the minimum I need? ```puppet include '::ntp' ``` ###I just want to tweak the servers, nothing else. ```puppet class { '::ntp': servers => [ 'ntp1.corp.com', 'ntp2.corp.com' ], } ``` ###I'd like to make sure I restrict who can connect as well. ```puppet class { '::ntp': servers => [ 'ntp1.corp.com', 'ntp2.corp.com' ], restrict => ['127.0.0.1'], } ``` ###I just want to install a client that can't be queried ```puppet class { '::ntp': servers => ['ntp1.corp.com', 'ntp2.corp.com'], restrict => [ 'default ignore', '-6 default ignore', '127.0.0.1', '-6 ::1', 'ntp1.corp.com nomodify notrap nopeer noquery', 'ntp1.corp.com nomodify notrap nopeer noquery' ], } ``` ###I only want to listen on specific interfaces, not on 0.0.0.0 Restricting ntp to a specific interface is especially useful on Openstack nodes which may have numerous virtual interfaces. ```puppet class { '::ntp': servers => [ 'ntp1.corp.com', 'ntp2.corp.com' ], interfaces => ['127.0.0.1', '1.2.3.4'] } ``` ###I'd like to opt out of having the service controlled; we use another tool for that. ```puppet class { '::ntp': servers => [ 'ntp1.corp.com', 'ntp2.corp.com' ], restrict => ['127.0.0.1'], service_manage => false, } ``` ###I'd like to configure and run ntp, but I don't need to install it. ```puppet class { '::ntp': package_manage => false, } ``` ###Looks great! But I'd like a different template; we need to do something unique here. ```puppet class { '::ntp': servers => [ 'ntp1.corp.com', 'ntp2.corp.com' ], restrict => ['127.0.0.1'], service_manage => false, config_template => 'different/module/custom.template.erb', } ``` ##Reference ###Classes ####Public Classes * ntp: Main class, includes all other classes. ####Private Classes * ntp::install: Handles the packages. * ntp::config: Handles the configuration file. * ntp::service: Handles the service. ###Parameters The following parameters are available in the `::ntp` class: ####`autoupdate` **Deprecated; replaced by the `package_ensure` parameter**. Tells Puppet whether to keep the ntp module updated to the latest version available. Valid options: 'true' or 'false'. Default value: 'false' ####`broadcastclient` Enable reception of broadcast server messages to any local interface. ####`config` Specifies a file for ntp's configuration info. Valid options: string containing an absolute path. Default value: '/etc/ntp.conf' (or '/etc/inet/ntp.conf' on Solaris) ####`config_template` Specifies a file to act as a template for the config file. Valid options: string containing a path (absolute, or relative to the module path). Default value: 'ntp/ntp.conf.erb' ####`disable_auth` Do not require cryptographic authentication for broadcast client, multicast client and symmetric passive associations. ####`disable_monitor` Disables the monitoring facility in NTP. Valid options: 'true' or 'false'. Default value: 'true' ####`driftfile` Specifies an NTP driftfile. Valid options: string containing an absolute path. Default value: '/var/lib/ntp/drift' (except on AIX and Solaris) #### `fudge` Used to provide additional information for individual clock drivers. Valid options: array containing strings that follow the `fudge` command. Default value: [ ] ####`iburst_enable` Specifies whether to enable the iburst option for every NTP peer. Valid options: 'true' or 'false'. Default value: 'false' (except on AIX and Debian) ####`interfaces` Specifies one or more network interfaces for NTP to listen on. Valid options: array. Default value: [ ] ####`keys_controlkey` Provides a control key to be used by NTP. Valid options: string. Default value: ' ' ####`keys_enable` Tells Puppet whether to enable key-based authentication. Valid options: 'true' or 'false'. Default value: 'false' ####`keys_file` Specifies an NTP keys file. Valid options: string containing an absolute path. Default value: '/etc/ntp/keys' (except on AIX, SLES, and Solaris) ####`keys_requestkey` Provides a request key to be used by NTP. Valid options: string. Default value: ' ' #### `keys_trusted`: Provides one or more keys to be trusted by NTP. Valid options: array of keys. Default value: [ ] #### `leapfile` Specifies a leap second file for NTP to use. Valid options: string containing an absolute path. Default value: ' ' #### `logfile` Specifies a log file for NTP to use instead of syslog. Valid options: string containing an absolute path. Default value: ' ' ####`minpoll` Tells Puppet to use non-standard minimal poll interval of upstream servers. Valid options: 3 to 16. Default option: undef. ####`maxpoll` Tells Puppet to use non-standard maximal poll interval of upstream servers. Valid options: 3 to 16. Default option: undef, except FreeBSD (on FreeBSD `maxpoll` set 9 by default). ####`package_ensure` Tells Puppet whether the NTP package should be installed, and what version. Valid options: 'present', 'latest', or a specific version number. Default value: 'present' ####`package_manage` Tells Puppet whether to manage the NTP package. Valid options: 'true' or 'false'. Default value: 'true' ####`package_name` Tells Puppet what NTP package to manage. Valid options: string. Default value: 'ntp' (except on AIX and Solaris) ####`panic` Specifies whether NTP should "panic" in the event of a very large clock skew. Applies only if `tinker` option set to "true" or in case your environment is in virtual machine. Valid options: unsigned shortint digit. Default value: 0 if environment is virtual, undef in all other cases. ####`peers` List of ntp servers which the local clock can be synchronised against, or which can synchronise against the local clock. ####`preferred_servers` Specifies one or more preferred peers. Puppet will append 'prefer' to each matching item in the `servers` array. Valid options: array. Default value: [ ] ####`restrict` Specifies one or more `restrict` options for the NTP configuration. Puppet will prefix each item with 'restrict', so you only need to list the content of the restriction. Valid options: array. Default value for most operating systems: ~~~~ [ 'default kod nomodify notrap nopeer noquery', '-6 default kod nomodify notrap nopeer noquery', '127.0.0.1', '-6 ::1', ] ~~~~ Default value for AIX systems: ~~~~ [ 'default nomodify notrap nopeer noquery', '127.0.0.1', ] ~~~~ ####`servers` Specifies one or more servers to be used as NTP peers. Valid options: array. Default value: varies by operating system ####`service_enable` Tells Puppet whether to enable the NTP service at boot. Valid options: 'true' or 'false'. Default value: 'true' ####`service_ensure` Tells Puppet whether the NTP service should be running. Valid options: 'running' or 'stopped'. Default value: 'running' ####`service_manage` Tells Puppet whether to manage the NTP service. Valid options: 'true' or 'false'. Default value: 'true' ####`service_name` Tells Puppet what NTP service to manage. Valid options: string. Default value: varies by operating system ####`stepout` Tells puppet to change stepout. Applies only if `tinker` value is 'true'. Valid options: unsigned shortint digit. Default value: undef. ####`tinker` Tells Puppet to enable tinker options. Valid options: 'true' of 'false'. Default value: 'false' ####`udlc` Specifies whether to configure ntp to use the undisciplined local clock as a time source. Valid options: 'true' or 'false'. Default value: 'false' ####`udlc_stratum` Specifies the stratum the server should operate at when using the undisciplined local clock as the time source. It is strongly suggested that this value be set to no less than 10 where ntpd may be accessible outside your immediate, controlled network. Default value: 10 ##Limitations This module has been tested on [all PE-supported platforms](https://forge.puppetlabs.com/supported#compat-matrix), and no issues have been identified. Additionally, it is tested (but not supported) on Solaris 10 and Fedora 20-22. ##Development Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve. We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. For more information, see our [module contribution guide.](https://docs.puppetlabs.com/forge/contributing.html) ###Contributors To see who's already involved, see the [list of contributors.](https://github.com/puppetlabs/puppetlabs-ntp/graphs/contributors) puppetlabs-ntp-4.1.1/spec/000755 000766 000024 00000000000 12625175233 015672 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/templates/000755 000766 000024 00000000000 12625175233 016736 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/tests/000755 000766 000024 00000000000 12625175233 016102 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/tests/init.pp000644 000766 000024 00000000267 12625174641 017415 0ustar00bmjenstaff000000 000000 node default { notify { 'enduser-before': } notify { 'enduser-after': } class { 'ntp': require => Notify['enduser-before'], before => Notify['enduser-after'], } } puppetlabs-ntp-4.1.1/templates/ntp.conf.erb000644 000766 000024 00000005014 12625175216 021156 0ustar00bmjenstaff000000 000000 # ntp.conf: Managed by puppet. # <% if @tinker == true and (@panic or @stepout) -%> # Enable next tinker options: # panic - keep ntpd from panicking in the event of a large clock skew # when a VM guest is suspended and resumed; # stepout - allow ntpd change offset faster tinker<% if @panic -%> panic <%= @panic %><% end %><% if @stepout -%> stepout <%= @stepout %><% end %> <% end -%> <% if @disable_monitor == true -%> disable monitor <% end -%> <% if @disable_auth == true -%> disable auth <% end -%> <% if @restrict != [] -%> # Permit time synchronization with our time source, but do not # permit the source to query or modify the service on this system. <% @restrict.flatten.each do |restrict| -%> restrict <%= restrict %> <% end -%> <% end -%> <% if @interfaces != [] -%> # Ignore wildcard interface and only listen on the following specified # interfaces interface ignore wildcard <% @interfaces.flatten.each do |interface| -%> interface listen <%= interface %> <% end -%> <% end -%> <% if @broadcastclient == true -%> broadcastclient <% end -%> # Set up servers for ntpd with next options: # server - IP address or DNS name of upstream NTP server # iburst - allow send sync packages faster if upstream unavailable # prefer - select preferrable server # minpoll - set minimal update frequency # maxpoll - set maximal update frequency <% [@servers].flatten.each do |server| -%> server <%= server %><% if @iburst_enable == true -%> iburst<% end %><% if @preferred_servers.include?(server) -%> prefer<% end %><% if @minpoll -%> minpoll <%= @minpoll %><% end %><% if @maxpoll -%> maxpoll <%= @maxpoll %><% end %> <% end -%> <% if @udlc -%> # Undisciplined Local Clock. This is a fake driver intended for backup # and when no outside source of synchronized time is available. server 127.127.1.0 fudge 127.127.1.0 stratum <%= @udlc_stratum %> restrict 127.127.1.0 <% end -%> # Driftfile. driftfile <%= @driftfile %> <% unless @logfile.nil? -%> # Logfile logfile <%= @logfile %> <% end -%> <% unless @peers.empty? -%> # Peers <% [@peers].flatten.each do |peer| -%> peer <%= peer %> <% end -%> <% end -%> <% if @keys_enable -%> keys <%= @keys_file %> <% unless @keys_trusted.empty? -%> trustedkey <%= @keys_trusted.join(' ') %> <% end -%> <% if @keys_requestkey != '' -%> requestkey <%= @keys_requestkey %> <% end -%> <% if @keys_controlkey != '' -%> controlkey <%= @keys_controlkey %> <% end -%> <% end -%> <% [@fudge].flatten.each do |entry| -%> fudge <%= entry %> <% end -%> <% unless @leapfile.nil? -%> # Leapfile leapfile <%= @leapfile %> <% end -%> puppetlabs-ntp-4.1.1/spec/acceptance/000755 000766 000024 00000000000 12625175233 017760 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/spec/classes/000755 000766 000024 00000000000 12625175233 017327 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/spec/spec.opts000644 000766 000024 00000000057 12625174641 017537 0ustar00bmjenstaff000000 000000 --format s --colour --loadby mtime --backtrace puppetlabs-ntp-4.1.1/spec/spec_helper.rb000644 000766 000024 00000001320 12625175216 020505 0ustar00bmjenstaff000000 000000 require 'puppetlabs_spec_helper/module_spec_helper' RSpec.configure do |c| c.include PuppetlabsSpec::Files c.before :each do # Ensure that we don't accidentally cache facts and environment # between test cases. Facter::Util::Loader.any_instance.stubs(:load_all) Facter.clear Facter.clear_messages # Store any environment variables away to be restored later @old_env = {} ENV.each_key {|k| @old_env[k] = ENV[k]} if Gem::Version.new(`puppet --version`) >= Gem::Version.new('3.5') Puppet.settings[:strict_variables]=true end if ENV['PARSER'] Puppet.settings[:parser]=ENV['PARSER'] end end c.after :each do PuppetlabsSpec::Files.cleanup end end puppetlabs-ntp-4.1.1/spec/spec_helper_acceptance.rb000644 000766 000024 00000003757 12625174641 022674 0ustar00bmjenstaff000000 000000 require 'beaker-rspec' require 'beaker/puppet_install_helper' UNSUPPORTED_PLATFORMS = ['windows', 'Darwin'] unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' run_puppet_install_helper hosts.each do |host| # Solaris 11 doesn't ship the SSL CA root for the forgeapi server # therefore we need to use a different way to deploy the module to # the host if host['platform'] =~ /solaris-11/i apply_manifest_on(host, 'package { "git": }') # PE 3.x and 2015.2 require different locations to install modules modulepath = host.puppet['modulepath'] modulepath = modulepath.split(':').first if modulepath environmentpath = host.puppet['environmentpath'] environmentpath = environmentpath.split(':').first if environmentpath destdir = modulepath || "#{environmentpath}/production/modules" on host, "git clone -b 4.6.0 https://github.com/puppetlabs/puppetlabs-stdlib #{destdir}/stdlib" else on host, puppet('module install puppetlabs-stdlib') end # Need to disable update of ntp servers from DHCP, as subsequent restart of ntp causes test failures if fact_on(host, 'osfamily') == 'Debian' on host, 'dpkg-divert --divert /etc/dhcp-ntp.bak --local --rename --add /etc/dhcp/dhclient-exit-hooks.d/ntp' on host, 'dpkg-divert --divert /etc/dhcp3-ntp.bak --local --rename --add /etc/dhcp3/dhclient-exit-hooks.d/ntp' elsif fact_on(host, 'osfamily') == 'RedHat' on host, 'echo "PEERNTP=no" >> /etc/sysconfig/network' end end end RSpec.configure do |c| # Project root proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) # Readable test descriptions c.formatter = :documentation # Configure all nodes in nodeset c.before :suite do hosts.each do |host| on host, "mkdir -p #{host['distmoduledir']}/ntp" %w(lib manifests templates metadata.json).each do |file| scp_to host, "#{proj_root}/#{file}", "#{host['distmoduledir']}/ntp" end end end end puppetlabs-ntp-4.1.1/spec/unit/000755 000766 000024 00000000000 12625175233 016651 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/spec/unit/puppet/000755 000766 000024 00000000000 12625175233 020166 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/spec/unit/puppet/provider/000755 000766 000024 00000000000 12625175233 022020 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/spec/unit/puppet/type/000755 000766 000024 00000000000 12625175233 021147 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/spec/unit/puppet/type/README.markdown000644 000766 000024 00000000141 12625174641 023646 0ustar00bmjenstaff000000 000000 Resource Type Specs =================== Define specs for your resource types in this directory. puppetlabs-ntp-4.1.1/spec/unit/puppet/provider/README.markdown000644 000766 000024 00000000125 12625174641 024521 0ustar00bmjenstaff000000 000000 Provider Specs ============== Define specs for your providers under this directory. puppetlabs-ntp-4.1.1/spec/classes/ntp_spec.rb000644 000766 000024 00000051014 12625175216 021471 0ustar00bmjenstaff000000 000000 require 'spec_helper' describe 'ntp' do let(:facts) {{ :is_virtual => 'false' }} ['Debian', 'RedHat', 'Fedora', 'Suse', 'FreeBSD', 'Archlinux', 'Gentoo', 'Gentoo (Facter < 1.7)'].each do |system| context "when on system #{system}" do if system == 'Gentoo (Facter < 1.7)' let :facts do super().merge({ :osfamily => 'Linux', :operatingsystem => 'Gentoo' }) end elsif system == 'Suse' let :facts do super().merge({ :osfamily => system,:operatingsystem => 'SLES',:operatingsystemmajrelease => '11' }) end elsif system == 'Fedora' let :facts do super().merge({ :osfamily => 'RedHat', :operatingsystem => system ,:operatingsystemmajrelease => '22' }) end else let :facts do super().merge({ :osfamily => system }) end end it { should contain_class('ntp::install') } it { should contain_class('ntp::config') } it { should contain_class('ntp::service') } describe "ntp::config on #{system}" do it { should contain_file('/etc/ntp.conf').with_owner('0') } it { should contain_file('/etc/ntp.conf').with_group('0') } it { should contain_file('/etc/ntp.conf').with_mode('0644') } describe 'allows template to be overridden' do let(:params) {{ :config_template => 'my_ntp/ntp.conf.erb' }} it { should contain_file('/etc/ntp.conf').with({ 'content' => /server foobar/}) } end describe "keys for osfamily #{system}" do context "when enabled" do let(:params) {{ :keys_enable => true, :keys_file => '/etc/ntp/ntp.keys', :keys_trusted => ['1', '2', '3'], :keys_controlkey => '2', :keys_requestkey => '3', }} it { should contain_file('/etc/ntp').with({ 'ensure' => 'directory'}) } it { should contain_file('/etc/ntp.conf').with({ 'content' => /trustedkey 1 2 3/}) } it { should contain_file('/etc/ntp.conf').with({ 'content' => /controlkey 2/}) } it { should contain_file('/etc/ntp.conf').with({ 'content' => /requestkey 3/}) } end end context "when disabled" do let(:params) {{ :keys_enable => false, :keys_file => '/etc/ntp/ntp.keys', :keys_trusted => ['1', '2', '3'], :keys_controlkey => '2', :keys_requestkey => '3', }} it { should_not contain_file('/etc/ntp').with({ 'ensure' => 'directory'}) } it { should_not contain_file('/etc/ntp.conf').with({ 'content' => /trustedkey 1 2 3/}) } it { should_not contain_file('/etc/ntp.conf').with({ 'content' => /controlkey 2/}) } it { should_not contain_file('/etc/ntp.conf').with({ 'content' => /requestkey 3/}) } end describe 'preferred servers' do context "when set" do let(:params) {{ :servers => ['a', 'b', 'c', 'd'], :preferred_servers => ['a', 'b'], :iburst_enable => false, }} it { should contain_file('/etc/ntp.conf').with({ 'content' => /server a prefer( maxpoll 9)?\nserver b prefer( maxpoll 9)?\nserver c( maxpoll 9)?\nserver d( maxpoll 9)?/}) } end context "when not set" do let(:params) {{ :servers => ['a', 'b', 'c', 'd'], :preferred_servers => [] }} it { should_not contain_file('/etc/ntp.conf').with({ 'content' => /server a prefer/}) } end end describe 'specified interfaces' do context "when set" do let(:params) {{ :servers => ['a', 'b', 'c', 'd'], :interfaces => ['127.0.0.1', 'a.b.c.d'] }} it { should contain_file('/etc/ntp.conf').with({ 'content' => /interface ignore wildcard\ninterface listen 127.0.0.1\ninterface listen a.b.c.d/}) } end context "when not set" do let(:params) {{ :servers => ['a', 'b', 'c', 'd'], }} it { should_not contain_file('/etc/ntp.conf').with({ 'content' => /interface ignore wildcard/}) } end end describe 'with parameter disable_auth' do context 'when set to true' do let(:params) {{ :disable_auth => true, }} it 'should contain disable auth setting' do should contain_file('/etc/ntp.conf').with({ 'content' => /^disable auth\n/, }) end end context 'when set to false' do let(:params) {{ :disable_auth => false, }} it 'should not contain disable auth setting' do should_not contain_file('/etc/ntp.conf').with({ 'content' => /^disable auth\n/, }) end end end describe 'with parameter disable_monitor' do context 'default' do let(:params) {{ }} it 'should contain disable monitor setting' do should contain_file('/etc/ntp.conf').with({ 'content' => /^disable monitor\n/, }) end end context 'when set to true' do let(:params) {{ :disable_monitor => true, }} it 'should contain disable monitor setting' do should contain_file('/etc/ntp.conf').with({ 'content' => /^disable monitor\n/, }) end end context 'when set to false' do let(:params) {{ :disable_monitor => false, }} it 'should not contain disable monitor setting' do should_not contain_file('/etc/ntp.conf').with({ 'content' => /^disable monitor\n/, }) end end end describe 'with parameter broadcastclient' do context 'when set to true' do let(:params) {{ :broadcastclient => true, }} it 'should contain broadcastclient setting' do should contain_file('/etc/ntp.conf').with({ 'content' => /^broadcastclient\n/, }) end end context 'when set to false' do let(:params) {{ :broadcastclient => false, }} it 'should not contain broadcastclient setting' do should_not contain_file('/etc/ntp.conf').with({ 'content' => /^broadcastclient\n/, }) end end end describe "ntp::install on #{system}" do let(:params) {{ :package_ensure => 'present', :package_name => ['ntp'], :package_manage => true, }} it { should contain_package('ntp').with( :ensure => 'present' )} describe 'should allow package ensure to be overridden' do let(:params) {{ :package_ensure => 'latest', :package_name => ['ntp'], :package_manage => true, }} it { should contain_package('ntp').with_ensure('latest') } end describe 'should allow the package name to be overridden' do let(:params) {{ :package_ensure => 'present', :package_name => ['hambaby'], :package_manage => true, }} it { should contain_package('hambaby') } end describe 'should allow the package to be unmanaged' do let(:params) {{ :package_manage => false, :package_name => ['ntp'], }} it { should_not contain_package('ntp') } end end describe 'ntp::service' do let(:params) {{ :service_manage => true, :service_enable => true, :service_ensure => 'running', :service_name => 'ntp' }} describe 'with defaults' do it { should contain_service('ntp').with( :enable => true, :ensure => 'running', :name => 'ntp' )} end describe 'service_ensure' do describe 'when overridden' do let(:params) {{ :service_name => 'ntp', :service_ensure => 'stopped' }} it { should contain_service('ntp').with_ensure('stopped') } end end describe 'service_manage' do let(:params) {{ :service_manage => false, :service_enable => true, :service_ensure => 'running', :service_name => 'ntpd', }} it 'when set to false' do should_not contain_service('ntp').with({ 'enable' => true, 'ensure' => 'running', 'name' => 'ntpd' }) end end end describe 'with parameter iburst_enable' do context 'when set to true' do let(:params) {{ :iburst_enable => true, }} it do should contain_file('/etc/ntp.conf').with({ 'content' => /iburst/, }) end end context 'when set to false' do let(:params) {{ :iburst_enable => false, }} it do should_not contain_file('/etc/ntp.conf').with({ 'content' => /iburst\n/, }) end end end describe 'with tinker parameter changed' do describe 'when set to false' do context 'when panic or stepout not overriden' do let(:params) {{ :tinker => false, }} it do should_not contain_file('/etc/ntp.conf').with({ 'content' => /^tinker /, }) end end context 'when panic overriden' do let(:params) {{ :tinker => false, :panic => 257, }} it do should_not contain_file('/etc/ntp.conf').with({ 'content' => /^tinker /, }) end end context 'when stepout overriden' do let(:params) {{ :tinker => false, :stepout => 5, }} it do should_not contain_file('/etc/ntp.conf').with({ 'content' => /^tinker /, }) end end context 'when panic and stepout overriden' do let(:params) {{ :tinker => false, :panic => 257, :stepout => 5, }} it do should_not contain_file('/etc/ntp.conf').with({ 'content' => /^tinker /, }) end end end describe 'when set to true' do context 'when only tinker set to true' do let(:params) {{ :tinker => true, }} it do should_not contain_file('/etc/ntp.conf').with({ 'content' => /^tinker /, }) end end context 'when panic changed' do let(:params) {{ :tinker => true, :panic => 257, }} it do should contain_file('/etc/ntp.conf').with({ 'content' => /^tinker panic 257\n/, }) end end context 'when stepout changed' do let(:params) {{ :tinker => true, :stepout => 5, }} it do should contain_file('/etc/ntp.conf').with({ 'content' => /^tinker stepout 5\n/, }) end end context 'when panic and stepout changed' do let(:params) {{ :tinker => true, :panic => 257, :stepout => 5, }} it do should contain_file('/etc/ntp.conf').with({ 'content' => /^tinker panic 257 stepout 5\n/, }) end end end end describe 'with parameters minpoll or maxpoll changed from default' do context 'when minpoll changed from default' do let(:params) {{ :minpoll => 3, }} it do should contain_file('/etc/ntp.conf').with({ 'content' => /minpoll 3/, }) end end context 'when maxpoll changed from default' do let(:params) {{ :maxpoll => 12, }} it do should contain_file('/etc/ntp.conf').with({ 'content' => /maxpoll 12\n/, }) end end context 'when minpoll and maxpoll changed from default simultaneously' do let(:params) {{ :minpoll => 3, :maxpoll => 12, }} it do should contain_file('/etc/ntp.conf').with({ 'content' => /minpoll 3 maxpoll 12\n/, }) end end end describe 'with parameter leapfile' do context 'when set to true' do let(:params) {{ :servers => ['a', 'b', 'c', 'd'], :leapfile => '/etc/leap-seconds.3629404800', }} it 'should contain leapfile setting' do should contain_file('/etc/ntp.conf').with({ 'content' => /^leapfile \/etc\/leap-seconds\.3629404800\n/, }) end end context 'when set to false' do let(:params) {{ :servers => ['a', 'b', 'c', 'd'], }} it 'should not contain a leapfile line' do should_not contain_file('/etc/ntp.conf').with({ 'content' => /leapfile /, }) end end end describe 'with parameter logfile' do context 'when set to true' do let(:params) {{ :servers => ['a', 'b', 'c', 'd'], :logfile => '/var/log/foobar.log', }} it 'should contain logfile setting' do should contain_file('/etc/ntp.conf').with({ 'content' => /^logfile \/var\/log\/foobar\.log\n/, }) end end context 'when set to false' do let(:params) {{ :servers => ['a', 'b', 'c', 'd'], }} it 'should not contain a logfile line' do should_not contain_file('/etc/ntp.conf').with({ 'content' => /logfile /, }) end end end describe 'peers' do context 'when empty' do let(:params) do { :peers => [] } end it 'should not contain a peer line' do should contain_file('/etc/ntp.conf').without_content(/^peer/) end end context 'set' do let(:params) do { :peers => ['foo', 'bar'], } end it 'should contain the peer lines' do should contain_file('/etc/ntp.conf').with_content(/peer foo/) should contain_file('/etc/ntp.conf').with_content(/peer bar/) end end end end end context 'ntp::config' do describe "for operating system Gentoo (Facter < 1.7)" do let :facts do super().merge({ :operatingsystem => 'Gentoo', :osfamily => 'Linux' }) end it 'uses the NTP pool servers by default' do should contain_file('/etc/ntp.conf').with({ 'content' => /server \d.gentoo.pool.ntp.org/, }) end end describe "on osfamily Gentoo" do let :facts do super().merge({ :osfamily => 'Gentoo' }) end it 'uses the NTP pool servers by default' do should contain_file('/etc/ntp.conf').with({ 'content' => /server \d.gentoo.pool.ntp.org/, }) end end describe "on osfamily Debian" do let :facts do super().merge({ :osfamily => 'debian' }) end it 'uses the debian ntp servers by default' do should contain_file('/etc/ntp.conf').with({ 'content' => /server \d.debian.pool.ntp.org iburst\n/, }) end end describe "on osfamily RedHat" do let :facts do super().merge({ :osfamily => 'RedHat' }) end it 'uses the redhat ntp servers by default' do should contain_file('/etc/ntp.conf').with({ 'content' => /server \d.centos.pool.ntp.org/, }) end end describe "on osfamily Suse" do let :facts do super().merge({ :osfamily => 'Suse', :operatingsystem => 'SLES',:operatingsystemmajrelease => '11' }) end it 'uses the opensuse ntp servers by default' do should contain_file('/etc/ntp.conf').with({ 'content' => /server \d.opensuse.pool.ntp.org/, }) end end describe "on osfamily FreeBSD" do let :facts do super().merge({ :osfamily => 'FreeBSD' }) end it 'uses the freebsd ntp servers by default' do should contain_file('/etc/ntp.conf').with({ 'content' => /server \d.freebsd.pool.ntp.org iburst maxpoll 9/, }) end end describe "on osfamily ArchLinux" do let :facts do super().merge({ :osfamily => 'ArchLinux' }) end it 'uses the ArchLinux NTP servers by default' do should contain_file('/etc/ntp.conf').with({ 'content' => /server \d.arch.pool.ntp.org/, }) end end describe "on osfamily Solaris and operatingsystemrelease 5.10" do let :facts do super().merge({ :osfamily => 'Solaris', :operatingsystemrelease => '5.10' }) end it 'uses the NTP pool servers by default' do should contain_file('/etc/inet/ntp.conf').with({ 'content' => /server \d.pool.ntp.org/, }) end end describe "on osfamily Solaris and operatingsystemrelease 5.11" do let :facts do super().merge({ :osfamily => 'Solaris', :operatingsystemrelease => '5.11' }) end it 'uses the NTP pool servers by default' do should contain_file('/etc/inet/ntp.conf').with({ 'content' => /server \d.pool.ntp.org/, }) end end describe "for operating system family unsupported" do let :facts do super().merge({ :osfamily => 'unsupported', }) end it { expect{ catalogue }.to raise_error( /The ntp module is not supported on an unsupported based system./ )} end end describe 'for virtual machines' do let :facts do super().merge({ :osfamily => 'Archlinux', :is_virtual => 'true' }) end it 'should not use local clock as a time source' do should_not contain_file('/etc/ntp.conf').with({ 'content' => /server.*127.127.1.0.*fudge.*127.127.1.0 stratum 10/, }) end it 'allows large clock skews' do should contain_file('/etc/ntp.conf').with({ 'content' => /tinker panic 0/, }) end end describe 'for physical machines' do let :facts do super().merge({ :osfamily => 'Archlinux', :is_virtual => 'false' }) end it 'disallows large clock skews' do should_not contain_file('/etc/ntp.conf').with({ 'content' => /tinker panic 0/, }) end end end end puppetlabs-ntp-4.1.1/spec/acceptance/class_spec.rb000644 000766 000024 00000001773 12625174641 022436 0ustar00bmjenstaff000000 000000 require 'spec_helper_acceptance' describe 'ntp class:', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do it 'should run successfully' do pp = "class { 'ntp': }" # Apply twice to ensure no errors the second time. apply_manifest(pp, :catch_failures => true) do |r| expect(r.stderr).not_to match(/error/i) end apply_manifest(pp, :catch_failures => true) do |r| expect(r.stderr).not_to eq(/error/i) expect(r.exit_code).to be_zero end end context 'service_ensure => stopped:' do it 'runs successfully' do pp = "class { 'ntp': service_ensure => stopped }" apply_manifest(pp, :catch_failures => true) do |r| expect(r.stderr).not_to match(/error/i) end end end context 'service_ensure => running:' do it 'runs successfully' do pp = "class { 'ntp': service_ensure => running }" apply_manifest(pp, :catch_failures => true) do |r| expect(r.stderr).not_to match(/error/i) end end end end puppetlabs-ntp-4.1.1/spec/acceptance/disable_monitoring_spec.rb000644 000766 000024 00000001616 12625174641 025175 0ustar00bmjenstaff000000 000000 require 'spec_helper_acceptance' if (fact('osfamily') == 'Solaris') config = '/etc/inet/ntp.conf' else config = '/etc/ntp.conf' end describe "ntp class with disable_monitor:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do context 'should run successfully' do pp = "class { 'ntp': disable_monitor => true }" it 'runs twice' do apply_manifest(pp, :catch_failures => true) apply_manifest(pp, :catch_changes => true) end describe file("#{config}") do its(:content) { should match('disable monitor') } end end context 'should run successfully' do pp = "class { 'ntp': disable_monitor => false }" it 'runs twice' do apply_manifest(pp, :catch_failures => true) apply_manifest(pp, :catch_changes => true) end describe file("#{config}") do its(:content) { should_not match('disable monitor') } end end end puppetlabs-ntp-4.1.1/spec/acceptance/nodesets/000755 000766 000024 00000000000 12625175233 021604 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/spec/acceptance/ntp_config_spec.rb000644 000766 000024 00000002070 12625174641 023446 0ustar00bmjenstaff000000 000000 require 'spec_helper_acceptance' case fact('osfamily') when 'FreeBSD' line = '0.freebsd.pool.ntp.org maxpoll 9 iburst' when 'Debian' line = '0.debian.pool.ntp.org iburst' when 'RedHat' case fact('operatingsystem') when 'Fedora' line = '0.fedora.pool.ntp.org' else line = '0.centos.pool.ntp.org' end when 'Suse' line = '0.opensuse.pool.ntp.org' when 'Gentoo' line = '0.gentoo.pool.ntp.org' when 'Linux' case fact('operatingsystem') when 'ArchLinux' line = '0.arch.pool.ntp.org' when 'Gentoo' line = '0.gentoo.pool.ntp.org' end when 'Solaris' line = '0.pool.ntp.org' when 'AIX' line = '0.debian.pool.ntp.org iburst' end if (fact('osfamily') == 'Solaris') config = '/etc/inet/ntp.conf' else config = '/etc/ntp.conf' end describe 'ntp::config class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do it 'sets up ntp.conf' do apply_manifest(%{ class { 'ntp': } }, :catch_failures => true) end describe file("#{config}") do it { should be_file } its(:content) { should match line } end end puppetlabs-ntp-4.1.1/spec/acceptance/ntp_install_spec.rb000644 000766 000024 00000001736 12625175216 023656 0ustar00bmjenstaff000000 000000 require 'spec_helper_acceptance' case fact('osfamily') when 'FreeBSD' packagename = 'net/ntp' when 'Gentoo' packagename = 'net-misc/ntp' when 'Linux' case fact('operatingsystem') when 'ArchLinux' packagename = 'ntp' when 'Gentoo' packagename = 'net-misc/ntp' end when 'AIX' packagename = 'bos.net.tcp.client' when 'Solaris' case fact('operatingsystemrelease') when '5.10' packagename = ['SUNWntpr','SUNWntpu'] when '5.11' packagename = 'service/network/ntp' end else if fact('operatingsystem') == 'SLES' and fact('operatingsystemmajrelease') == '12' servicename = 'ntpd' else servicename = 'ntp' end end describe 'ntp::install class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do it 'installs the package' do apply_manifest(%{ class { 'ntp': } }, :catch_failures => true) end Array(packagename).each do |package| describe package(package) do it { should be_installed } end end end puppetlabs-ntp-4.1.1/spec/acceptance/ntp_parameters_spec.rb000644 000766 000024 00000011611 12625175216 024344 0ustar00bmjenstaff000000 000000 require 'spec_helper_acceptance' case fact('osfamily') when 'FreeBSD' packagename = 'net/ntp' when 'Gentoo' packagename = 'net-misc/ntp' when 'Linux' case fact('operatingsystem') when 'ArchLinux' packagename = 'ntp' when 'Gentoo' packagename = 'net-misc/ntp' end when 'AIX' packagename = 'bos.net.tcp.client' when 'Solaris' case fact('operatingsystemrelease') when '5.10' packagename = ['SUNWntpr','SUNWntpu'] when '5.11' packagename = 'service/network/ntp' end else if fact('operatingsystem') == 'SLES' and fact('operatingsystemmajrelease') == '12' servicename = 'ntpd' else servicename = 'ntp' end end if (fact('osfamily') == 'Solaris') config = '/etc/inet/ntp.conf' else config = '/etc/ntp.conf' end describe "ntp class:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do it 'applies successfully' do pp = "class { 'ntp': }" apply_manifest(pp, :catch_failures => true) do |r| expect(r.stderr).not_to match(/error/i) end end describe 'autoconfig' do it 'raises a deprecation warning' do pp = "class { 'ntp': autoupdate => true }" apply_manifest(pp, :catch_failures => true) do |r| expect(r.stdout).to match(/autoupdate parameter has been deprecated and replaced with package_ensure/) end end end describe 'config' do it 'sets the ntp.conf location' do pp = "class { 'ntp': config => '/etc/antp.conf' }" apply_manifest(pp, :catch_failures => true) end describe file('/etc/antp.conf') do it { should be_file } end end describe 'config_template' do it 'sets up template' do modulepath = default['distmoduledir'] shell("mkdir -p #{modulepath}/test/templates") shell("echo 'testcontent' >> #{modulepath}/test/templates/ntp.conf") end it 'sets the ntp.conf location' do pp = "class { 'ntp': config_template => 'test/ntp.conf' }" apply_manifest(pp, :catch_failures => true) end describe file("#{config}") do it { should be_file } its(:content) { should match 'testcontent' } end end describe 'driftfile' do it 'sets the driftfile location' do pp = "class { 'ntp': driftfile => '/tmp/driftfile' }" apply_manifest(pp, :catch_failures => true) end describe file("#{config}") do it { should be_file } its(:content) { should match 'driftfile /tmp/driftfile' } end end describe 'keys' do it 'enables the key parameters' do pp = <<-EOS class { 'ntp': keys_enable => true, keys_file => '/etc/ntp/keys', keys_controlkey => '/etc/ntp/controlkey', keys_requestkey => '1', keys_trusted => [ '1', '2' ], } EOS # Rely on a shell command instead of a file{} here to avoid loops # within puppet when it tries to manage /etc/ntp/keys before /etc/ntp. shell("mkdir -p /etc/ntp && echo '1 M AAAABBBB' >> /etc/ntp/keys") apply_manifest(pp, :catch_failures => true) end describe file("#{config}") do it { should be_file } its(:content) { should match 'keys /etc/ntp/keys' } its(:content) { should match 'controlkey /etc/ntp/controlkey' } its(:content) { should match 'requestkey 1' } its(:content) { should match 'trustedkey 1 2' } end end describe 'package' do it 'installs the right package' do pp = <<-EOS class { 'ntp': package_ensure => present, package_name => #{Array(packagename).inspect}, } EOS apply_manifest(pp, :catch_failures => true) end Array(packagename).each do |package| describe package(package) do it { should be_installed } end end end describe 'panic => 0' do it 'disables the tinker panic setting' do pp = <<-EOS class { 'ntp': panic => 0, } EOS apply_manifest(pp, :catch_failures => true) end describe file("#{config}") do its(:content) { should match 'tinker panic 0' } end end describe 'panic => 1' do it 'enables the tinker panic setting' do pp = <<-EOS class { 'ntp': panic => 1, } EOS apply_manifest(pp, :catch_failures => true) end describe file("#{config}") do its(:content) { should match 'tinker panic 1' } end end describe 'udlc' do it 'adds a udlc' do pp = "class { 'ntp': udlc => true }" apply_manifest(pp, :catch_failures => true) end describe file("#{config}") do it { should be_file } its(:content) { should match '127.127.1.0' } end end describe 'udlc_stratum' do it 'sets the stratum value when using udlc' do pp = "class { 'ntp': udlc => true, udlc_stratum => 10 }" apply_manifest(pp, :catch_failures => true) end describe file("#{config}") do it { should be_file } its(:content) { should match 'stratum 10' } end end end puppetlabs-ntp-4.1.1/spec/acceptance/ntp_service_spec.rb000644 000766 000024 00000004663 12625174641 023653 0ustar00bmjenstaff000000 000000 require 'spec_helper_acceptance' require 'specinfra' case fact('osfamily') when 'RedHat', 'FreeBSD', 'Linux', 'Gentoo' servicename = 'ntpd' when 'Solaris' servicename = 'network/ntp' when 'AIX' servicename = 'xntpd' else if fact('operatingsystem') == 'SLES' and fact('operatingsystemmajrelease') == '12' servicename = 'ntpd' else servicename = 'ntp' end end shared_examples 'running' do describe service(servicename) do if !(fact('operatingsystem') == 'SLES' && fact('operatingsystemmajrelease') == '12') it { should be_running } it { should be_enabled } else # hack until we either update SpecInfra or come up with alternative it { output = shell('service ntpd status') expect(output.stdout).to match(/Active\:\s+active\s+\(running\)/) expect(output.stdout).to match(/^\s+Loaded.*enabled\)$/) } end end end describe 'ntp::service class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do describe 'basic test' do it 'sets up the service' do apply_manifest(%{ class { 'ntp': } }, :catch_failures => true) end it_should_behave_like 'running' end describe 'service parameters' do it 'starts the service' do pp = <<-EOS class { 'ntp': service_enable => true, service_ensure => running, service_manage => true, service_name => '#{servicename}' } EOS apply_manifest(pp, :catch_failures => true) end it_should_behave_like 'running' end end describe 'service is unmanaged' do it 'shouldnt stop the service' do pp = <<-EOS class { 'ntp': service_enable => false, service_ensure => stopped, service_manage => false, service_name => '#{servicename}' } EOS apply_manifest(pp, :catch_failures => true) end describe service(servicename) do if !(fact('operatingsystem') == 'SLES' && fact('operatingsystemmajrelease') == '12') it { should be_running } it { should be_enabled } else # hack until we either update SpecInfra or come up with alternative output = shell('service ntpd status', :acceptable_exit_codes => [0, 3]) it 'should be disabled' do expect(output.stdout).to match(/^\s+Loaded.*disabled\)$/) end it 'should be stopped' do expect(output.stdout).to match(/Active\:\s+inactive/) end end end end puppetlabs-ntp-4.1.1/spec/acceptance/preferred_servers_spec.rb000644 000766 000024 00000001445 12625174641 025054 0ustar00bmjenstaff000000 000000 require 'spec_helper_acceptance' if (fact('osfamily') == 'Solaris') config = '/etc/inet/ntp.conf' else config = '/etc/ntp.conf' end describe 'preferred servers', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do pp = <<-EOS class { '::ntp': servers => ['a', 'b', 'c', 'd'], preferred_servers => ['c', 'd'], } EOS it 'applies cleanly' do apply_manifest(pp, :catch_failures => true) do |r| expect(r.stderr).not_to match(/error/i) end end describe file("#{config}") do it { should be_file } its(:content) { should match 'server a' } its(:content) { should match 'server b' } its(:content) { should match /server c (iburst\s|)prefer/ } its(:content) { should match /server d (iburst\s|)prefer/ } end end puppetlabs-ntp-4.1.1/spec/acceptance/restrict_spec.rb000644 000766 000024 00000001151 12625174641 023156 0ustar00bmjenstaff000000 000000 require 'spec_helper_acceptance' if (fact('osfamily') == 'Solaris') config = '/etc/inet/ntp.conf' else config = '/etc/ntp.conf' end describe "ntp class with restrict:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do context 'should run successfully' do it 'runs twice' do pp = "class { 'ntp': restrict => ['test restrict']}" 2.times do apply_manifest(pp, :catch_failures => true) do |r| expect(r.stderr).not_to match(/error/i) end end end end describe file("#{config}") do its(:content) { should match('test restrict') } end end puppetlabs-ntp-4.1.1/spec/acceptance/unsupported_spec.rb000644 000766 000024 00000000475 12625174641 023717 0ustar00bmjenstaff000000 000000 require 'spec_helper_acceptance' describe 'unsupported distributions and OSes', :if => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do it 'should fail' do pp = <<-EOS class { 'ntp': } EOS expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/is not supported on an/i) end end puppetlabs-ntp-4.1.1/spec/acceptance/nodesets/centos-59-x64.yml000644 000766 000024 00000000370 12625174641 024476 0ustar00bmjenstaff000000 000000 HOSTS: centos-59-x64: roles: - master platform: el-5-x86_64 box : centos-59-x64-vbox4210-nocm box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box hypervisor : vagrant CONFIG: type: git puppetlabs-ntp-4.1.1/spec/acceptance/nodesets/centos-64-x64-pe.yml000644 000766 000024 00000000432 12625174641 025073 0ustar00bmjenstaff000000 000000 HOSTS: centos-64-x64: roles: - master - database - dashboard platform: el-6-x86_64 box : centos-64-x64-vbox4210-nocm box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box hypervisor : vagrant CONFIG: type: pe puppetlabs-ntp-4.1.1/spec/acceptance/nodesets/centos-64-x64.yml000644 000766 000024 00000000371 12625174641 024473 0ustar00bmjenstaff000000 000000 HOSTS: centos-64-x64: roles: - master platform: el-6-x86_64 box : centos-64-x64-vbox4210-nocm box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box hypervisor : vagrant CONFIG: type: foss puppetlabs-ntp-4.1.1/spec/acceptance/nodesets/centos-65-x64.yml000644 000766 000024 00000000372 12625174641 024475 0ustar00bmjenstaff000000 000000 HOSTS: centos-65-x64: roles: - master platform: el-6-x86_64 box : centos-65-x64-vbox436-nocm box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box hypervisor : vagrant CONFIG: type: foss puppetlabs-ntp-4.1.1/spec/acceptance/nodesets/default.yml000644 000766 000024 00000000371 12625174641 023756 0ustar00bmjenstaff000000 000000 HOSTS: centos-64-x64: roles: - master platform: el-6-x86_64 box : centos-64-x64-vbox4210-nocm box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box hypervisor : vagrant CONFIG: type: foss puppetlabs-ntp-4.1.1/spec/acceptance/nodesets/fedora-18-x64.yml000644 000766 000024 00000000376 12625174641 024444 0ustar00bmjenstaff000000 000000 HOSTS: fedora-18-x64: roles: - master platform: fedora-18-x86_64 box : fedora-18-x64-vbox4210-nocm box_url : http://puppet-vagrant-boxes.puppetlabs.com/fedora-18-x64-vbox4210-nocm.box hypervisor : vagrant CONFIG: type: foss puppetlabs-ntp-4.1.1/spec/acceptance/nodesets/fedora-21-x64.yml000644 000766 000024 00000000222 12625174641 024424 0ustar00bmjenstaff000000 000000 HOSTS: fedora-21: roles: - master platform: fedora-21-x86_64 box: chef/fedora-21 hypervisor: vagrant CONFIG: type: foss puppetlabs-ntp-4.1.1/spec/acceptance/nodesets/sles-11-x64.yml000644 000766 000024 00000000401 12625174641 024130 0ustar00bmjenstaff000000 000000 HOSTS: sles-11-x64.local: roles: - master platform: sles-11-x64 box : sles-11sp1-x64-vbox4210-nocm box_url : http://puppet-vagrant-boxes.puppetlabs.com/sles-11sp1-x64-vbox4210-nocm.box hypervisor : vagrant CONFIG: type: foss puppetlabs-ntp-4.1.1/spec/acceptance/nodesets/sles-12-64.yml000644 000766 000024 00000000761 12625174641 023752 0ustar00bmjenstaff000000 000000 --- HOSTS: czriitzephrrlzw: roles: - master - database - dashboard - agent - default platform: sles-12-x86_64 template: sles-12-x86_64 hypervisor: vcloud CONFIG: nfs_server: none consoleport: 443 datastore: instance0 folder: Delivery/Quality Assurance/Enterprise/Dynamic resourcepool: delivery/Quality Assurance/Enterprise/Dynamic pooling_api: http://vcloud.delivery.puppetlabs.net/ pe_dir: http://enterprise.delivery.puppetlabs.net/3.4/preview puppetlabs-ntp-4.1.1/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml000644 000766 000024 00000000436 12625174641 026247 0ustar00bmjenstaff000000 000000 HOSTS: ubuntu-server-10044-x64: roles: - master platform: ubuntu-10.04-amd64 box : ubuntu-server-10044-x64-vbox4210-nocm box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box hypervisor : vagrant CONFIG: type: foss puppetlabs-ntp-4.1.1/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml000644 000766 000024 00000000436 12625174641 026247 0ustar00bmjenstaff000000 000000 HOSTS: ubuntu-server-12042-x64: roles: - master platform: ubuntu-12.04-amd64 box : ubuntu-server-12042-x64-vbox4210-nocm box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box hypervisor : vagrant CONFIG: type: foss puppetlabs-ntp-4.1.1/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml000644 000766 000024 00000000420 12625174641 026160 0ustar00bmjenstaff000000 000000 HOSTS: ubuntu-server-1404-x64: roles: - master platform: ubuntu-14.04-amd64 box : puppetlabs/ubuntu-14.04-64-nocm box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm hypervisor : vagrant CONFIG: log_level : debug type: git puppetlabs-ntp-4.1.1/spec/acceptance/nodesets/ubuntu-server-14042-x64.yml000644 000766 000024 00000000651 12625174641 026250 0ustar00bmjenstaff000000 000000 HOSTS: ubuntu1404: roles: - agent platform: ubuntu-14.04-amd64 template: ubuntu-1404-x86_64 hypervisor: vcloud CONFIG: type: foss keyfile: ~/.ssh/id_rsa-acceptance nfs_server: none consoleport: 443 datastore: instance0 folder: Delivery/Quality Assurance/Enterprise/Dynamic resourcepool: delivery/Quality Assurance/Enterprise/Dynamic pooling_api: http://vcloud.delivery.puppetlabs.net/ puppetlabs-ntp-4.1.1/manifests/config.pp000644 000766 000024 00000001034 12625175216 020536 0ustar00bmjenstaff000000 000000 # class ntp::config inherits ntp { if $ntp::keys_enable { $directory = ntp_dirname($ntp::keys_file) file { $directory: ensure => directory, owner => 0, group => 0, mode => '0755', } } file { $ntp::config: ensure => file, owner => 0, group => 0, mode => '0644', content => template($ntp::config_template), } if $ntp::logfile { file { $ntp::logfile: ensure => 'file', owner => 'ntp', group => 'ntp', mode => '0664', } } } puppetlabs-ntp-4.1.1/manifests/init.pp000644 000766 000024 00000006633 12625175216 020246 0ustar00bmjenstaff000000 000000 class ntp ( $autoupdate = $ntp::params::autoupdate, $broadcastclient = $ntp::params::broadcastclient, $config = $ntp::params::config, $config_template = $ntp::params::config_template, $disable_auth = $ntp::params::disable_auth, $disable_monitor = $ntp::params::disable_monitor, $fudge = $ntp::params::fudge, $driftfile = $ntp::params::driftfile, $leapfile = $ntp::params::leapfile, $logfile = $ntp::params::logfile, $iburst_enable = $ntp::params::iburst_enable, $keys_enable = $ntp::params::keys_enable, $keys_file = $ntp::params::keys_file, $keys_controlkey = $ntp::params::keys_controlkey, $keys_requestkey = $ntp::params::keys_requestkey, $keys_trusted = $ntp::params::keys_trusted, $minpoll = $ntp::params::minpoll, $maxpoll = $ntp::params::maxpoll, $package_ensure = $ntp::params::package_ensure, $package_manage = $ntp::params::package_manage, $package_name = $ntp::params::package_name, $panic = $ntp::params::panic, $peers = $ntp::params::peers, $preferred_servers = $ntp::params::preferred_servers, $restrict = $ntp::params::restrict, $interfaces = $ntp::params::interfaces, $servers = $ntp::params::servers, $service_enable = $ntp::params::service_enable, $service_ensure = $ntp::params::service_ensure, $service_manage = $ntp::params::service_manage, $service_name = $ntp::params::service_name, $stepout = $ntp::params::stepout, $tinker = $ntp::params::tinker, $udlc = $ntp::params::udlc, $udlc_stratum = $ntp::params::udlc_stratum, ) inherits ntp::params { validate_bool($broadcastclient) validate_absolute_path($config) validate_string($config_template) validate_bool($disable_auth) validate_bool($disable_monitor) validate_absolute_path($driftfile) if $logfile { validate_absolute_path($logfile) } if $leapfile { validate_absolute_path($leapfile) } validate_bool($iburst_enable) validate_bool($keys_enable) validate_re($keys_controlkey, ['^\d+$', '']) validate_re($keys_requestkey, ['^\d+$', '']) validate_array($keys_trusted) if $minpoll { validate_numeric($minpoll, 16, 3) } if $maxpoll { validate_numeric($maxpoll, 16, 3) } validate_string($package_ensure) validate_bool($package_manage) validate_array($package_name) if $panic { validate_numeric($panic, 65535, 0) } validate_array($preferred_servers) validate_array($restrict) validate_array($interfaces) validate_array($servers) validate_array($fudge) validate_bool($service_enable) validate_string($service_ensure) validate_bool($service_manage) validate_string($service_name) if $stepout { validate_numeric($stepout, 65535, 0) } validate_bool($tinker) validate_bool($udlc) validate_array($peers) if $autoupdate { notice('autoupdate parameter has been deprecated and replaced with package_ensure. Set this to latest for the same behavior as autoupdate => true.') } # Anchor this as per #8040 - this ensures that classes won't float off and # mess everything up. You can read about this at: # http://docs.puppetlabs.com/puppet/2.7/reference/lang_containment.html#known-issues anchor { 'ntp::begin': } -> class { '::ntp::install': } -> class { '::ntp::config': } ~> class { '::ntp::service': } -> anchor { 'ntp::end': } } puppetlabs-ntp-4.1.1/manifests/install.pp000644 000766 000024 00000000230 12625174641 020735 0ustar00bmjenstaff000000 000000 # class ntp::install inherits ntp { if $ntp::package_manage { package { $ntp::package_name: ensure => $ntp::package_ensure, } } } puppetlabs-ntp-4.1.1/manifests/params.pp000644 000766 000024 00000021550 12625175216 020561 0ustar00bmjenstaff000000 000000 class ntp::params { $autoupdate = false $config_template = 'ntp/ntp.conf.erb' $keys_enable = false $keys_controlkey = '' $keys_requestkey = '' $keys_trusted = [] $logfile = undef $minpoll = undef $leapfile = undef $package_ensure = 'present' $peers = [] $preferred_servers = [] $service_enable = true $service_ensure = 'running' $service_manage = true $stepout = undef $udlc = false $udlc_stratum = '10' $interfaces = [] $disable_auth = false $disable_monitor = true $broadcastclient = false # Allow a list of fudge options $fudge = [] $default_config = '/etc/ntp.conf' $default_keys_file = '/etc/ntp/keys' $default_driftfile = '/var/lib/ntp/drift' $default_package_name = ['ntp'] $default_service_name = 'ntpd' $package_manage = $::osfamily ? { 'FreeBSD' => false, default => true, } if str2bool($::is_virtual) { $tinker = true $panic = 0 } else { $tinker = false $panic = undef } case $::osfamily { 'AIX': { $config = $default_config $keys_file = '/etc/ntp.keys' $driftfile = '/etc/ntp.drift' $package_name = [ 'bos.net.tcp.client' ] $restrict = [ 'default nomodify notrap nopeer noquery', '127.0.0.1', ] $service_name = 'xntpd' $iburst_enable = true $servers = [ '0.debian.pool.ntp.org', '1.debian.pool.ntp.org', '2.debian.pool.ntp.org', '3.debian.pool.ntp.org', ] $maxpoll = undef } 'Debian': { $config = $default_config $keys_file = $default_keys_file $driftfile = $default_driftfile $package_name = $default_package_name $restrict = [ '-4 default kod nomodify notrap nopeer noquery', '-6 default kod nomodify notrap nopeer noquery', '127.0.0.1', '::1', ] $service_name = 'ntp' $iburst_enable = true $servers = [ '0.debian.pool.ntp.org', '1.debian.pool.ntp.org', '2.debian.pool.ntp.org', '3.debian.pool.ntp.org', ] $maxpoll = undef } 'RedHat': { $config = $default_config $keys_file = $default_keys_file $driftfile = $default_driftfile $package_name = $default_package_name $service_name = $default_service_name $maxpoll = undef case $::operatingsystem { 'Fedora': { $restrict = [ 'default nomodify notrap nopeer noquery', '127.0.0.1', '::1', ] $iburst_enable = true $servers = [ '0.fedora.pool.ntp.org', '1.fedora.pool.ntp.org', '2.fedora.pool.ntp.org', '3.fedora.pool.ntp.org', ] } default: { $restrict = [ 'default kod nomodify notrap nopeer noquery', '-6 default kod nomodify notrap nopeer noquery', '127.0.0.1', '-6 ::1', ] $iburst_enable = false $servers = [ '0.centos.pool.ntp.org', '1.centos.pool.ntp.org', '2.centos.pool.ntp.org', ] } } } 'Suse': { if $::operatingsystem == 'SLES' { case $::operatingsystemmajrelease { '10': { $service_name = 'ntp' $keys_file = '/etc/ntp.keys' $package_name = [ 'xntp' ] } '11': { $service_name = 'ntp' $keys_file = $default_keys_file $package_name = $default_package_name } '12': { $service_name = 'ntpd' $keys_file = '/etc/ntp.keys' $package_name = $default_package_name } default: { fail("The ${module_name} module is not supported on an ${::operatingsystem} ${::operatingsystemmajrelease} distribution.") } } } else { $service_name = 'ntp' $keys_file = $default_keys_file $package_name = $default_package_name } $config = $default_config $driftfile = '/var/lib/ntp/drift/ntp.drift' $restrict = [ 'default kod nomodify notrap nopeer noquery', '-6 default kod nomodify notrap nopeer noquery', '127.0.0.1', '-6 ::1', ] $iburst_enable = false $servers = [ '0.opensuse.pool.ntp.org', '1.opensuse.pool.ntp.org', '2.opensuse.pool.ntp.org', '3.opensuse.pool.ntp.org', ] $maxpoll = undef } 'FreeBSD': { $config = $default_config $driftfile = '/var/db/ntpd.drift' $keys_file = $default_keys_file $package_name = ['net/ntp'] $restrict = [ 'default kod nomodify notrap nopeer noquery', '-6 default kod nomodify notrap nopeer noquery', '127.0.0.1', '-6 ::1', ] $service_name = $default_service_name $iburst_enable = true $servers = [ '0.freebsd.pool.ntp.org', '1.freebsd.pool.ntp.org', '2.freebsd.pool.ntp.org', '3.freebsd.pool.ntp.org', ] $maxpoll = 9 } 'Archlinux': { $config = $default_config $keys_file = $default_keys_file $driftfile = '/var/lib/ntp/ntp.drift' $package_name = $default_package_name $service_name = $default_service_name $restrict = [ 'default kod nomodify notrap nopeer noquery', '-6 default kod nomodify notrap nopeer noquery', '127.0.0.1', '-6 ::1', ] $iburst_enable = false $servers = [ '0.arch.pool.ntp.org', '1.arch.pool.ntp.org', '2.arch.pool.ntp.org', '3.arch.pool.ntp.org', ] $maxpoll = undef } 'Solaris': { $config = '/etc/inet/ntp.conf' $driftfile = '/var/ntp/ntp.drift' $keys_file = '/etc/inet/ntp.keys' if $::operatingsystemrelease =~ /^(5\.10|10|10_u\d+)$/ { # Solaris 10 $package_name = [ 'SUNWntpr', 'SUNWntpu' ] $restrict = [ 'default nomodify notrap nopeer noquery', '127.0.0.1', ] } else { # Solaris 11... $package_name = [ 'service/network/ntp' ] $restrict = [ 'default kod nomodify notrap nopeer noquery', '-6 default kod nomodify notrap nopeer noquery', '127.0.0.1', '-6 ::1', ] } $service_name = 'network/ntp' $iburst_enable = false $servers = [ '0.pool.ntp.org', '1.pool.ntp.org', '2.pool.ntp.org', '3.pool.ntp.org', ] $maxpoll = undef } # Gentoo was added as its own $::osfamily in Facter 1.7.0 'Gentoo': { $config = $default_config $keys_file = $default_keys_file $driftfile = $default_driftfile $package_name = ['net-misc/ntp'] $service_name = $default_service_name $restrict = [ 'default kod nomodify notrap nopeer noquery', '-6 default kod nomodify notrap nopeer noquery', '127.0.0.1', '-6 ::1', ] $iburst_enable = false $servers = [ '0.gentoo.pool.ntp.org', '1.gentoo.pool.ntp.org', '2.gentoo.pool.ntp.org', '3.gentoo.pool.ntp.org', ] $maxpoll = undef } 'Linux': { # Account for distributions that don't have $::osfamily specific settings. # Before Facter 1.7.0 Gentoo did not have its own $::osfamily case $::operatingsystem { 'Gentoo': { $config = $default_config $keys_file = $default_keys_file $driftfile = $default_driftfile $service_name = $default_service_name $package_name = ['net-misc/ntp'] $restrict = [ 'default kod nomodify notrap nopeer noquery', '-6 default kod nomodify notrap nopeer noquery', '127.0.0.1', '-6 ::1', ] $iburst_enable = false $servers = [ '0.gentoo.pool.ntp.org', '1.gentoo.pool.ntp.org', '2.gentoo.pool.ntp.org', '3.gentoo.pool.ntp.org', ] $maxpoll = undef } default: { fail("The ${module_name} module is not supported on an ${::operatingsystem} distribution.") } } } default: { fail("The ${module_name} module is not supported on an ${::osfamily} based system.") } } } puppetlabs-ntp-4.1.1/manifests/service.pp000644 000766 000024 00000000634 12625174641 020737 0ustar00bmjenstaff000000 000000 # class ntp::service inherits ntp { if ! ($ntp::service_ensure in [ 'running', 'stopped' ]) { fail('service_ensure parameter must be running or stopped') } if $ntp::service_manage == true { service { 'ntp': ensure => $ntp::service_ensure, enable => $ntp::service_enable, name => $ntp::service_name, hasstatus => true, hasrestart => true, } } } puppetlabs-ntp-4.1.1/lib/puppet/000755 000766 000024 00000000000 12625175233 017023 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/lib/puppet/parser/000755 000766 000024 00000000000 12625175233 020317 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/lib/puppet/parser/functions/000755 000766 000024 00000000000 12625175233 022327 5ustar00bmjenstaff000000 000000 puppetlabs-ntp-4.1.1/lib/puppet/parser/functions/ntp_dirname.rb000644 000766 000024 00000000604 12625175216 025155 0ustar00bmjenstaff000000 000000 module Puppet::Parser::Functions newfunction(:ntp_dirname, :type => :rvalue, :doc => <<-EOS Returns the dirname of a path. EOS ) do |arguments| raise(Puppet::ParseError, "ntp_dirname(): Wrong number of arguments " + "given (#{arguments.size} for 1)") if arguments.size < 1 path = arguments[0] return File.dirname(path) end end # vim: set ts=2 sw=2 et :