bebox 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +78 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +163 -0
- data/LICENSE +21 -0
- data/README.md +372 -0
- data/Rakefile +8 -0
- data/bebox.gemspec +40 -0
- data/bin/bebox +5 -0
- data/lib/bebox/cli.rb +42 -0
- data/lib/bebox/commands/commands_helper.rb +33 -0
- data/lib/bebox/commands/environment_commands.rb +46 -0
- data/lib/bebox/commands/general_commands.rb +24 -0
- data/lib/bebox/commands/node_commands.rb +68 -0
- data/lib/bebox/commands/prepare_commands.rb +59 -0
- data/lib/bebox/commands/project_commands.rb +44 -0
- data/lib/bebox/commands/provision_commands.rb +145 -0
- data/lib/bebox/environment.rb +114 -0
- data/lib/bebox/logger.rb +51 -0
- data/lib/bebox/node.rb +308 -0
- data/lib/bebox/profile.rb +102 -0
- data/lib/bebox/project.rb +259 -0
- data/lib/bebox/provision.rb +257 -0
- data/lib/bebox/role.rb +103 -0
- data/lib/bebox/version.rb +3 -0
- data/lib/bebox/wizards/environment_wizard.rb +45 -0
- data/lib/bebox/wizards/node_wizard.rb +163 -0
- data/lib/bebox/wizards/profile_wizard.rb +91 -0
- data/lib/bebox/wizards/project_wizard.rb +175 -0
- data/lib/bebox/wizards/provision_wizard.rb +80 -0
- data/lib/bebox/wizards/role_wizard.rb +97 -0
- data/lib/bebox.rb +2 -0
- data/lib/deb/puppet_3.6.0/augeas-lenses_0.10.0-0ubuntu4_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/debconf-utils_1.5.42ubuntu1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/facter_2.0.1-1puppetlabs1_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/hiera_1.3.2-1puppetlabs1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/libaugeas-ruby1.8_0.3.0-1.1ubuntu4_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/libaugeas-ruby_0.3.0-1.1ubuntu4_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/libaugeas0_0.10.0-0ubuntu4_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/libjson-ruby_1.6.3-1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/libruby1.8_1.8.7.352-2ubuntu1.4_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/libruby_4.8_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/libshadow-ruby1.8_1.4.1-8build1_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/puppet-common_3.6.0-1puppetlabs1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/puppet_3.6.0-1puppetlabs1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/ruby-json_1.6.3-1_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/ruby-rgen_0.6.5-1puppetlabs1_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/ruby1.8_1.8.7.352-2ubuntu1.4_amd64.deb +0 -0
- data/lib/deb/puppet_3.6.0/ruby_4.8_all.deb +0 -0
- data/lib/deb/puppet_3.6.0/virt-what_1.11-1_amd64.deb +0 -0
- data/lib/templates/node/Vagrantfile.erb +18 -0
- data/lib/templates/node/deploy_vagrant_node.erb +3 -0
- data/lib/templates/node/node.yml.erb +3 -0
- data/lib/templates/node/prepared_node.yml.erb +4 -0
- data/lib/templates/node/provisioned_node.yml.erb +4 -0
- data/lib/templates/project/Capfile.erb +2 -0
- data/lib/templates/project/Gemfile.erb +5 -0
- data/lib/templates/project/config/deploy/environment.erb +40 -0
- data/lib/templates/project/config/deploy/vagrant.erb +42 -0
- data/lib/templates/project/config/deploy.erb +120 -0
- data/lib/templates/project/dot_bebox.erb +4 -0
- data/lib/templates/project/gitignore.erb +7 -0
- data/lib/templates/project/ubuntu_dependencies +10 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/ruby/Puppetfile +0 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/ruby/manifests/init.pp +24 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/sudo/Puppetfile +0 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/sudo/manifests/init.pp +22 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/users/Puppetfile +0 -0
- data/lib/templates/puppet/default_profiles/base/fundamental/users/manifests/init.pp +18 -0
- data/lib/templates/puppet/default_profiles/base/security/fail2ban/Puppetfile +2 -0
- data/lib/templates/puppet/default_profiles/base/security/fail2ban/manifests/init.pp +28 -0
- data/lib/templates/puppet/default_profiles/base/security/iptables/Puppetfile +2 -0
- data/lib/templates/puppet/default_profiles/base/security/iptables/manifests/init.pp +27 -0
- data/lib/templates/puppet/default_profiles/base/security/ssh/Puppetfile +2 -0
- data/lib/templates/puppet/default_profiles/base/security/ssh/manifests/init.pp +30 -0
- data/lib/templates/puppet/default_profiles/base/security/sysctl/Puppetfile +2 -0
- data/lib/templates/puppet/default_profiles/base/security/sysctl/manifests/init.pp +20 -0
- data/lib/templates/puppet/default_profiles/base/users/ssh/Puppetfile +2 -0
- data/lib/templates/puppet/default_profiles/base/users/ssh/manifests/init.pp +47 -0
- data/lib/templates/puppet/default_profiles/base/users/users/Puppetfile +0 -0
- data/lib/templates/puppet/default_profiles/base/users/users/manifests/init.pp +18 -0
- data/lib/templates/puppet/default_roles/fundamental/manifests/init.pp +16 -0
- data/lib/templates/puppet/default_roles/security/manifests/init.pp +17 -0
- data/lib/templates/puppet/default_roles/users/manifests/init.pp +15 -0
- data/lib/templates/puppet/profiles/Puppetfile.erb +24 -0
- data/lib/templates/puppet/profiles/manifests/init.pp.erb +17 -0
- data/lib/templates/puppet/roles/manifests/init.pp.erb +14 -0
- data/lib/templates/puppet/step-0/Puppetfile.erb +5 -0
- data/lib/templates/puppet/step-0/hiera/data/common.yaml.erb +26 -0
- data/lib/templates/puppet/step-0/hiera/data/environment.yaml.erb +26 -0
- data/lib/templates/puppet/step-0/hiera/data/node.yaml.erb +26 -0
- data/lib/templates/puppet/step-0/hiera/hiera.yaml.erb +11 -0
- data/lib/templates/puppet/step-0/manifests/node.erb +5 -0
- data/lib/templates/puppet/step-0/manifests/site.pp.erb +15 -0
- data/lib/templates/puppet/step-0/modules/rbenv/AUTHORS +11 -0
- data/lib/templates/puppet/step-0/modules/rbenv/CHANGELOG.md +70 -0
- data/lib/templates/puppet/step-0/modules/rbenv/Gemfile +8 -0
- data/lib/templates/puppet/step-0/modules/rbenv/Gemfile.lock +28 -0
- data/lib/templates/puppet/step-0/modules/rbenv/Modulefile +7 -0
- data/lib/templates/puppet/step-0/modules/rbenv/README.md +173 -0
- data/lib/templates/puppet/step-0/modules/rbenv/Rakefile +22 -0
- data/lib/templates/puppet/step-0/modules/rbenv/TODO +10 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/autospec +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/facter +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/filebucket +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/hiera +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/htmldiff +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/ldiff +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/pi +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet-lint +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet-module +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetca +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetd +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetdoc +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetmasterd +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetqd +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetrun +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/rake +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/ralsh +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/rspec +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/bin/rspec-puppet-init +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/lib/puppet/provider/rbenvgem/default.rb +50 -0
- data/lib/templates/puppet/step-0/modules/rbenv/lib/puppet/type/rbenvgem.rb +62 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/bundle.pp +36 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/client.pp +48 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/compile.pp +102 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/definition.pp +31 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/centos.pp +25 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/suse.pp +28 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/ubuntu.pp +17 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies.pp +8 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/gem.pp +29 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/install.pp +55 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin/rbenvvars.pp +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin/rubybuild.pp +16 -0
- data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin.pp +40 -0
- data/lib/templates/puppet/step-0/modules/rbenv/metadata.json +109 -0
- data/lib/templates/puppet/step-0/modules/rbenv/templates/Gemfile.erb +5 -0
- data/lib/templates/puppet/step-0/modules/rbenv/templates/dot.rbenvrc.erb +8 -0
- data/lib/templates/puppet/step-0/modules/stdlib/CHANGELOG.md +418 -0
- data/lib/templates/puppet/step-0/modules/stdlib/CONTRIBUTING.md +65 -0
- data/lib/templates/puppet/step-0/modules/stdlib/Gemfile +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/Gemfile.lock +166 -0
- data/lib/templates/puppet/step-0/modules/stdlib/LICENSE +19 -0
- data/lib/templates/puppet/step-0/modules/stdlib/Modulefile +11 -0
- data/lib/templates/puppet/step-0/modules/stdlib/README.markdown +1304 -0
- data/lib/templates/puppet/step-0/modules/stdlib/README_DEVELOPER.markdown +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/README_SPECS.markdown +7 -0
- data/lib/templates/puppet/step-0/modules/stdlib/RELEASE_PROCESS.markdown +24 -0
- data/lib/templates/puppet/step-0/modules/stdlib/Rakefile +18 -0
- data/lib/templates/puppet/step-0/modules/stdlib/checksums.json +349 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/facter_dot_d.rb +202 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/pe_version.rb +53 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/puppet_vardir.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/root_home.rb +32 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/util/puppet_settings.rb +21 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/abs.rb +36 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/any2array.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/base64.rb +37 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/bool2num.rb +49 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/capitalize.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/chomp.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/chop.rb +37 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/concat.rb +41 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/count.rb +22 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb +44 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete.rb +46 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_at.rb +49 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_undef_values.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_values.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/difference.rb +36 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/dirname.rb +15 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/downcase.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/empty.rb +28 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb +45 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/flatten.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/floor.rb +25 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb +46 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb +17 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/getparam.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/getvar.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/grep.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb +52 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb +25 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb +25 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_key.rb +28 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/hash.rb +41 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/intersection.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_array.rb +22 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_bool.rb +22 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb +50 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_float.rb +30 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_hash.rb +22 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_integer.rb +45 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb +32 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb +27 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb +75 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_string.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/join.rb +41 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb +47 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/keys.rb +26 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb +20 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/lstrip.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/max.rb +21 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/member.rb +44 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/merge.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/min.rb +21 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/num2bool.rb +43 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/parsejson.rb +24 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb +24 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/pick.rb +29 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/pick_default.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/prefix.rb +45 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/range.rb +88 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/reject.rb +31 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/reverse.rb +28 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/rstrip.rb +32 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/shuffle.rb +46 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/size.rb +48 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/sort.rb +27 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/squeeze.rb +36 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/str2bool.rb +46 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb +32 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/strftime.rb +107 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/strip.rb +39 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/suffix.rb +45 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/swapcase.rb +39 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/time.rb +49 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb +28 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/type.rb +50 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/union.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/unique.rb +51 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/upcase.rb +41 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/uriescape.rb +35 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb +56 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_array.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb +81 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb +34 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb +48 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_ipv4_address.rb +48 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_ipv6_address.rb +49 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_re.rb +40 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb +71 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_string.rb +33 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/values.rb +39 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/values_at.rb +98 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/zip.rb +65 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/provider/file_line/ruby.rb +83 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/type/anchor.rb +46 -0
- data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/type/file_line.rb +79 -0
- data/lib/templates/puppet/step-0/modules/stdlib/manifests/init.pp +20 -0
- data/lib/templates/puppet/step-0/modules/stdlib/manifests/stages.pp +43 -0
- data/lib/templates/puppet/step-0/modules/stdlib/metadata.json +111 -0
- data/lib/templates/puppet/step-0/modules/sudo/.fixtures.yml +5 -0
- data/lib/templates/puppet/step-0/modules/sudo/.gemfile +14 -0
- data/lib/templates/puppet/step-0/modules/sudo/.gemfile.lock +43 -0
- data/lib/templates/puppet/step-0/modules/sudo/.travis.yml +34 -0
- data/lib/templates/puppet/step-0/modules/sudo/LICENSE +13 -0
- data/lib/templates/puppet/step-0/modules/sudo/Modulefile +9 -0
- data/lib/templates/puppet/step-0/modules/sudo/README.md +171 -0
- data/lib/templates/puppet/step-0/modules/sudo/Rakefile +1 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.aix +90 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.archlinux +90 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.deb +90 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.freebsd +98 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.omnios +90 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.rhel5 +97 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.rhel6 +115 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.solaris +90 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.suse +81 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.ubuntu +30 -0
- data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.wheezy +17 -0
- data/lib/templates/puppet/step-0/modules/sudo/lib/augeas/lenses/fixedsudoers.aug +520 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/allow.pp +76 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/conf.pp +105 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/configs.pp +24 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/init.pp +151 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/package/aix.pp +46 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/package/solaris.pp +60 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/package.pp +61 -0
- data/lib/templates/puppet/step-0/modules/sudo/manifests/params.pp +127 -0
- data/lib/templates/puppet/step-0/modules/sudo/metadata.json +59 -0
- data/lib/templates/puppet/step-0/modules/sudo/templates/users_groups.erb +9 -0
- data/lib/templates/puppet/step-0/modules/users/manifests/init.pp +15 -0
- data/lib/templates/puppet/step-0/modules/users/manifests/user.pp +50 -0
- data/lib/templates/puppet/step-1/Puppetfile.erb +5 -0
- data/lib/templates/puppet/step-1/hiera/data/common.yaml.erb +11 -0
- data/lib/templates/puppet/step-1/hiera/data/environment.yaml.erb +11 -0
- data/lib/templates/puppet/step-1/hiera/data/node.yaml.erb +11 -0
- data/lib/templates/puppet/step-1/hiera/hiera.yaml.erb +11 -0
- data/lib/templates/puppet/step-1/manifests/node.erb +5 -0
- data/lib/templates/puppet/step-1/manifests/site.pp.erb +15 -0
- data/lib/templates/puppet/step-1/modules/users/manifests/init.pp +15 -0
- data/lib/templates/puppet/step-1/modules/users/manifests/user.pp +49 -0
- data/lib/templates/puppet/step-2/Puppetfile.erb +5 -0
- data/lib/templates/puppet/step-2/hiera/data/common.yaml.erb +1 -0
- data/lib/templates/puppet/step-2/hiera/data/environment.yaml.erb +1 -0
- data/lib/templates/puppet/step-2/hiera/data/node.yaml.erb +1 -0
- data/lib/templates/puppet/step-2/hiera/hiera.yaml.erb +11 -0
- data/lib/templates/puppet/step-2/manifests/node.erb +3 -0
- data/lib/templates/puppet/step-2/manifests/site.pp.erb +10 -0
- data/lib/templates/puppet/step-3/Puppetfile.erb +5 -0
- data/lib/templates/puppet/step-3/hiera/data/common.yaml.erb +99 -0
- data/lib/templates/puppet/step-3/hiera/data/environment.yaml.erb +99 -0
- data/lib/templates/puppet/step-3/hiera/data/node.yaml.erb +99 -0
- data/lib/templates/puppet/step-3/hiera/hiera.yaml.erb +11 -0
- data/lib/templates/puppet/step-3/manifests/node.erb +5 -0
- data/lib/templates/puppet/step-3/manifests/site.pp.erb +15 -0
- data/spec/environment_spec.rb +82 -0
- data/spec/factories/environment.rb +20 -0
- data/spec/factories/node.rb +22 -0
- data/spec/factories/profile.rb +10 -0
- data/spec/factories/project.rb +17 -0
- data/spec/factories/provision.rb +13 -0
- data/spec/factories/role.rb +9 -0
- data/spec/fixtures/Capfile.test +2 -0
- data/spec/fixtures/Gemfile.test +5 -0
- data/spec/fixtures/config/deploy/environment.test +35 -0
- data/spec/fixtures/config/deploy/production.test +35 -0
- data/spec/fixtures/config/deploy/staging.test +35 -0
- data/spec/fixtures/config/deploy/vagrant.test +37 -0
- data/spec/fixtures/config/deploy.test +120 -0
- data/spec/fixtures/dot_bebox.test.erb +4 -0
- data/spec/fixtures/dot_gitignore.test +8 -0
- data/spec/fixtures/node/Vagrantfile.test.erb +18 -0
- data/spec/fixtures/node/node_0.test.erb +3 -0
- data/spec/fixtures/node/prepared_node_0.test.erb +4 -0
- data/spec/fixtures/node/provisioned_node_0.test.erb +4 -0
- data/spec/fixtures/node/vagrant_deploy.test +38 -0
- data/spec/fixtures/puppet/hiera/data/node0.server1.test.yaml.test +4 -0
- data/spec/fixtures/puppet/profiles/test/profile_0/Puppetfile.test +24 -0
- data/spec/fixtures/puppet/profiles/test/profile_0/Puppetfile_with_modules.test +20 -0
- data/spec/fixtures/puppet/profiles/test/profile_0/manifests/init.pp.test +17 -0
- data/spec/fixtures/puppet/profiles/test/profile_0/manifests/init_with_content.pp.test +22 -0
- data/spec/fixtures/puppet/roles/manifests/init.pp.test +14 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/common.yaml.test +26 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/node0.server1.test.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/pname_env.yaml.test +26 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/production.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/staging.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/data/vagrant.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-0/hiera/hiera.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-0/manifests/site.pp.test +10 -0
- data/spec/fixtures/puppet/steps/step-0/manifests/site_with_node.pp.test +15 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/common.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/node0.server1.test.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/pname_env.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/production.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/staging.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/data/vagrant.yaml.test +0 -0
- data/spec/fixtures/puppet/steps/step-1/hiera/hiera.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-1/manifests/site.pp.test +10 -0
- data/spec/fixtures/puppet/steps/step-1/manifests/site_with_node.pp.test +15 -0
- data/spec/fixtures/puppet/steps/step-2/Puppetfile.test +6 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/common.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/node0.server1.test.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/pname_env.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/production.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/staging.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/data/vagrant.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-2/hiera/hiera.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-2/manifests/site.pp.test +10 -0
- data/spec/fixtures/puppet/steps/step-2/manifests/site_with_node.pp.test +13 -0
- data/spec/fixtures/puppet/steps/step-2/manifests/site_with_node_role_association.pp.test +16 -0
- data/spec/fixtures/puppet/steps/step-2/modules/profiles/manifests/test/profile_0.pp.test +17 -0
- data/spec/fixtures/puppet/steps/step-2/modules/roles/manifests/role_0.pp.test +16 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/common.yaml.test +99 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/node0.server1.test.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/pname_env.yaml.test +99 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/production.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/staging.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/data/vagrant.yaml.test +1 -0
- data/spec/fixtures/puppet/steps/step-3/hiera/hiera.yaml.test +11 -0
- data/spec/fixtures/puppet/steps/step-3/manifests/site.pp.test +10 -0
- data/spec/fixtures/puppet/steps/step-3/manifests/site_with_node.pp.test +15 -0
- data/spec/fixtures/puppet/ubuntu_dependencies.test +10 -0
- data/spec/node0.server1.test/prepare_phase_spec.rb +53 -0
- data/spec/node0.server1.test/provision_step_0_spec.rb +46 -0
- data/spec/node0.server1.test/provision_step_1_spec.rb +41 -0
- data/spec/node0.server1.test/provision_step_2_spec.rb +79 -0
- data/spec/node0.server1.test/provision_step_3_spec.rb +76 -0
- data/spec/node_role_spec.rb +20 -0
- data/spec/node_spec.rb +71 -0
- data/spec/node_wizard_spec.rb +22 -0
- data/spec/ordered_phases_spec.rb +55 -0
- data/spec/pre_prepare_spec.rb +78 -0
- data/spec/pre_provision_steps_spec.rb +40 -0
- data/spec/profile_spec.rb +70 -0
- data/spec/project_spec.rb +195 -0
- data/spec/project_wizard_spec.rb +51 -0
- data/spec/puppet_spec_helper.rb +15 -0
- data/spec/role_profiles_spec.rb +40 -0
- data/spec/role_spec.rb +56 -0
- data/spec/spec_helper.rb +37 -0
- data/spec/support/config_specs.yaml.example +2 -0
- data/spec/vagrant_spec_helper.rb +15 -0
- metadata +625 -0
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
(*
|
|
2
|
+
Module: FixedSudoers
|
|
3
|
+
Parses /etc/sudoers
|
|
4
|
+
|
|
5
|
+
Author: Raphael Pinson <raphink@gmail.com>
|
|
6
|
+
|
|
7
|
+
About: Reference
|
|
8
|
+
This lens tries to keep as close as possible to `man sudoers` where possible.
|
|
9
|
+
|
|
10
|
+
For example, recursive definitions such as
|
|
11
|
+
|
|
12
|
+
> Cmnd_Spec_List ::= Cmnd_Spec |
|
|
13
|
+
> Cmnd_Spec ',' Cmnd_Spec_List
|
|
14
|
+
|
|
15
|
+
are replaced by
|
|
16
|
+
|
|
17
|
+
> let cmnd_spec_list = cmnd_spec . ( sep_com . cmnd_spec )*
|
|
18
|
+
|
|
19
|
+
since Augeas cannot deal with recursive definitions.
|
|
20
|
+
The definitions from `man sudoers` are put as commentaries for reference
|
|
21
|
+
throughout the file. More information can be found in the manual.
|
|
22
|
+
|
|
23
|
+
About: License
|
|
24
|
+
This file is licensed under the LGPLv2+, like the rest of Augeas.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
About: Lens Usage
|
|
28
|
+
Sample usage of this lens in augtool
|
|
29
|
+
|
|
30
|
+
* Set first Defaults to apply to the "LOCALNET" network alias
|
|
31
|
+
> set /files/etc/sudoers/Defaults[1]/type "@LOCALNET"
|
|
32
|
+
* List all user specifications applying explicitely to the "admin" Unix group
|
|
33
|
+
> match /files/etc/sudoers/spec/user "%admin"
|
|
34
|
+
* Remove the full 3rd user specification
|
|
35
|
+
> rm /files/etc/sudoers/spec[3]
|
|
36
|
+
|
|
37
|
+
About: Configuration files
|
|
38
|
+
This lens applies to /etc/sudoers. See <filter>.
|
|
39
|
+
*)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
module FixedSudoers =
|
|
44
|
+
autoload xfm
|
|
45
|
+
|
|
46
|
+
(************************************************************************
|
|
47
|
+
* Group: USEFUL PRIMITIVES
|
|
48
|
+
*************************************************************************)
|
|
49
|
+
|
|
50
|
+
(* Group: Generic primitives *)
|
|
51
|
+
(* Variable: eol *)
|
|
52
|
+
let eol = del /[ \t]*\n/ "\n"
|
|
53
|
+
|
|
54
|
+
(* Variable: indent *)
|
|
55
|
+
let indent = del /[ \t]*/ ""
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
(* Group: Separators *)
|
|
59
|
+
|
|
60
|
+
(* Variable: sep_spc *)
|
|
61
|
+
let sep_spc = del /[ \t]+/ " "
|
|
62
|
+
|
|
63
|
+
(* Variable: sep_cont *)
|
|
64
|
+
let sep_cont = del /([ \t]+|[ \t]*\\\\\n[ \t]*)/ " "
|
|
65
|
+
|
|
66
|
+
(* Variable: sep_cont_opt *)
|
|
67
|
+
let sep_cont_opt = del /([ \t]*|[ \t]*\\\\\n[ \t]*)/ " "
|
|
68
|
+
|
|
69
|
+
(* Variable: sep_com *)
|
|
70
|
+
let sep_com = sep_cont_opt . Util.del_str "," . sep_cont_opt
|
|
71
|
+
|
|
72
|
+
(* Variable: sep_eq *)
|
|
73
|
+
let sep_eq = sep_cont_opt . Util.del_str "=" . sep_cont_opt
|
|
74
|
+
|
|
75
|
+
(* Variable: sep_col *)
|
|
76
|
+
let sep_col = sep_cont_opt . Util.del_str ":" . sep_cont_opt
|
|
77
|
+
|
|
78
|
+
(* Variable: sep_dquote *)
|
|
79
|
+
let sep_dquote = Util.del_str "\""
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
(* Group: Stores *)
|
|
83
|
+
|
|
84
|
+
(* Variable: sto_to_com_cmnd
|
|
85
|
+
sto_to_com_cmnd does not begin or end with a space *)
|
|
86
|
+
let sto_to_com_cmnd = store /([^,=:#() \t\n\\\\]([^,=:#()\n\\\\]|\\\\[=:,\\\\])*[^,=:#() \t\n\\\\])|[^,=:#() \t\n\\\\]/
|
|
87
|
+
|
|
88
|
+
(* Variable: sto_to_com
|
|
89
|
+
|
|
90
|
+
There could be a \ in the middle of a command *)
|
|
91
|
+
let sto_to_com = store /([^,=:#() \t\n\\\\][^,=:#()\n]*[^,=:#() \t\n\\\\])|[^,=:#() \t\n\\\\]/
|
|
92
|
+
|
|
93
|
+
(* Variable: sto_to_com_host *)
|
|
94
|
+
let sto_to_com_host = store /[^,=:#() \t\n\\\\]+/
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
(* Variable: sto_to_com_user
|
|
98
|
+
Escaped spaces are allowed *)
|
|
99
|
+
let sto_to_com_user = store ( /([^,=:#() \t\n]([^,=:#() \t\n]|(\\\\[ \t]))*[^,=:#() \t\n])|[^,=:#() \t\n]/
|
|
100
|
+
- /(User|Runas|Host|Cmnd)_Alias|Defaults.*/ )
|
|
101
|
+
|
|
102
|
+
(* Variable: sto_to_com_col *)
|
|
103
|
+
let sto_to_com_col = store /[^",=#() \t\n\\\\]+/ (* " relax emacs *)
|
|
104
|
+
|
|
105
|
+
(* Variable: sto_to_eq *)
|
|
106
|
+
let sto_to_eq = store /[^,=:#() \t\n\\\\]+/
|
|
107
|
+
|
|
108
|
+
(* Variable: sto_to_spc *)
|
|
109
|
+
let sto_to_spc = store /[^", \t\n\\\\]+|"[^", \t\n\\\\]+"/
|
|
110
|
+
|
|
111
|
+
(* Variable: sto_to_spc_no_dquote *)
|
|
112
|
+
let sto_to_spc_no_dquote = store /[^",# \t\n\\\\]+/ (* " relax emacs *)
|
|
113
|
+
|
|
114
|
+
(* Variable: sto_integer *)
|
|
115
|
+
let sto_integer = store /[0-9]+/
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
(* Group: Comments and empty lines *)
|
|
119
|
+
|
|
120
|
+
(* View: comment
|
|
121
|
+
Map comments in "#comment" nodes *)
|
|
122
|
+
let comment =
|
|
123
|
+
let sto_to_eol = store (/([^ \t\n].*[^ \t\n]|[^ \t\n])/ - /include(dir)?.*/) in
|
|
124
|
+
[ label "#comment" . del /[ \t]*#[ \t]*/ "# " . sto_to_eol . eol ]
|
|
125
|
+
|
|
126
|
+
(* View: comment_eol
|
|
127
|
+
Requires a space before the # *)
|
|
128
|
+
let comment_eol = Util.comment_generic /[ \t]+#[ \t]*/ " # "
|
|
129
|
+
|
|
130
|
+
(* View: comment_or_eol
|
|
131
|
+
A <comment_eol> or <eol> *)
|
|
132
|
+
let comment_or_eol = comment_eol | (del /([ \t]+#\n|[ \t]*\n)/ "\n")
|
|
133
|
+
|
|
134
|
+
(* View: empty
|
|
135
|
+
Map empty lines *)
|
|
136
|
+
let empty = [ del /[ \t]*#?[ \t]*\n/ "\n" ]
|
|
137
|
+
|
|
138
|
+
(* View: includedir *)
|
|
139
|
+
let includedir =
|
|
140
|
+
[ key /#include(dir)?/ . Sep.space . store Rx.fspath . eol ]
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
(************************************************************************
|
|
144
|
+
* Group: ALIASES
|
|
145
|
+
*************************************************************************)
|
|
146
|
+
|
|
147
|
+
(************************************************************************
|
|
148
|
+
* View: alias_field
|
|
149
|
+
* Generic alias field to gather all Alias definitions
|
|
150
|
+
*
|
|
151
|
+
* Definition:
|
|
152
|
+
* > User_Alias ::= NAME '=' User_List
|
|
153
|
+
* > Runas_Alias ::= NAME '=' Runas_List
|
|
154
|
+
* > Host_Alias ::= NAME '=' Host_List
|
|
155
|
+
* > Cmnd_Alias ::= NAME '=' Cmnd_List
|
|
156
|
+
*
|
|
157
|
+
* Parameters:
|
|
158
|
+
* kw:string - the label string
|
|
159
|
+
* sto:lens - the store lens
|
|
160
|
+
*************************************************************************)
|
|
161
|
+
let alias_field (kw:string) (sto:lens) = [ label kw . sto ]
|
|
162
|
+
|
|
163
|
+
(* View: alias_list
|
|
164
|
+
List of <alias_fields>, separated by commas *)
|
|
165
|
+
let alias_list (kw:string) (sto:lens) =
|
|
166
|
+
alias_field kw sto . ( sep_com . alias_field kw sto )*
|
|
167
|
+
|
|
168
|
+
(************************************************************************
|
|
169
|
+
* View: alias_name
|
|
170
|
+
* Name of an <alias_entry_single>
|
|
171
|
+
*
|
|
172
|
+
* Definition:
|
|
173
|
+
* > NAME ::= [A-Z]([A-Z][0-9]_)*
|
|
174
|
+
*************************************************************************)
|
|
175
|
+
let alias_name
|
|
176
|
+
= [ label "name" . store /[A-Z][A-Z0-9_]*/ ]
|
|
177
|
+
|
|
178
|
+
(************************************************************************
|
|
179
|
+
* View: alias_entry_single
|
|
180
|
+
* Single <alias_entry>, named using <alias_name> and listing <alias_list>
|
|
181
|
+
*
|
|
182
|
+
* Definition:
|
|
183
|
+
* > Alias_Type NAME = item1, item2, ...
|
|
184
|
+
*
|
|
185
|
+
* Parameters:
|
|
186
|
+
* field:string - the field name, passed to <alias_list>
|
|
187
|
+
* sto:lens - the store lens, passed to <alias_list>
|
|
188
|
+
*************************************************************************)
|
|
189
|
+
let alias_entry_single (field:string) (sto:lens)
|
|
190
|
+
= [ label "alias" . alias_name . sep_eq . alias_list field sto ]
|
|
191
|
+
|
|
192
|
+
(************************************************************************
|
|
193
|
+
* View: alias_entry
|
|
194
|
+
* Alias entry, a list of comma-separated <alias_entry_single> fields
|
|
195
|
+
*
|
|
196
|
+
* Definition:
|
|
197
|
+
* > Alias_Type NAME = item1, item2, item3 : NAME = item4, item5
|
|
198
|
+
*
|
|
199
|
+
* Parameters:
|
|
200
|
+
* kw:string - the alias keyword string
|
|
201
|
+
* field:string - the field name, passed to <alias_entry_single>
|
|
202
|
+
* sto:lens - the store lens, passed to <alias_entry_single>
|
|
203
|
+
*************************************************************************)
|
|
204
|
+
let alias_entry (kw:string) (field:string) (sto:lens)
|
|
205
|
+
= [ indent . key kw . sep_cont . alias_entry_single field sto
|
|
206
|
+
. ( sep_col . alias_entry_single field sto )* . comment_or_eol ]
|
|
207
|
+
|
|
208
|
+
(* TODO: go further in user definitions *)
|
|
209
|
+
(* View: user_alias
|
|
210
|
+
User_Alias, see <alias_field> *)
|
|
211
|
+
let user_alias = alias_entry "User_Alias" "user" sto_to_com
|
|
212
|
+
(* View: runas_alias
|
|
213
|
+
Run_Alias, see <alias_field> *)
|
|
214
|
+
let runas_alias = alias_entry "Runas_Alias" "runas_user" sto_to_com
|
|
215
|
+
(* View: host_alias
|
|
216
|
+
Host_Alias, see <alias_field> *)
|
|
217
|
+
let host_alias = alias_entry "Host_Alias" "host" sto_to_com
|
|
218
|
+
(* View: cmnd_alias
|
|
219
|
+
Cmnd_Alias, see <alias_field> *)
|
|
220
|
+
let cmnd_alias = alias_entry "Cmnd_Alias" "command" sto_to_com_cmnd
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
(************************************************************************
|
|
224
|
+
* View: alias
|
|
225
|
+
* Every kind of Alias entry,
|
|
226
|
+
* see <user_alias>, <runas_alias>, <host_alias> and <cmnd_alias>
|
|
227
|
+
*
|
|
228
|
+
* Definition:
|
|
229
|
+
* > Alias ::= 'User_Alias' User_Alias (':' User_Alias)* |
|
|
230
|
+
* > 'Runas_Alias' Runas_Alias (':' Runas_Alias)* |
|
|
231
|
+
* > 'Host_Alias' Host_Alias (':' Host_Alias)* |
|
|
232
|
+
* > 'Cmnd_Alias' Cmnd_Alias (':' Cmnd_Alias)*
|
|
233
|
+
*************************************************************************)
|
|
234
|
+
let alias = user_alias | runas_alias | host_alias | cmnd_alias
|
|
235
|
+
(************************************************************************
|
|
236
|
+
* Group: DEFAULTS
|
|
237
|
+
*************************************************************************)
|
|
238
|
+
|
|
239
|
+
(************************************************************************
|
|
240
|
+
* View: default_type
|
|
241
|
+
* Type definition for <defaults>
|
|
242
|
+
*
|
|
243
|
+
* Definition:
|
|
244
|
+
* > Default_Type ::= 'Defaults' |
|
|
245
|
+
* > 'Defaults' '@' Host_List |
|
|
246
|
+
* > 'Defaults' ':' User_List |
|
|
247
|
+
* > 'Defaults' '>' Runas_List
|
|
248
|
+
*************************************************************************)
|
|
249
|
+
let default_type =
|
|
250
|
+
let value = store /[@:>][^ \t\n\\\\]+/ in
|
|
251
|
+
[ label "type" . value ]
|
|
252
|
+
|
|
253
|
+
(************************************************************************
|
|
254
|
+
* View: del_negate
|
|
255
|
+
* Delete an even number of '!' signs
|
|
256
|
+
*************************************************************************)
|
|
257
|
+
let del_negate = del /(!!)*/ ""
|
|
258
|
+
|
|
259
|
+
(************************************************************************
|
|
260
|
+
* View: negate_node
|
|
261
|
+
* Negation of boolean values for <defaults>. Accept one optional '!'
|
|
262
|
+
* and produce a 'negate' node if there is one.
|
|
263
|
+
*************************************************************************)
|
|
264
|
+
let negate_node = [ del "!" "!" . label "negate" ]
|
|
265
|
+
|
|
266
|
+
let negate_or_value (key:lens) (value:lens) =
|
|
267
|
+
[ del_negate . (negate_node . key | key . value) ]
|
|
268
|
+
|
|
269
|
+
(************************************************************************
|
|
270
|
+
* View: parameter_flag
|
|
271
|
+
* A flag parameter for <defaults>
|
|
272
|
+
*
|
|
273
|
+
* Flags are implicitly boolean and can be turned off via the '!' operator.
|
|
274
|
+
* Some integer, string and list parameters may also be used in a boolean
|
|
275
|
+
* context to disable them.
|
|
276
|
+
*************************************************************************)
|
|
277
|
+
let parameter_flag_kw = "always_set_home" | "authenticate" | "env_editor"
|
|
278
|
+
| "env_reset" | "fqdn" | "ignore_dot"
|
|
279
|
+
| "ignore_local_sudoers" | "insults" | "log_host"
|
|
280
|
+
| "log_year" | "long_otp_prompt" | "mail_always"
|
|
281
|
+
| "mail_badpass" | "mail_no_host" | "mail_no_perms"
|
|
282
|
+
| "mail_no_user" | "noexec" | "path_info"
|
|
283
|
+
| "passprompt_override" | "preserve_groups"
|
|
284
|
+
| "requiretty" | "root_sudo" | "rootpw" | "runaspw"
|
|
285
|
+
| "set_home" | "set_logname" | "setenv"
|
|
286
|
+
| "shell_noargs" | "stay_setuid" | "targetpw"
|
|
287
|
+
| "tty_tickets" | "visiblepw"
|
|
288
|
+
|
|
289
|
+
let parameter_flag = [ del_negate . negate_node?
|
|
290
|
+
. key parameter_flag_kw ]
|
|
291
|
+
|
|
292
|
+
(************************************************************************
|
|
293
|
+
* View: parameter_integer
|
|
294
|
+
* An integer parameter for <defaults>
|
|
295
|
+
*************************************************************************)
|
|
296
|
+
let parameter_integer_nobool_kw = "passwd_tries"
|
|
297
|
+
|
|
298
|
+
let parameter_integer_nobool = [ key parameter_integer_nobool_kw . sep_eq
|
|
299
|
+
. del /"?/ "" . sto_integer
|
|
300
|
+
. del /"?/ "" ]
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
let parameter_integer_bool_kw = "loglinelen" | "passwd_timeout"
|
|
304
|
+
| "timestamp_timeout" | "umask"
|
|
305
|
+
|
|
306
|
+
let parameter_integer_bool =
|
|
307
|
+
negate_or_value
|
|
308
|
+
(key parameter_integer_bool_kw)
|
|
309
|
+
(sep_eq . del /"?/ "" . sto_integer . del /"?/ "")
|
|
310
|
+
|
|
311
|
+
let parameter_integer = parameter_integer_nobool
|
|
312
|
+
| parameter_integer_bool
|
|
313
|
+
|
|
314
|
+
(************************************************************************
|
|
315
|
+
* View: parameter_string
|
|
316
|
+
* A string parameter for <defaults>
|
|
317
|
+
*
|
|
318
|
+
* An odd number of '!' operators negate the value of the item;
|
|
319
|
+
* an even number just cancel each other out.
|
|
320
|
+
*************************************************************************)
|
|
321
|
+
let parameter_string_nobool_kw = "badpass_message" | "editor" | "mailsub"
|
|
322
|
+
| "noexec_file" | "passprompt" | "runas_default"
|
|
323
|
+
| "syslog_badpri" | "syslog_goodpri"
|
|
324
|
+
| "timestampdir" | "timestampowner" | "secure_path"
|
|
325
|
+
|
|
326
|
+
let parameter_string_nobool = [ key parameter_string_nobool_kw . sep_eq
|
|
327
|
+
. del /"?/ "" . sto_to_com_col
|
|
328
|
+
. del /"?/ "" ]
|
|
329
|
+
|
|
330
|
+
let parameter_string_bool_kw = "exempt_group" | "lecture" | "lecture_file"
|
|
331
|
+
| "listpw" | "logfile" | "mailerflags"
|
|
332
|
+
| "mailerpath" | "mailto" | "exempt_group"
|
|
333
|
+
| "syslog" | "verifypw" | "logfile"
|
|
334
|
+
| "mailerflags" | "mailerpath" | "mailto"
|
|
335
|
+
| "syslog" | "verifypw"
|
|
336
|
+
|
|
337
|
+
let parameter_string_bool =
|
|
338
|
+
negate_or_value
|
|
339
|
+
(key parameter_string_bool_kw)
|
|
340
|
+
(sep_eq . sto_to_com_col)
|
|
341
|
+
|
|
342
|
+
let parameter_string = parameter_string_nobool
|
|
343
|
+
| parameter_string_bool
|
|
344
|
+
|
|
345
|
+
(************************************************************************
|
|
346
|
+
* View: parameter_lists
|
|
347
|
+
* A single list parameter for <defaults>
|
|
348
|
+
*
|
|
349
|
+
* All lists can be used in a boolean context
|
|
350
|
+
* The argument may be a double-quoted, space-separated list or a single
|
|
351
|
+
* value without double-quotes.
|
|
352
|
+
* The list can be replaced, added to, deleted from, or disabled
|
|
353
|
+
* by using the =, +=, -=, and ! operators respectively.
|
|
354
|
+
* An odd number of '!' operators negate the value of the item;
|
|
355
|
+
* an even number just cancel each other out.
|
|
356
|
+
*************************************************************************)
|
|
357
|
+
let parameter_lists_kw = "env_check" | "env_delete" | "env_keep"
|
|
358
|
+
let parameter_lists_value = [ label "var" . sto_to_spc_no_dquote ]
|
|
359
|
+
let parameter_lists_value_dquote = [ label "var"
|
|
360
|
+
. del /"?/ "" . sto_to_spc_no_dquote
|
|
361
|
+
. del /"?/ "" ]
|
|
362
|
+
|
|
363
|
+
let parameter_lists_values = parameter_lists_value_dquote
|
|
364
|
+
| ( sep_dquote . parameter_lists_value
|
|
365
|
+
. ( sep_cont . parameter_lists_value )+
|
|
366
|
+
. sep_dquote )
|
|
367
|
+
|
|
368
|
+
let parameter_lists_sep = sep_cont_opt
|
|
369
|
+
. ( [ del "+" "+" . label "append" ]
|
|
370
|
+
| [ del "-" "-" . label "remove" ] )?
|
|
371
|
+
. del "=" "=" . sep_cont_opt
|
|
372
|
+
|
|
373
|
+
let parameter_lists =
|
|
374
|
+
negate_or_value
|
|
375
|
+
(key parameter_lists_kw)
|
|
376
|
+
(parameter_lists_sep . parameter_lists_values)
|
|
377
|
+
|
|
378
|
+
(************************************************************************
|
|
379
|
+
* View: parameter
|
|
380
|
+
* A single parameter for <defaults>
|
|
381
|
+
*
|
|
382
|
+
* Definition:
|
|
383
|
+
* > Parameter ::= Parameter '=' Value |
|
|
384
|
+
* > Parameter '+=' Value |
|
|
385
|
+
* > Parameter '-=' Value |
|
|
386
|
+
* > '!'* Parameter
|
|
387
|
+
*
|
|
388
|
+
* Parameters may be flags, integer values, strings, or lists.
|
|
389
|
+
*
|
|
390
|
+
*************************************************************************)
|
|
391
|
+
let parameter = parameter_flag | parameter_integer
|
|
392
|
+
| parameter_string | parameter_lists
|
|
393
|
+
|
|
394
|
+
(************************************************************************
|
|
395
|
+
* View: parameter_list
|
|
396
|
+
* A list of comma-separated <parameters> for <defaults>
|
|
397
|
+
*
|
|
398
|
+
* Definition:
|
|
399
|
+
* > Parameter_List ::= Parameter |
|
|
400
|
+
* > Parameter ',' Parameter_List
|
|
401
|
+
*************************************************************************)
|
|
402
|
+
let parameter_list = parameter . ( sep_com . parameter )*
|
|
403
|
+
|
|
404
|
+
(************************************************************************
|
|
405
|
+
* View: defaults
|
|
406
|
+
* A Defaults entry
|
|
407
|
+
*
|
|
408
|
+
* Definition:
|
|
409
|
+
* > Default_Entry ::= Default_Type Parameter_List
|
|
410
|
+
*************************************************************************)
|
|
411
|
+
let defaults = [ indent . key "Defaults" . default_type? . sep_cont
|
|
412
|
+
. parameter_list . comment_or_eol ]
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
(************************************************************************
|
|
417
|
+
* Group: USER SPECIFICATION
|
|
418
|
+
*************************************************************************)
|
|
419
|
+
|
|
420
|
+
(************************************************************************
|
|
421
|
+
* View: runas_spec
|
|
422
|
+
* A runas specification for <spec>, using <alias_list> for listing
|
|
423
|
+
* users and/or groups used to run a command
|
|
424
|
+
*
|
|
425
|
+
* Definition:
|
|
426
|
+
* > Runas_Spec ::= '(' Runas_List ')' |
|
|
427
|
+
* > '(:' Runas_List ')' |
|
|
428
|
+
* > '(' Runas_List ':' Runas_List ')'
|
|
429
|
+
*************************************************************************)
|
|
430
|
+
let runas_spec_user = alias_list "runas_user" sto_to_com
|
|
431
|
+
let runas_spec_group = Util.del_str ":" . indent
|
|
432
|
+
. alias_list "runas_group" sto_to_com
|
|
433
|
+
|
|
434
|
+
let runas_spec_usergroup = runas_spec_user . indent . runas_spec_group
|
|
435
|
+
|
|
436
|
+
let runas_spec = Util.del_str "("
|
|
437
|
+
. (runas_spec_user
|
|
438
|
+
| runas_spec_group
|
|
439
|
+
| runas_spec_usergroup )
|
|
440
|
+
. Util.del_str ")" . sep_cont_opt
|
|
441
|
+
|
|
442
|
+
(************************************************************************
|
|
443
|
+
* View: tag_spec
|
|
444
|
+
* Tag specification for <spec>
|
|
445
|
+
*
|
|
446
|
+
* Definition:
|
|
447
|
+
* > Tag_Spec ::= ('NOPASSWD:' | 'PASSWD:' | 'NOEXEC:' | 'EXEC:' |
|
|
448
|
+
* > 'SETENV:' | 'NOSETENV:')
|
|
449
|
+
*************************************************************************)
|
|
450
|
+
let tag_spec =
|
|
451
|
+
[ label "tag" . store /(NO)?(PASSWD|EXEC|SETENV)/ . sep_col ]
|
|
452
|
+
|
|
453
|
+
(************************************************************************
|
|
454
|
+
* View: cmnd_spec
|
|
455
|
+
* Command specification for <spec>,
|
|
456
|
+
* with optional <runas_spec> and any amount of <tag_specs>
|
|
457
|
+
*
|
|
458
|
+
* Definition:
|
|
459
|
+
* > Cmnd_Spec ::= Runas_Spec? Tag_Spec* Cmnd
|
|
460
|
+
*************************************************************************)
|
|
461
|
+
let cmnd_spec =
|
|
462
|
+
[ label "command" . runas_spec? . tag_spec* . sto_to_com_cmnd ]
|
|
463
|
+
|
|
464
|
+
(************************************************************************
|
|
465
|
+
* View: cmnd_spec_list
|
|
466
|
+
* A list of comma-separated <cmnd_specs>
|
|
467
|
+
*
|
|
468
|
+
* Definition:
|
|
469
|
+
* > Cmnd_Spec_List ::= Cmnd_Spec |
|
|
470
|
+
* > Cmnd_Spec ',' Cmnd_Spec_List
|
|
471
|
+
*************************************************************************)
|
|
472
|
+
let cmnd_spec_list = cmnd_spec . ( sep_com . cmnd_spec )*
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
(************************************************************************
|
|
476
|
+
* View: spec_list
|
|
477
|
+
* Group of hosts with <cmnd_spec_list>
|
|
478
|
+
*************************************************************************)
|
|
479
|
+
let spec_list = [ label "host_group" . alias_list "host" sto_to_com_host
|
|
480
|
+
. sep_eq . cmnd_spec_list ]
|
|
481
|
+
|
|
482
|
+
(************************************************************************
|
|
483
|
+
* View: spec
|
|
484
|
+
* A user specification, listing colon-separated <spec_lists>
|
|
485
|
+
*
|
|
486
|
+
* Definition:
|
|
487
|
+
* > User_Spec ::= User_List Host_List '=' Cmnd_Spec_List \
|
|
488
|
+
* > (':' Host_List '=' Cmnd_Spec_List)*
|
|
489
|
+
*************************************************************************)
|
|
490
|
+
let spec = [ label "spec" . indent
|
|
491
|
+
. alias_list "user" sto_to_com_user . sep_cont
|
|
492
|
+
. spec_list
|
|
493
|
+
. ( sep_col . spec_list )* . comment_or_eol ]
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
(************************************************************************
|
|
497
|
+
* Group: LENS & FILTER
|
|
498
|
+
*************************************************************************)
|
|
499
|
+
|
|
500
|
+
(* View: lns
|
|
501
|
+
The sudoers lens, any amount of
|
|
502
|
+
* <empty> lines
|
|
503
|
+
* <comments>
|
|
504
|
+
* <includedirs>
|
|
505
|
+
* <aliases>
|
|
506
|
+
* <defaults>
|
|
507
|
+
* <specs>
|
|
508
|
+
*)
|
|
509
|
+
let lns = ( empty | comment | includedir | alias | defaults | spec )*
|
|
510
|
+
|
|
511
|
+
(* View: filter *)
|
|
512
|
+
let filter = (incl "/etc/sudoers")
|
|
513
|
+
. (incl "/usr/local/etc/sudoers")
|
|
514
|
+
. (incl "/etc/sudoers.d/*")
|
|
515
|
+
. (incl "/usr/local/etc/sudoers.d/*")
|
|
516
|
+
. (incl "/opt/csw/etc/sudoers")
|
|
517
|
+
. (incl "/etc/opt/csw/sudoers")
|
|
518
|
+
. Util.stdexcl
|
|
519
|
+
|
|
520
|
+
let xfm = transform lns filter
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Class: sudo::allow
|
|
2
|
+
#
|
|
3
|
+
# This class allows you to take complete advantage of automatic parameter
|
|
4
|
+
# lookup using a Hiera database. Providing a singleton class that accepts
|
|
5
|
+
# arrays in the parameters makes it possible to implement specific user
|
|
6
|
+
# or group configuration in Hiera, whereas the use of defined types is
|
|
7
|
+
# normally restricted to Puppet manifests.
|
|
8
|
+
#
|
|
9
|
+
# Furthermore, having separate parameters for "add" and "replace" modes
|
|
10
|
+
# allows you to take full advantage of inheritance in the Hiera database
|
|
11
|
+
# while still allowing for exceptions if required.
|
|
12
|
+
#
|
|
13
|
+
# This class works best with Puppet 3.0 or higher.
|
|
14
|
+
#
|
|
15
|
+
# Parameters:
|
|
16
|
+
# [*add_users*]
|
|
17
|
+
# Define the set of users with sudo privileges by getting all values in
|
|
18
|
+
# the hierarchy for this key, then flattening them into a single array
|
|
19
|
+
# of unique values.
|
|
20
|
+
# Default: empty array
|
|
21
|
+
#
|
|
22
|
+
# [*add_groups*]
|
|
23
|
+
# Define the set of groups with sudo privileges by getting all values in
|
|
24
|
+
# the hierarchy for this key, then flattening them into a single array
|
|
25
|
+
# of unique values.
|
|
26
|
+
# Default: empty array
|
|
27
|
+
#
|
|
28
|
+
# [*replace_users*]
|
|
29
|
+
# Override any values specified in add_users. If you specify this value
|
|
30
|
+
# in your manifest or Hiera database, the contents of "add_users" will
|
|
31
|
+
# be ignored. With Hiera, a standard priority lookup is used. Note that
|
|
32
|
+
# if replace_users is specified at ANY level of the hierarchy, then
|
|
33
|
+
# add_users is ignored at EVERY level of the hierarchy.
|
|
34
|
+
# Default: undef
|
|
35
|
+
#
|
|
36
|
+
# [*replace_groups*]
|
|
37
|
+
# Override any values specified in add_groups. If you specify this value
|
|
38
|
+
# in your manifest or Hiera database, the contents of "add_groups" will
|
|
39
|
+
# be ignored. With Hiera, a standard priority lookup is used. Note that
|
|
40
|
+
# if replace_groups is specified at ANY level of the hierarchy, then
|
|
41
|
+
# add_groups is ignored at EVERY level of the hierarchy.
|
|
42
|
+
# Default: undef
|
|
43
|
+
#
|
|
44
|
+
# Actions:
|
|
45
|
+
# Creates file in sudoers.d that permits specific users and groups to sudo.
|
|
46
|
+
#
|
|
47
|
+
# Sample Usage:
|
|
48
|
+
# class { 'sudo::allow':
|
|
49
|
+
# add_users => ['jsmith'],
|
|
50
|
+
# add_groups => ['wheel'],
|
|
51
|
+
# }
|
|
52
|
+
#
|
|
53
|
+
# [Remember: No empty lines between comments and class definition]
|
|
54
|
+
class sudo::allow(
|
|
55
|
+
$add_users = [],
|
|
56
|
+
$add_groups = [],
|
|
57
|
+
$replace_users = undef,
|
|
58
|
+
$replace_groups = undef
|
|
59
|
+
) {
|
|
60
|
+
# TODO validate that all input is arrays
|
|
61
|
+
|
|
62
|
+
if $replace_users != undef {
|
|
63
|
+
$users = $replace_users
|
|
64
|
+
} else {
|
|
65
|
+
$users = hiera_array("${module_name}::allow::add_users", $add_users)
|
|
66
|
+
}
|
|
67
|
+
if $replace_groups != undef {
|
|
68
|
+
$groups = $replace_groups
|
|
69
|
+
} else {
|
|
70
|
+
$groups = hiera_array("${module_name}::allow::add_groups", $add_groups)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
sudo::conf { 'sudo_users_groups':
|
|
74
|
+
content => template("${module_name}/users_groups.erb"),
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Define: sudo::conf
|
|
2
|
+
#
|
|
3
|
+
# This module manages sudo configurations
|
|
4
|
+
#
|
|
5
|
+
# Parameters:
|
|
6
|
+
# [*ensure*]
|
|
7
|
+
# Ensure if present or absent.
|
|
8
|
+
# Default: present
|
|
9
|
+
#
|
|
10
|
+
# [*priority*]
|
|
11
|
+
# Prefix file name with $priority
|
|
12
|
+
# Default: 10
|
|
13
|
+
#
|
|
14
|
+
# [*content*]
|
|
15
|
+
# Content of configuration snippet.
|
|
16
|
+
# Default: undef
|
|
17
|
+
#
|
|
18
|
+
# [*source*]
|
|
19
|
+
# Source of configuration snippet.
|
|
20
|
+
# Default: undef
|
|
21
|
+
#
|
|
22
|
+
# [*sudo_config_dir*]
|
|
23
|
+
# Where to place configuration snippets.
|
|
24
|
+
# Only set this, if your platform is not supported or
|
|
25
|
+
# you know, what you're doing.
|
|
26
|
+
# Default: auto-set, platform specific
|
|
27
|
+
#
|
|
28
|
+
# Actions:
|
|
29
|
+
# Installs sudo configuration snippets
|
|
30
|
+
#
|
|
31
|
+
# Requires:
|
|
32
|
+
# Class sudo
|
|
33
|
+
#
|
|
34
|
+
# Sample Usage:
|
|
35
|
+
# sudo::conf { 'admins':
|
|
36
|
+
# source => 'puppet:///files/etc/sudoers.d/admins',
|
|
37
|
+
# }
|
|
38
|
+
#
|
|
39
|
+
# [Remember: No empty lines between comments and class definition]
|
|
40
|
+
define sudo::conf(
|
|
41
|
+
$ensure = present,
|
|
42
|
+
$priority = 10,
|
|
43
|
+
$content = undef,
|
|
44
|
+
$source = undef,
|
|
45
|
+
$sudo_config_dir = undef
|
|
46
|
+
) {
|
|
47
|
+
|
|
48
|
+
include sudo
|
|
49
|
+
|
|
50
|
+
# Hack to allow the user to set the config_dir from the
|
|
51
|
+
# sudo::config parameter, but default to $sudo::params::config_dir
|
|
52
|
+
# if it is not provided. $sudo::params isn't included before
|
|
53
|
+
# the parameters are loaded in.
|
|
54
|
+
$sudo_config_dir_real = $sudo_config_dir ? {
|
|
55
|
+
undef => $sudo::params::config_dir,
|
|
56
|
+
$sudo_config_dir => $sudo_config_dir
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# sudo skip file name that contain a "."
|
|
60
|
+
$dname = regsubst($name, '\.', '-', 'G')
|
|
61
|
+
|
|
62
|
+
# build current file name with path
|
|
63
|
+
$cur_file = "${sudo_config_dir_real}${priority}_${dname}"
|
|
64
|
+
|
|
65
|
+
Class['sudo'] -> Sudo::Conf[$name]
|
|
66
|
+
|
|
67
|
+
if $content != undef {
|
|
68
|
+
$content_real = "${content}\n"
|
|
69
|
+
} else {
|
|
70
|
+
$content_real = undef
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if $ensure == 'present' {
|
|
74
|
+
$notify_real = Exec["sudo-syntax-check for file ${cur_file}"]
|
|
75
|
+
} else {
|
|
76
|
+
$notify_real = undef
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
file { "${priority}_${dname}":
|
|
80
|
+
ensure => $ensure,
|
|
81
|
+
path => $cur_file,
|
|
82
|
+
owner => 'root',
|
|
83
|
+
group => $sudo::params::config_file_group,
|
|
84
|
+
mode => '0440',
|
|
85
|
+
source => $source,
|
|
86
|
+
content => $content_real,
|
|
87
|
+
notify => $notify_real,
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
exec {"sudo-syntax-check for file ${cur_file}":
|
|
91
|
+
command => "visudo -c || ( rm -f '${cur_file}' && exit 1)",
|
|
92
|
+
refreshonly => true,
|
|
93
|
+
path => [
|
|
94
|
+
'/bin',
|
|
95
|
+
'/sbin',
|
|
96
|
+
'/usr/bin',
|
|
97
|
+
'/usr/sbin',
|
|
98
|
+
'/usr/local/bin',
|
|
99
|
+
'/usr/local/sbin'
|
|
100
|
+
],
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
File["${priority}_${dname}"] ->
|
|
104
|
+
Exec["sudo-syntax-check for file ${cur_file}"]
|
|
105
|
+
}
|