From ee7a117d630ebdc8f143903c7baf8cdbd3d1e669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Fri, 4 Dec 2020 16:29:22 +0100 Subject: [PATCH] Add initial kosmos_zerotier cookbook For now it only includes the firewall rule Refs #244 --- site-cookbooks/kosmos_zerotier/.gitignore | 22 ++++ site-cookbooks/kosmos_zerotier/CHANGELOG.md | 7 ++ site-cookbooks/kosmos_zerotier/LICENSE | 21 ++++ site-cookbooks/kosmos_zerotier/README.md | 4 + .../kosmos_zerotier/attributes/default.rb | 1 + site-cookbooks/kosmos_zerotier/chefignore | 110 ++++++++++++++++++ site-cookbooks/kosmos_zerotier/kitchen.yml | 32 +++++ site-cookbooks/kosmos_zerotier/metadata.rb | 10 ++ .../kosmos_zerotier/recipes/default.rb | 25 ++++ .../kosmos_zerotier/recipes/firewall.rb | 31 +++++ 10 files changed, 263 insertions(+) create mode 100644 site-cookbooks/kosmos_zerotier/.gitignore create mode 100644 site-cookbooks/kosmos_zerotier/CHANGELOG.md create mode 100644 site-cookbooks/kosmos_zerotier/LICENSE create mode 100644 site-cookbooks/kosmos_zerotier/README.md create mode 100644 site-cookbooks/kosmos_zerotier/attributes/default.rb create mode 100644 site-cookbooks/kosmos_zerotier/chefignore create mode 100644 site-cookbooks/kosmos_zerotier/kitchen.yml create mode 100644 site-cookbooks/kosmos_zerotier/metadata.rb create mode 100644 site-cookbooks/kosmos_zerotier/recipes/default.rb create mode 100644 site-cookbooks/kosmos_zerotier/recipes/firewall.rb diff --git a/site-cookbooks/kosmos_zerotier/.gitignore b/site-cookbooks/kosmos_zerotier/.gitignore new file mode 100644 index 0000000..9abf29f --- /dev/null +++ b/site-cookbooks/kosmos_zerotier/.gitignore @@ -0,0 +1,22 @@ +.vagrant +*~ +*# +.#* +\#*# +.*.sw[a-z] +*.un~ + +# Bundler +Gemfile.lock +gems.locked +bin/* +.bundle/* + +# test kitchen +.kitchen/ +kitchen.local.yml + +# Chef +Berksfile.lock +.zero-knife.rb +Policyfile.lock.json diff --git a/site-cookbooks/kosmos_zerotier/CHANGELOG.md b/site-cookbooks/kosmos_zerotier/CHANGELOG.md new file mode 100644 index 0000000..a5b0f4e --- /dev/null +++ b/site-cookbooks/kosmos_zerotier/CHANGELOG.md @@ -0,0 +1,7 @@ +# kosmos_zerotier CHANGELOG + +# 0.1.0 + +Initial release. + +- For now this only contains the firewall rule diff --git a/site-cookbooks/kosmos_zerotier/LICENSE b/site-cookbooks/kosmos_zerotier/LICENSE new file mode 100644 index 0000000..dd321fd --- /dev/null +++ b/site-cookbooks/kosmos_zerotier/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 Kosmos Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/site-cookbooks/kosmos_zerotier/README.md b/site-cookbooks/kosmos_zerotier/README.md new file mode 100644 index 0000000..8645fb0 --- /dev/null +++ b/site-cookbooks/kosmos_zerotier/README.md @@ -0,0 +1,4 @@ +# kosmos_zerotier + +TODO: Enter the cookbook description here. + diff --git a/site-cookbooks/kosmos_zerotier/attributes/default.rb b/site-cookbooks/kosmos_zerotier/attributes/default.rb new file mode 100644 index 0000000..5f017af --- /dev/null +++ b/site-cookbooks/kosmos_zerotier/attributes/default.rb @@ -0,0 +1 @@ +node.default["kosmos_zerotier"]["server_port"] = 9993 diff --git a/site-cookbooks/kosmos_zerotier/chefignore b/site-cookbooks/kosmos_zerotier/chefignore new file mode 100644 index 0000000..5039e1c --- /dev/null +++ b/site-cookbooks/kosmos_zerotier/chefignore @@ -0,0 +1,110 @@ +# Put files/directories that should be ignored in this file when uploading +# to a Chef Infra Server or Supermarket. +# Lines that start with '# ' are comments. + +# OS generated files # +###################### +.DS_Store +ehthumbs.db +Icon? +nohup.out +Thumbs.db + +# SASS # +######## +.sass-cache + +# EDITORS # +########### +.#* +.project +.settings +*_flymake +*_flymake.* +*.bak +*.sw[a-z] +*.tmproj +*~ +\#* +mkmf.log +REVISION +TAGS* +tmtags + +## COMPILED ## +############## +*.class +*.com +*.dll +*.exe +*.o +*.pyc +*.so +*/rdoc/ +a.out + +# Testing # +########### +.circleci/* +.codeclimate.yml +.foodcritic +.kitchen* +.rspec +.rubocop.yml +.travis.yml +.watchr +azure-pipelines.yml +examples/* +features/* +Guardfile +kitchen.yml* +Procfile +Rakefile +spec/* +spec/* +spec/fixtures/* +test/* + +# SCM # +####### +.git +.gitattributes +.gitconfig +.github/* +.gitignore +.gitmodules +.svn +*/.bzr/* +*/.git +*/.hg/* +*/.svn/* + +# Berkshelf # +############# +Berksfile +Berksfile.lock +cookbooks/* +tmp + +# Bundler # +########### +vendor/* +Gemfile +Gemfile.lock + +# Policyfile # +############## +Policyfile.rb +Policyfile.lock.json + +# Cookbooks # +############# +CHANGELOG* +CONTRIBUTING* +TESTING* +CODE_OF_CONDUCT* + +# Vagrant # +########### +.vagrant +Vagrantfile diff --git a/site-cookbooks/kosmos_zerotier/kitchen.yml b/site-cookbooks/kosmos_zerotier/kitchen.yml new file mode 100644 index 0000000..e5bbf3c --- /dev/null +++ b/site-cookbooks/kosmos_zerotier/kitchen.yml @@ -0,0 +1,32 @@ +--- +driver: + name: vagrant + +## The forwarded_port port feature lets you connect to ports on the VM guest via +## localhost on the host. +## see also: https://www.vagrantup.com/docs/networking/forwarded_ports.html + +# network: +# - ["forwarded_port", {guest: 80, host: 8080}] + +provisioner: + name: chef_zero + + ## product_name and product_version specifies a specific Chef product and version to install. + ## see the Chef documentation for more details: https://docs.chef.io/config_yml_kitchen.html + # product_name: chef + # product_version: 15 + +verifier: + name: inspec + +platforms: + - name: ubuntu-18.04 + - name: centos-7 + +suites: + - name: default + verifier: + inspec_tests: + - test/integration/default + attributes: diff --git a/site-cookbooks/kosmos_zerotier/metadata.rb b/site-cookbooks/kosmos_zerotier/metadata.rb new file mode 100644 index 0000000..d090fa9 --- /dev/null +++ b/site-cookbooks/kosmos_zerotier/metadata.rb @@ -0,0 +1,10 @@ +name 'kosmos_zerotier' +maintainer 'Kosmos Developers' +maintainer_email 'mail@kosmos.org' +license 'MIT' +description 'Installs/Configures kosmos_zerotier' +long_description 'Installs/Configures kosmos_zerotier' +version '0.1.0' +chef_version '>= 14.0' + +depends 'kosmos-base' diff --git a/site-cookbooks/kosmos_zerotier/recipes/default.rb b/site-cookbooks/kosmos_zerotier/recipes/default.rb new file mode 100644 index 0000000..1125c4a --- /dev/null +++ b/site-cookbooks/kosmos_zerotier/recipes/default.rb @@ -0,0 +1,25 @@ +# +# Cookbook:: kosmos_zerotier +# Recipe:: default +# +# The MIT License (MIT) +# +# Copyright:: 2020, Kosmos Developers +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. diff --git a/site-cookbooks/kosmos_zerotier/recipes/firewall.rb b/site-cookbooks/kosmos_zerotier/recipes/firewall.rb new file mode 100644 index 0000000..b179103 --- /dev/null +++ b/site-cookbooks/kosmos_zerotier/recipes/firewall.rb @@ -0,0 +1,31 @@ +# +# Cookbook:: kosmos_zerotier +# Recipe:: firewall +# +# The MIT License (MIT) +# +# Copyright:: 2020, Kosmos Developers +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +firewall_rule "zerotier" do + port node["kosmos_zerotier"]["server_port"] + protocol :tcp + command :allow +end