aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.fixtures.yml3
-rw-r--r--.gitignore4
-rw-r--r--.rspec4
-rw-r--r--.travis.yml27
-rw-r--r--Gemfile14
-rw-r--r--Gemfile.lock116
-rw-r--r--LICENSE674
-rw-r--r--Modulefile10
-rw-r--r--Puppetfile3
-rw-r--r--Puppetfile.lock8
-rw-r--r--README246
-rw-r--r--README.md247
-rw-r--r--Rakefile16
-rw-r--r--files/autossh.init.d164
-rw-r--r--files/modules_dir/.ignore0
-rw-r--r--lib/facter/ssh_version.rb5
-rw-r--r--lib/puppet/parser/functions/ssh_keygen.rb6
-rw-r--r--manifests/autossh.pp40
-rw-r--r--manifests/base.pp52
-rw-r--r--manifests/client/base.pp7
-rw-r--r--manifests/debian.pp16
-rw-r--r--manifests/init.pp45
-rw-r--r--manifests/linux.pp2
-rw-r--r--manifests/nagios.pp6
-rw-r--r--manifests/openbsd.pp6
-rw-r--r--manifests/redhat.pp8
-rw-r--r--manifests/ssh_authorized_key.pp69
-rw-r--r--manifests/sshkey.pp21
-rw-r--r--spec/classes/client_spec.rb42
-rw-r--r--spec/classes/init_spec.rb122
-rw-r--r--spec/defines/ssh_authorized_key_spec.rb45
-rw-r--r--spec/functions/ssh_keygen_spec.rb (renamed from spec/unit/parser/functions/ssh_keygen.rb)74
-rw-r--r--spec/spec.opts6
-rw-r--r--spec/spec_helper.rb29
-rw-r--r--spec/spec_helper_system.rb25
-rw-r--r--templates/sshd_config/CentOS.erb154
l---------templates/sshd_config/CentOS_5.erb1
-rw-r--r--templates/sshd_config/CentOS_6.erb172
-rw-r--r--templates/sshd_config/CentOS_7.erb186
-rw-r--r--templates/sshd_config/CentOS_Final.erb154
-rw-r--r--templates/sshd_config/Debian_etch.erb122
-rw-r--r--templates/sshd_config/Debian_jessie.erb84
-rw-r--r--templates/sshd_config/Debian_lenny.erb127
-rw-r--r--templates/sshd_config/Debian_sid.erb83
-rw-r--r--templates/sshd_config/Debian_squeeze.erb68
-rw-r--r--templates/sshd_config/Debian_wheezy.erb74
-rw-r--r--templates/sshd_config/FreeBSD.erb65
-rw-r--r--templates/sshd_config/Gentoo.erb52
-rw-r--r--templates/sshd_config/OpenBSD.erb50
-rw-r--r--templates/sshd_config/Ubuntu.erb72
-rw-r--r--templates/sshd_config/Ubuntu_lucid.erb62
l---------templates/sshd_config/Ubuntu_quantal.erb1
l---------templates/sshd_config/Ubuntu_raring.erb1
l---------templates/sshd_config/Ubuntu_saucy.erb1
l---------templates/sshd_config/Ubuntu_trusty.erb2
l---------templates/sshd_config/Ubuntu_utopic.erb1
l---------templates/sshd_config/Ubuntu_vivid.erb1
l---------templates/sshd_config/Ubuntu_wily.erb1
l---------templates/sshd_config/Ubuntu_xenial.erb1
l---------templates/sshd_config/XenServer_xenenterprise.erb1
60 files changed, 2489 insertions, 1209 deletions
diff --git a/.fixtures.yml b/.fixtures.yml
new file mode 100644
index 0000000..42598a6
--- /dev/null
+++ b/.fixtures.yml
@@ -0,0 +1,3 @@
+fixtures:
+ symlinks:
+ sshd: "#{source_dir}" \ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5ebb01f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+.librarian/*
+.tmp/*
+*.log
+spec/fixtures/*
diff --git a/.rspec b/.rspec
new file mode 100644
index 0000000..f07c903
--- /dev/null
+++ b/.rspec
@@ -0,0 +1,4 @@
+--format documentation
+--color
+--pattern "spec/*/*_spec.rb"
+#--backtrace
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..7bd2a2b
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,27 @@
+before_install:
+ - gem update --system 2.1.11
+ - gem --version
+rvm:
+ - 1.8.7
+ - 1.9.3
+ - 2.0.0
+script: 'bundle exec rake spec'
+env:
+ - PUPPET_VERSION="~> 2.7.0"
+ - PUPPET_VERSION="~> 3.0.0"
+ - PUPPET_VERSION="~> 3.1.0"
+ - PUPPET_VERSION="~> 3.2.0"
+ - PUPPET_VERSION="~> 3.3.0"
+ - PUPPET_VERSION="~> 3.4.0"
+matrix:
+ exclude:
+ # No support for Ruby 1.9 before Puppet 2.7
+ - rvm: 1.9.3
+ env: PUPPET_VERSION=2.6.0
+ # No support for Ruby 2.0 before Puppet 3.2
+ - rvm: 2.0.0
+ env: PUPPET_VERSION="~> 2.7.0"
+ - rvm: 2.0.0
+ env: PUPPET_VERSION="~> 3.0.0"
+ - rvm: 2.0.0
+ env: PUPPET_VERSION="~> 3.1.0"
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..ef74f90
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,14 @@
+source 'https://rubygems.org'
+
+group :development, :test do
+ gem 'puppet', '>= 2.7.0'
+ gem 'puppet-lint', '>=0.3.2'
+ gem 'puppetlabs_spec_helper', '>=0.2.0'
+ gem 'rake', '>=0.9.2.2'
+ gem 'librarian-puppet', '>=0.9.10'
+ gem 'rspec-system-puppet', :require => false
+ gem 'serverspec', :require => false
+ gem 'rspec-system-serverspec', :require => false
+ gem 'rspec-hiera-puppet'
+ gem 'rspec-puppet', :git => 'https://github.com/rodjek/rspec-puppet.git'
+end \ No newline at end of file
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 0000000..0c2c58e
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,116 @@
+GIT
+ remote: https://github.com/rodjek/rspec-puppet.git
+ revision: c44381a240ec420d4ffda7bffc55ee4d9c08d682
+ specs:
+ rspec-puppet (1.0.1)
+ rspec
+
+GEM
+ remote: https://rubygems.org/
+ specs:
+ builder (3.2.2)
+ diff-lcs (1.2.5)
+ excon (0.31.0)
+ facter (1.7.4)
+ fog (1.19.0)
+ builder
+ excon (~> 0.31.0)
+ formatador (~> 0.2.0)
+ mime-types
+ multi_json (~> 1.0)
+ net-scp (~> 1.1)
+ net-ssh (>= 2.1.3)
+ nokogiri (~> 1.5)
+ ruby-hmac
+ formatador (0.2.4)
+ hiera (1.3.1)
+ json_pure
+ hiera-puppet (1.0.0)
+ hiera (~> 1.0)
+ highline (1.6.20)
+ json (1.8.1)
+ json_pure (1.8.1)
+ kwalify (0.7.2)
+ librarian-puppet (0.9.10)
+ json
+ thor (~> 0.15)
+ metaclass (0.0.2)
+ mime-types (1.25.1)
+ mocha (1.0.0)
+ metaclass (~> 0.0.1)
+ multi_json (1.8.4)
+ net-scp (1.1.2)
+ net-ssh (>= 2.6.5)
+ net-ssh (2.7.0)
+ nokogiri (1.5.11)
+ puppet (3.4.2)
+ facter (~> 1.6)
+ hiera (~> 1.0)
+ rgen (~> 0.6.5)
+ puppet-lint (0.3.2)
+ puppetlabs_spec_helper (0.4.1)
+ mocha (>= 0.10.5)
+ rake
+ rspec (>= 2.9.0)
+ rspec-puppet (>= 0.1.1)
+ rake (10.1.1)
+ rbvmomi (1.8.1)
+ builder
+ nokogiri (>= 1.4.1)
+ trollop
+ rgen (0.6.6)
+ rspec (2.14.1)
+ rspec-core (~> 2.14.0)
+ rspec-expectations (~> 2.14.0)
+ rspec-mocks (~> 2.14.0)
+ rspec-core (2.14.7)
+ rspec-expectations (2.14.4)
+ diff-lcs (>= 1.1.3, < 2.0)
+ rspec-hiera-puppet (1.0.0)
+ hiera (>= 1.0)
+ hiera-puppet (>= 1.0)
+ puppet (>= 3.0)
+ rspec
+ rspec-puppet
+ rspec-mocks (2.14.4)
+ rspec-system (2.8.0)
+ fog (~> 1.18)
+ kwalify (~> 0.7.2)
+ mime-types (~> 1.16)
+ net-scp (~> 1.1)
+ net-ssh (~> 2.7)
+ nokogiri (~> 1.5.10)
+ rbvmomi (~> 1.6)
+ rspec (~> 2.14)
+ systemu (~> 2.5)
+ rspec-system-puppet (2.2.1)
+ rspec-system (~> 2.0)
+ rspec-system-serverspec (2.0.1)
+ rspec-system (~> 2.0)
+ serverspec (~> 0.0)
+ specinfra (~> 0.0)
+ ruby-hmac (0.4.0)
+ serverspec (0.14.4)
+ highline
+ net-ssh
+ rspec (>= 2.13.0)
+ specinfra (>= 0.1.0)
+ specinfra (0.4.1)
+ systemu (2.6.0)
+ thor (0.18.1)
+ trollop (2.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ librarian-puppet (>= 0.9.10)
+ puppet (>= 2.7.0)
+ puppet-lint (>= 0.3.2)
+ puppetlabs_spec_helper (>= 0.2.0)
+ rake (>= 0.9.2.2)
+ rspec-hiera-puppet
+ rspec-puppet!
+ rspec-system-puppet
+ rspec-system-serverspec
+ serverspec
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/Modulefile b/Modulefile
new file mode 100644
index 0000000..5e4f92d
--- /dev/null
+++ b/Modulefile
@@ -0,0 +1,10 @@
+name 'puppet-sshd'
+version '0.1.0'
+source 'https://github.com/duritong/puppet-sshd'
+author 'duritong'
+license 'Apache License, Version 2.0'
+summary 'ssh daemon configuration'
+description 'Manages sshd_config'
+project_page 'https://github.com/duritong/puppet-sshd'
+
+dependency 'puppetlabs/stdlib', '>= 2.0.0' \ No newline at end of file
diff --git a/Puppetfile b/Puppetfile
new file mode 100644
index 0000000..166d3b4
--- /dev/null
+++ b/Puppetfile
@@ -0,0 +1,3 @@
+forge 'http://forge.puppetlabs.com'
+
+mod 'puppetlabs/stdlib', '>=2.0.0' \ No newline at end of file
diff --git a/Puppetfile.lock b/Puppetfile.lock
new file mode 100644
index 0000000..f938185
--- /dev/null
+++ b/Puppetfile.lock
@@ -0,0 +1,8 @@
+FORGE
+ remote: http://forge.puppetlabs.com
+ specs:
+ puppetlabs/stdlib (4.1.0)
+
+DEPENDENCIES
+ puppetlabs/stdlib (>= 2.0.0)
+
diff --git a/README b/README
deleted file mode 100644
index a5a00af..0000000
--- a/README
+++ /dev/null
@@ -1,246 +0,0 @@
-Introduction
-============
-
-This puppet module manages OpenSSH configuration and services.
-
-!! Upgrade Notice (01/2013) !!
-
-This module now uses parameterized classes, where it used global variables
-before. So please whatch out before pulling, you need to change the
-class declarations in your manifest !
-
-
-Dependencies
-------------
-
-This module requires puppet => 2.6, and the following modules are required
-pre-dependencies:
-
-- shared-common: git://labs.riseup.net/shared-common
-- shared-lsb: git://labs.riseup.net/shared-lsb
-
-OpenSSH Server
-==============
-
-On a node where you wish to have an openssh server installed, you should
-'include sshd' on that node. If you need to configure any aspects of
-sshd_config, set the variables before the include. See 'Configurable Variables'
-below for what you can set.
-
-Nagios
-------
-
-To have nagios checks setup automatically for sshd services, simply set
-manage_nagios to true for that class. If you want to disable ssh
-nagios checking for a particular node (such as when ssh is firewalled), then you
-can set the class parameter nagios_check_ssh to false and that node will not bei
-monitored.
-
-Nagios will automatically check the ports defined in $sshd::ports, and the
-hostname specified by $nagios_check_ssh_hostname.
-
-NOTE: this requires that you are using the shared-nagios puppet module which
-supports the nagios native types via nagios::service:
-git://labs.riseup.net/shared-nagios
-
-Firewall
---------
-
-If you wish to have firewall rules setup automatically for you, using shorewall,
-you will need to set: $use_shorewall = true. The $sshd_ports that you have
-specified will automatically be used.
-
-NOTE: This requires that you are using the shared-shorewall puppet module:
-git://labs.riseup.net/shared-shorewall
-
-
-Configurable variables
-----------------------
-
-Configuration of sshd is strict, and may not fit all needs, however there are a
-number of variables that you can consider configuring. The defaults are set to
-the distribution shipped sshd_config file defaults.
-
-To set any of these variables, simply set them as variables in your manifests,
-before the class is included, for example:
-
- $sshd_listen_address = ['10.0.0.1 192.168.0.1']
- $sshd_use_pam = yes
- include sshd
-
-If you need to install a version of the ssh daemon or client package other than
-the default one that would be installed by 'ensure => installed', then you can
-set the following variables:
-
- $sshd_ensure_version = "1:5.2p2-6"
- $ssh_ensure_version = "1:5.2p2-6"
-
-The following is a list of the currently available variables:
-
- $sshd_listen_address
- specify the addresses sshd should listen on set this to ['10.0.0.1
- 192.168.0.1'] to have it listen on both addresses, or leave it unset to
- listen on all Default: empty -> results in listening on 0.0.0.0
-
- $sshd_allowed_users
- list of usernames separated by spaces. set this for example to "foobar
- root" to ensure that only user foobar and root might login. Default: empty
- -> no restriction is set
-
- $sshd_allowed_groups
- list of groups separated by spaces. set this for example to "wheel sftponly"
- to ensure that only users in the groups wheel and sftponly might login.
- Default: empty -> no restriction is set Note: This is set after
- sshd_allowed_users, take care of the behaviour if you use these 2 options
- together.
-
- $sshd_use_pam
- if you want to use pam or not for authenticaton. Values: no or yes; Default:
- no
-
- $sshd_permit_root_login
- If you want to allow root logins or not. Valid values: yes, no,
- without-password, forced-commands-only; Default: without-password
-
- $sshd_password_authentication
- If you want to enable password authentication or not. Valid values: yes or
- no; Default: no
-
- $sshd_kerberos_authentication
- If you want the password that is provided by the user to be validated
- through the Kerberos KDC. To use this option the server needs a Kerberos
- servtab which allows the verification of the KDC's identity. Valid values:
- yes or no; Default: no
-
- $sshd_kerberos_orlocalpasswd
- If password authentication through Kerberos fails, then the password will be
- validated via any additional local mechanism. Valid values: yes or no;
- Default: yes
-
- $sshd_kerberos_ticketcleanup
- Destroy the user's ticket cache file on logout? Valid values: yes or no;
- Default: yes
-
- $sshd_gssapi_authentication
- Authenticate users based on GSSAPI? Valid values: yes or no; Default: no
-
- $sshd_gssapi_cleanupcredentials
- Destroy user's credential cache on logout? Valid values: yes or no; Default:
- yes
-
- $sshd_challenge_response_authentication
- If you want to enable ChallengeResponseAuthentication or not When disabled,
- s/key passowords are disabled Valid values: yes or no; Default: no
-
- $sshd_tcp_forwarding
- If you want to enable TcpForwarding. Valid Values: yes or no; Default: no
-
- $sshd_x11_forwarding
- If you want to enable x11 forwarding. Valid Values: yes or no; Default: no
-
- $sshd_agent_forwarding
- If you want to allow ssh-agent forwarding. Valid Values: yes or no; Default:
- no
-
- $sshd_pubkey_authentication
- If you want to enable public key authentication. Valid Values: yes or no;
- Default: yes
-
- $sshd_rsa_authentication
- If you want to enable RSA Authentication. Valid Values: yes or no; Default:
- no
-
- $sshd_rhosts_rsa_authentication
- If you want to enable rhosts RSA Authentication. Valid Values: yes or no;
- Default: no
-
- $sshd_hostbased_authentication
- If you want to enable HostbasedAuthentication. Valid Values: yes or no;
- Default: no
-
- $sshd_strict_modes
- If you want to set StrictModes (check file modes/ownership before accepting
- login). Valid Values: yes or no; Default: yes
-
- $sshd_permit_empty_passwords
- If you want enable PermitEmptyPasswords to allow empty passwords. Valid
- Values: yes or no; Default: no
-
- $sshd_port
- Deprecated, use sshd_ports instead.
-
- $sshd_ports
- If you want to specify a list of ports other than the default 22; Default:
- [22]
-
- $sshd_authorized_keys_file
- Set this to the location of the AuthorizedKeysFile
- (e.g. /etc/ssh/authorized_keys/%u). Default: AuthorizedKeysFile
- %h/.ssh/authorized_keys
-
- $sshd_hardened_ssl
- Use only strong SSL ciphers and MAC.
- Values: no or yes; Default: no.
-
- $sshd_print_motd
- Show the Message of the day when a user logs in.
-
- $sshd_sftp_subsystem
- Set a different sftp-subystem than the default one. Might be interesting for
- sftponly usage. Default: empty -> no change of the default
-
- $sshd_head_additional_options
- Set this to any additional sshd_options which aren't listed above. Anything
- set here will be added to the beginning of the sshd_config file. This option
- might be useful to define complicated Match Blocks. This string is going to
- be included, like it is defined. So take care! Default: empty -> not added.
-
- $sshd_tail_additional_options
-
- Set this to any additional sshd_options which aren't listed above. Anything
- set here will be added to the end of the sshd_config file. This option might
- be useful to define complicated Match Blocks. This string is going to be
- included, like it is defined. So take care! Default: empty -> not added.
-
- $sshd_shared_ip
- Whether the server uses a shared network IP address. If it does, then we
- don't want it to export an rsa key for its IP address.
- Values: no or yes; Default: no
-
-
-Defines and functions
----------------------
-
-Deploy authorized_keys file with the define sshd::ssh_authorized_key.
-
-Generate a public/private keypair with the ssh_keygen function. For example, the
-following will generate ssh keys and put the different parts of the key into
-variables:
-
-$ssh_keys = ssh_keygen("${$ssh_key_basepath}/backup/keys/${::fqdn}/${backup_host}")
-$public_key = split($ssh_keys[1],' ')
-$sshkey_type => $public_key[0]
-$sshkey => $public_key[1]
-
-
-Client
-======
-
-On a node where you wish to have the ssh client managed, you can do 'include
-sshd::client' in the node definition. This will install the appropriate package.
-
-
-License
-=======
-
-# Copyright 2008-2011, Riseup Labs micah@riseup.net
-# Copyright 2008, admin(at)immerda.ch
-# Copyright 2008, Puzzle ITC GmbH
-# Marcel Haerry haerry+puppet(at)puzzle.ch
-# Simon Josi josi+puppet(at)puzzle.ch
-#
-# This program is free software; you can redistribute
-# it and/or modify it under the terms of the GNU
-# General Public License version 3 as published by
-# the Free Software Foundation.
-#
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..77e4d29
--- /dev/null
+++ b/README.md
@@ -0,0 +1,247 @@
+# Puppet SSH Module
+
+[![Build Status](https://travis-ci.org/duritong/puppet-sshd.png?branch=master)](https://travis-ci.org/duritong/puppet-sshd)
+
+This puppet module manages OpenSSH configuration and services.
+
+**!! Upgrade Notice (05/2015) !!**
+
+The hardened_ssl parameter name was changed to simply 'hardened'.
+
+**!! Upgrade Notice (01/2013) !!**
+
+This module now uses parameterized classes, where it used global variables
+before. So please whatch out before pulling, you need to change the
+class declarations in your manifest !
+
+
+### Dependencies
+
+This module requires puppet => 2.6, and the following modules are required
+pre-dependencies:
+
+- [puppetlabs/stdlib](https://github.com/puppetlabs/puppetlabs-stdlib) >= 2.x
+
+## OpenSSH Server
+
+On a node where you wish to have an openssh server installed, you should
+include
+
+```puppet
+class { 'sshd': }
+```
+
+on that node. If you need to configure any aspects of sshd_config, set the variables before the include. Or you can adjust many parameters:
+
+```puppet
+class { 'sshd':
+ ports => [ 20002 ],
+ permit_root_login => 'no',
+}
+```
+
+See Configurable Variables below for what you can set.
+
+### Nagios
+
+To have nagios checks setup automatically for sshd services, simply set
+`manage_nagios` to `true` for that class. If you want to disable ssh
+nagios checking for a particular node (such as when ssh is firewalled), then you
+can set the class parameter `nagios_check_ssh` to `false` and that node will not be
+monitored.
+
+Nagios will automatically check the ports defined in `ports`, and the
+hostname specified by `nagios_check_ssh_hostname`.
+
+Note that if you need to use some specific logic to decide whether or not to
+create a nagios service check, you should set $manage_nagios to false, and
+use sshd::nagios from within your own manifests. You'll also need to manually
+specify the port to that define. By default, if the $port parameter is not
+specified, it will use the resource name as the port (e.g. if you call it like
+this: `sshd::nagios { '22': }` )
+
+NOTE: this requires that you are using the shared-nagios puppet module which
+supports the nagios native types via `nagios::service`:
+
+https://gitlab.com/shared-puppet-modules-group/sshd
+
+### Firewall
+
+If you wish to have firewall rules setup automatically for you, using shorewall,
+you will need to set: `use_shorewall => true`. The `ports` that you have
+specified will automatically be used.
+
+NOTE: This requires that you are using the shared-shorewall puppet module:
+git://labs.riseup.net/shared-shorewall
+
+
+### Configurable variables
+
+Configuration of sshd is strict, and may not fit all needs, however there are a
+number of variables that you can consider configuring. The defaults are set to
+the distribution shipped sshd_config file defaults.
+
+To set any of these variables, simply set them as variables in your manifests,
+before the class is included, for example:
+
+```puppet
+class {'sshd':
+ listen_address => ['10.0.0.1', '192.168.0.1'],
+ use_pam => yes
+}
+```
+
+If you need to install a version of the ssh daemon or client package other than
+the default one that would be installed by `ensure => installed`, then you can
+set the following variables:
+
+```puppet
+class {'sshd':
+ ensure_version => "1:5.2p2-6"
+}
+```
+
+The following is a list of the currently available variables:
+
+ - `listen_address`
+ specify the addresses sshd should listen on set this to `['10.0.0.1', '192.168.0.1']` to have it listen on both addresses, or leave it unset to listen on all Default: empty -> results in listening on `0.0.0.0`
+ - `allowed_users`
+ list of usernames separated by spaces. set this for example to `"foobar
+ root"` to ensure that only user foobar and root might login. Default: empty
+ -> no restriction is set
+ - `allowed_groups`
+ list of groups separated by spaces. set this for example to `"wheel sftponly"`
+ to ensure that only users in the groups wheel and sftponly might login.
+ Default: empty -> no restriction is set Note: This is set after
+ `allowed_users`, take care of the behaviour if you use these 2 options
+ together.
+ - `use_pam` if you want to use pam or not for authenticaton. Values:
+ - `no` (default)
+ - `yes`
+ - `permit_root_login` If you want to allow root logins or not. Valid values:
+ - `yes`
+ - `no`
+ - `without-password` (default)
+ - `forced-commands-only`
+ - `password_authentication`
+ If you want to enable password authentication or not. Valid values:
+ - `yes`
+ - `no` (default)
+ - `kerberos_authentication`
+ If you want the password that is provided by the user to be validated
+ through the Kerberos KDC. To use this option the server needs a Kerberos
+ servtab which allows the verification of the KDC's identity. Valid values:
+ - `yes`
+ - `no` (default)
+ - `kerberos_orlocalpasswd` If password authentication through Kerberos fails, then the password will be validated via any additional local mechanism. Valid values:
+ - `yes` (default)
+ - `no`
+ - `kerberos_ticketcleanup` Destroy the user's ticket cache file on logout? Valid values:
+ - `yes` (default)
+ - `no`
+ - `gssapi_authentication` Authenticate users based on GSSAPI? Valid values:
+ - `yes`
+ - `no` (default)
+ - `gssapi_cleanupcredentials` Destroy user's credential cache on logout? Valid values:
+ - `yes` (default)
+ - `no`
+ - `challenge_response_authentication` If you want to enable ChallengeResponseAuthentication or not When disabled, s/key passwords are disabled. Valid values:
+ - `yes`
+ - `no` (default)
+ - `tcp_forwarding` If you want to enable TcpForwarding. Valid values:
+ - `yes`
+ - `no` (default)
+ - `x11_forwarding` If you want to enable x11 forwarding. Valid values:
+ - `yes`
+ - `no` (default)
+ - `agent_forwarding` If you want to allow ssh-agent forwarding. Valid values:
+ - `yes`
+ - `no` (default)
+ - `pubkey_authentication` If you want to enable public key authentication. Valid values:
+ - `yes` (default)
+ - `no`
+ - `rsa_authentication` If you want to enable RSA Authentication. Valid values:
+ - `yes`
+ - `no` (default)
+ - `rhosts_rsa_authentication`
+ If you want to enable rhosts RSA Authentication. Valid values:
+ - `yes`
+ - `no` (default)
+ - `hostbased_authentication` If you want to enable `HostbasedAuthentication`. Valid values:
+ - `yes`
+ - `no` (default)
+ - `strict_modes` If you want to set `StrictModes` (check file modes/ownership before accepting login). Valid values:
+ - `yes` (default)
+ - `no`
+ - `permit_empty_passwords`
+ If you want enable PermitEmptyPasswords to allow empty passwords. Valid
+ Values:
+ - `yes`
+ - `no` (default)
+ - `ports` If you want to specify a list of ports other than the default `22`; Default: `[22]`
+ - `authorized_keys_file`
+ Set this to the location of the AuthorizedKeysFile
+ (e.g. `/etc/ssh/authorized_keys/%u`). Default: `AuthorizedKeysFile
+ %h/.ssh/authorized_keys`
+ - `hardened`
+ Use only strong ciphers, MAC, KexAlgorithms, etc.
+ Values:
+ - `no` (default)
+ - `yes`
+ - `print_motd`
+ Show the Message of the day when a user logs in.
+ - `sftp_subsystem`
+ Set a different sftp-subystem than the default one. Might be interesting for
+ sftponly usage. Default: empty -> no change of the default
+ - `head_additional_options`
+ Set this to any additional sshd_options which aren't listed above. Anything
+ set here will be added to the beginning of the sshd_config file. This option
+ might be useful to define complicated Match Blocks. This string is going to
+ be included, like it is defined. So take care! Default: empty -> not added.
+ - `tail_additional_options` Set this to any additional sshd_options which aren't listed above. Anything set here will be added to the end of the sshd_config file. This option might be useful to define complicated Match Blocks. This string is going to be included, like it is defined. So take care! Default: empty -> not added.
+ - `shared_ip` Whether the server uses a shared network IP address. If it does, then we don't want it to export an rsa key for its IP address. Values:
+ - `no` (default)
+ - `yes`
+
+
+### Defines and functions
+
+Deploy authorized_keys file with the define `authorized_key`.
+
+Generate a public/private keypair with the ssh_keygen function. For example, the
+following will generate ssh keys and put the different parts of the key into
+variables:
+
+```puppet
+$ssh_keys = ssh_keygen("${$ssh_key_basepath}/backup/keys/${::fqdn}/${backup_host}")
+$public_key = split($ssh_keys[1],' ')
+$sshkey_type => $public_key[0]
+$sshkey => $public_key[1]
+```
+
+## Client
+
+
+On a node where you wish to have the ssh client managed, you can do:
+
+```puppet
+class{'sshd::client':
+
+}
+```
+
+in the node definition. This will install the appropriate package.
+
+## License
+
+ - Copyright 2008-2011, Riseup Labs micah@riseup.net
+ - Copyright 2008, admin(at)immerda.ch
+ - Copyright 2008, Puzzle ITC GmbH
+ - Marcel Härry haerry+puppet(at)puzzle.ch
+ - Simon Josi josi+puppet(at)puzzle.ch
+
+This program is free software; you can redistribute
+it and/or modify it under the terms of the GNU
+General Public License version 3 as published by
+the Free Software Foundation.
+
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..e321351
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,16 @@
+require 'bundler'
+Bundler.require(:rake)
+
+require 'puppetlabs_spec_helper/rake_tasks'
+require 'puppet-lint/tasks/puppet-lint'
+require 'rspec-system/rake_task'
+
+PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}'
+PuppetLint.configuration.send("disable_80chars")
+
+puppet_module='sshd'
+task :librarian_spec_prep do
+ sh 'librarian-puppet install --path=spec/fixtures/modules/'
+end
+task :spec_prep => :librarian_spec_prep
+task :default => [:spec, :lint]
diff --git a/files/autossh.init.d b/files/autossh.init.d
new file mode 100644
index 0000000..92bd5f4
--- /dev/null
+++ b/files/autossh.init.d
@@ -0,0 +1,164 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: AutoSSH
+# Required-Start: $local_fs $network $remote_fs $syslog
+# Required-Stop: $local_fs $network $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: start the autossh daemon
+# Description: start the autossh daemon
+### END INIT INFO
+
+# Author: Antoine Beaupré <anarcat@koumbit.org>
+
+# Do NOT "set -e"
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="autossh"
+NAME=autossh
+USER=$NAME
+DAEMON=/usr/bin/autossh
+DAEMON_ARGS="-f"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+AUTOSSH_PIDFILE=$PIDFILE
+export AUTOSSH_PIDFILE
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ start-stop-daemon --start --quiet --user $USER --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+ || return 1
+ start-stop-daemon --start --quiet --user $USER --chuid $USER --pidfile $PIDFILE --exec $DAEMON -- \
+ $DAEMON_ARGS \
+ || return 2
+ # The above code will not work for interpreted scripts, use the next
+ # six lines below instead (Ref: #643337, start-stop-daemon(8) )
+ #start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON \
+ # --name $NAME --test > /dev/null \
+ # || return 1
+ #start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON \
+ # --name $NAME -- $DAEMON_ARGS \
+ # || return 2
+
+ # Add code here, if necessary, that waits for the process to be ready
+ # to handle requests from services started subsequently which depend
+ # on this one. As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --user $USER --name $NAME
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ # Wait for children to finish too if this is a daemon that forks
+ # and if the daemon is only ever run from this initscript.
+ # If the above conditions are not satisfied then add some other code
+ # that waits for the process to drop all resources that could be
+ # needed by services started subsequently. A last resort is to
+ # sleep for some time.
+ start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --user $USER --exec $DAEMON
+ [ "$?" = 2 ] && return 2
+ # Many daemons don't delete their pidfiles when they exit.
+ rm -f $PIDFILE
+ return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+ #
+ # If the daemon can reload its configuration without
+ # restarting (for example, when it is sent a SIGHUP),
+ # then implement that here.
+ #
+ start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+ return 0
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ status)
+ status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ reload|force-reload)
+ log_daemon_msg "Reloading $DESC" "$NAME"
+ do_reload
+ log_end_msg $?
+ ;;
+ restart)
+ #
+ # If the "reload" option is implemented then remove the
+ # 'force-reload' alias
+ #
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ *)
+ #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/files/modules_dir/.ignore b/files/modules_dir/.ignore
deleted file mode 100644
index e69de29..0000000
--- a/files/modules_dir/.ignore
+++ /dev/null
diff --git a/lib/facter/ssh_version.rb b/lib/facter/ssh_version.rb
new file mode 100644
index 0000000..51d8a00
--- /dev/null
+++ b/lib/facter/ssh_version.rb
@@ -0,0 +1,5 @@
+Facter.add("ssh_version") do
+ setcode do
+ ssh_version = Facter::Util::Resolution.exec('ssh -V 2>&1 1>/dev/null').chomp.split(' ')[0].split('_')[1]
+ end
+end
diff --git a/lib/puppet/parser/functions/ssh_keygen.rb b/lib/puppet/parser/functions/ssh_keygen.rb
index 597315e..e304f24 100644
--- a/lib/puppet/parser/functions/ssh_keygen.rb
+++ b/lib/puppet/parser/functions/ssh_keygen.rb
@@ -19,8 +19,12 @@ Puppet::Parser::Functions::newfunction(:ssh_keygen, :type => :rvalue, :doc =>
FileUtils.mkdir_p(dir, :mode => 0700)
end
unless [private_key_path,public_key_path].all?{|path| File.exists?(path) }
- output = Puppet::Util.execute(['/usr/bin/ssh-keygen','-t', 'rsa', '-b', '4096', '-f', private_key_path, '-P', '', '-q'])
+ executor = (Facter.value(:puppetversion).to_i < 3) ? Puppet::Util : Puppet::Util::Execution
+ output = executor.execute(
+ ['/usr/bin/ssh-keygen','-t', 'rsa', '-b', '4096',
+ '-f', private_key_path, '-P', '', '-q'])
raise Puppet::ParseError, "Something went wrong during key generation! Output: #{output}" unless output.empty?
end
[File.read(private_key_path),File.read(public_key_path)]
end
+
diff --git a/manifests/autossh.pp b/manifests/autossh.pp
new file mode 100644
index 0000000..5650584
--- /dev/null
+++ b/manifests/autossh.pp
@@ -0,0 +1,40 @@
+class sshd::autossh($host,
+ $port = undef, # this should be a remote->local hash
+ $remote_user = undef,
+ $user = 'root',
+ $pidfile = '/var/run/autossh.pid',
+) {
+ if $port {
+ $port_ensure = $port
+ }
+ else {
+ # random port between 10000 and 20000
+ $port_ensure = fqdn_rand(10000) + 10000
+ }
+ if $remote_user {
+ $remote_user_ensure = $remote_user
+ }
+ else {
+ $remote_user_ensure = "host-$fqdn"
+ }
+ file {
+ '/etc/init.d/autossh':
+ mode => '0555',
+ source => 'puppet:///modules/sshd/autossh.init.d';
+ '/etc/default/autossh':
+ mode => '0444',
+ content => "USER=$user\nPIDFILE=$pidfile\nDAEMON_ARGS='-M0 -f -o ServerAliveInterval=15 -o ServerAliveCountMax=4 -q -N -R $port_ensure:localhost:22 $remote_user_ensure@$host'\n";
+ }
+ package { 'autossh':
+ ensure => present,
+ }
+ service { 'autossh':
+ ensure => running,
+ enable => true,
+ subscribe => [
+ File['/etc/init.d/autossh'],
+ File['/etc/default/autossh'],
+ Package['autossh'],
+ ],
+ }
+}
diff --git a/manifests/base.pp b/manifests/base.pp
index 4001985..dda9f26 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -1,41 +1,41 @@
+# The base class to setup the common things.
+# This is a private class and will always be used
+# throught the sshd class itself.
class sshd::base {
+
+ $sshd_config_content = $::operatingsystem ? {
+ 'CentOS' => template("sshd/sshd_config/${::operatingsystem}_${::operatingsystemmajrelease}.erb"),
+ default => $::lsbdistcodename ? {
+ '' => template("sshd/sshd_config/${::operatingsystem}.erb"),
+ default => template("sshd/sshd_config/${::operatingsystem}_${::lsbdistcodename}.erb")
+ }
+ }
+
file { 'sshd_config':
- path => '/etc/ssh/sshd_config',
- content => $::lsbdistcodename ? {
- '' => template("sshd/sshd_config/${::operatingsystem}.erb"),
- default => template ("sshd/sshd_config/${::operatingsystem}_${::lsbdistcodename}.erb"),
- },
- notify => Service[sshd],
- owner => root, group => 0, mode => 600;
+ ensure => present,
+ path => '/etc/ssh/sshd_config',
+ content => $sshd_config_content,
+ notify => Service[sshd],
+ owner => root,
+ group => 0,
+ mode => '0600';
}
# Now add the key, if we've got one
case $::sshrsakey {
'': { info("no sshrsakey on ${::fqdn}") }
default: {
- @@sshkey{$::fqdn:
- tag => "fqdn",
- type => ssh-rsa,
- key => $::sshrsakey,
- ensure => present,
- }
- # In case the node has uses a shared network address,
- # we don't define a sshkey resource using an IP address
- if $sshd::shared_ip == "no" {
- @@sshkey{$::ipaddress:
- tag => "ipaddress",
- type => ssh-rsa,
- key => $::sshrsakey,
- ensure => present,
- }
+ # only export sshkey when storedconfigs is enabled
+ if $::sshd::use_storedconfigs {
+ include ::sshd::sshkey
}
}
}
service{'sshd':
- name => 'sshd',
- enable => true,
- ensure => running,
+ ensure => running,
+ name => 'sshd',
+ enable => true,
hasstatus => true,
- require => File[sshd_config],
+ require => File[sshd_config],
}
}
diff --git a/manifests/client/base.pp b/manifests/client/base.pp
index c2580c1..4925c2d 100644
--- a/manifests/client/base.pp
+++ b/manifests/client/base.pp
@@ -1,12 +1,15 @@
class sshd::client::base {
# this is needed because the gid might have changed
file { '/etc/ssh/ssh_known_hosts':
- mode => 0644, owner => root, group => 0;
+ ensure => present,
+ mode => '0644',
+ owner => root,
+ group => 0;
}
# Now collect all server keys
case $sshd::client::shared_ip {
no: { Sshkey <<||>> }
- yes: { Sshkey <<| tag == "fqdn" |>> }
+ yes: { Sshkey <<| tag == fqdn |>> }
}
}
diff --git a/manifests/debian.pp b/manifests/debian.pp
index 45eb901..d827078 100644
--- a/manifests/debian.pp
+++ b/manifests/debian.pp
@@ -1,21 +1,13 @@
class sshd::debian inherits sshd::linux {
- # the templates for Debian need lsbdistcodename
- require lsb
-
Package[openssh]{
name => 'openssh-server',
}
- $sshd_restartandstatus = $::lsbdistcodename ? {
- etch => false,
- default => true
- }
-
Service[sshd]{
- name => 'ssh',
- pattern => 'sshd',
- hasstatus => $sshd_restartandstatus,
- hasrestart => $sshd_restartandstatus,
+ name => 'ssh',
+ pattern => 'sshd',
+ hasstatus => true,
+ hasrestart => true,
}
}
diff --git a/manifests/init.pp b/manifests/init.pp
index 4d66b81..b415741 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,5 +1,6 @@
+# manage an sshd installation
class sshd(
- $manage_nagios = true,
+ $manage_nagios = false,
$nagios_check_ssh_hostname = 'absent',
$ports = [ 22 ],
$shared_ip = 'no',
@@ -26,20 +27,46 @@ class sshd(
$rhosts_rsa_authentication = 'no',
$hostbased_authentication = 'no',
$permit_empty_passwords = 'no',
- $authorized_keys_file = '%h/.ssh/authorized_keys',
- $hardened_ssl = 'no',
+ $authorized_keys_file = $::osfamily ? {
+ Debian => $::lsbmajdistrelease ? {
+ 6 => '%h/.ssh/authorized_keys',
+ default => '%h/.ssh/authorized_keys %h/.ssh/authorized_keys2',
+ },
+ RedHat => $::operatingsystemmajrelease ? {
+ 5 => '%h/.ssh/authorized_keys',
+ 6 => '%h/.ssh/authorized_keys',
+ default => '%h/.ssh/authorized_keys %h/.ssh/authorized_keys2',
+ },
+ OpenBSD => '%h/.ssh/authorized_keys',
+ default => '%h/.ssh/authorized_keys %h/.ssh/authorized_keys2',
+ },
+ $hardened = 'no',
$sftp_subsystem = '',
$head_additional_options = '',
$tail_additional_options = '',
$print_motd = 'yes',
$manage_shorewall = false,
- $shorewall_source = 'net'
+ $shorewall_source = 'net',
+ $sshkey_ipaddress = $::ipaddress,
+ $manage_client = true,
+ $hostkey_type = versioncmp($::ssh_version, '6.5') ? {
+ /(^1|0)/ => [ 'rsa', 'ed25519' ],
+ /-1/ => [ 'rsa', 'dsa' ]
+ },
+ $use_storedconfigs = true
) {
- class{'sshd::client':
- shared_ip => $sshd::shared_ip,
- ensure_version => $sshd::ensure_version,
- manage_shorewall => $manage_shorewall,
+ validate_bool($manage_shorewall)
+ validate_bool($manage_client)
+ validate_array($listen_address)
+ validate_array($ports)
+
+ if $manage_client {
+ class{'sshd::client':
+ shared_ip => $shared_ip,
+ ensure_version => $ensure_version,
+ manage_shorewall => $manage_shorewall,
+ }
}
case $::operatingsystem {
@@ -58,7 +85,7 @@ class sshd(
if $manage_shorewall {
class{'shorewall::rules::ssh':
- ports => $ports,
+ ports => $ports,
source => $shorewall_source
}
}
diff --git a/manifests/linux.pp b/manifests/linux.pp
index f071ada..8628ff5 100644
--- a/manifests/linux.pp
+++ b/manifests/linux.pp
@@ -1,5 +1,5 @@
class sshd::linux inherits sshd::base {
- package{openssh:
+ package{'openssh':
ensure => $sshd::ensure_version,
}
File[sshd_config]{
diff --git a/manifests/nagios.pp b/manifests/nagios.pp
index ef5fe10..6921de9 100644
--- a/manifests/nagios.pp
+++ b/manifests/nagios.pp
@@ -5,18 +5,18 @@ define sshd::nagios(
) {
$real_port = $port ? {
'absent' => $name,
- default => $port,
+ default => $port,
}
case $check_hostname {
'absent': {
nagios::service{"ssh_port_${name}":
- ensure => $ensure,
+ ensure => $ensure,
check_command => "check_ssh_port!${real_port}"
}
}
default: {
nagios::service{"ssh_port_host_${name}":
- ensure => $ensure,
+ ensure => $ensure,
check_command => "check_ssh_port_host!${real_port}!${check_hostname}"
}
}
diff --git a/manifests/openbsd.pp b/manifests/openbsd.pp
index f1379d7..cb6dbba 100644
--- a/manifests/openbsd.pp
+++ b/manifests/openbsd.pp
@@ -1,8 +1,8 @@
class sshd::openbsd inherits sshd::base {
Service[sshd]{
restart => '/bin/kill -HUP `/bin/cat /var/run/sshd.pid`',
- stop => '/bin/kill `/bin/cat /var/run/sshd.pid`',
- start => '/usr/sbin/sshd',
- hasstatus => false,
+ stop => '/bin/kill `/bin/cat /var/run/sshd.pid`',
+ start => '/usr/sbin/sshd',
+ status => '/usr/bin/pgrep -f /usr/sbin/sshd',
}
}
diff --git a/manifests/redhat.pp b/manifests/redhat.pp
index e9bf1d1..d720177 100644
--- a/manifests/redhat.pp
+++ b/manifests/redhat.pp
@@ -1,5 +1,5 @@
-class sshd::redhat inherits sshd::linux {
- Package[openssh]{
- name => 'openssh-server',
- }
+class sshd::redhat inherits sshd::linux {
+ Package[openssh]{
+ name => 'openssh-server',
+ }
}
diff --git a/manifests/ssh_authorized_key.pp b/manifests/ssh_authorized_key.pp
index 40649b0..80cb3b7 100644
--- a/manifests/ssh_authorized_key.pp
+++ b/manifests/ssh_authorized_key.pp
@@ -5,7 +5,8 @@ define sshd::ssh_authorized_key(
$key = 'absent',
$user = '',
$target = undef,
- $options = 'absent'
+ $options = 'absent',
+ $override_builtin = undef
){
if ($ensure=='present') and ($key=='absent') {
@@ -13,8 +14,8 @@ define sshd::ssh_authorized_key(
}
$real_user = $user ? {
- false => $name,
- '' => $name,
+ false => $name,
+ '' => $name,
default => $user,
}
@@ -29,20 +30,56 @@ define sshd::ssh_authorized_key(
$real_target = $target
}
}
- ssh_authorized_key{$name:
- ensure => $ensure,
- type => $type,
- key => $key,
- user => $real_user,
- target => $real_target,
- }
- case $options {
- 'absent': { info("not setting any option for ssh_authorized_key: $name") }
- default: {
- Ssh_authorized_key[$name]{
- options => $options,
- }
+ # The ssh_authorized_key built-in function (in 2.7.23 at least)
+ # will not write an authorized_keys file for a mortal user to
+ # a directory they don't have write permission to, puppet attempts to
+ # create the file as the user specified with the user parameter and fails.
+ # Since ssh will refuse to use authorized_keys files not owned by the
+ # user, or in files/directories that allow other users to write, this
+ # behavior is deliberate in order to prevent typical non-working
+ # configurations. However, it also prevents the case of puppet, running
+ # as root, writing a file owned by a mortal user to a common
+ # authorized_keys directory such as one might specify in sshd_config with
+ # something like
+ # 'AuthorizedKeysFile /etc/ssh/authorized_keys/%u'
+ # So we provide a way to override the built-in and instead just install
+ # via a file resource. There is no additional security risk here, it's
+ # nothing a user can't already do by writing their own file resources,
+ # we still depend on the filesystem permissions to keep things safe.
+ if $override_builtin {
+ $header = "# HEADER: This file is managed by Puppet.\n"
+
+ if $options == 'absent' {
+ info("not setting any option for ssh_authorized_key: ${name}")
+ $content = "${header}${type} ${key}\n"
+ } else {
+ $content = "${header}${options} ${type} ${key}\n"
+ }
+
+ file { $real_target:
+ ensure => $ensure,
+ content => $content,
+ owner => $real_user,
+ mode => '0600',
+ }
+
+ } else {
+
+ if $options == 'absent' {
+ info("not setting any option for ssh_authorized_key: ${name}")
+ } else {
+ $real_options = $options
+ }
+
+ ssh_authorized_key{$name:
+ ensure => $ensure,
+ type => $type,
+ key => $key,
+ user => $real_user,
+ target => $real_target,
+ options => $real_options,
}
}
+
}
diff --git a/manifests/sshkey.pp b/manifests/sshkey.pp
new file mode 100644
index 0000000..df37a66
--- /dev/null
+++ b/manifests/sshkey.pp
@@ -0,0 +1,21 @@
+# deploys the
+class sshd::sshkey {
+
+ @@sshkey{$::fqdn:
+ ensure => present,
+ tag => 'fqdn',
+ type => 'ssh-rsa',
+ key => $::sshrsakey,
+ }
+
+ # In case the node has uses a shared network address,
+ # we don't define a sshkey resource using an IP address
+ if $sshd::shared_ip == 'no' {
+ @@sshkey{$::sshd::sshkey_ipaddress:
+ ensure => present,
+ tag => 'ipaddress',
+ type => 'ssh-rsa',
+ key => $::sshrsakey,
+ }
+ }
+}
diff --git a/spec/classes/client_spec.rb b/spec/classes/client_spec.rb
new file mode 100644
index 0000000..bd3e35a
--- /dev/null
+++ b/spec/classes/client_spec.rb
@@ -0,0 +1,42 @@
+require 'spec_helper'
+
+describe 'sshd::client' do
+
+ shared_examples "a Linux OS" do
+ it { should contain_file('/etc/ssh/ssh_known_hosts').with(
+ {
+ 'ensure' => 'present',
+ 'owner' => 'root',
+ 'group' => '0',
+ 'mode' => '0644',
+ }
+ )}
+ end
+
+ context "Debian OS" do
+ let :facts do
+ {
+ :operatingsystem => 'Debian',
+ :osfamily => 'Debian',
+ :lsbdistcodename => 'wheezy',
+ }
+ end
+ it_behaves_like "a Linux OS"
+ it { should contain_package('openssh-clients').with({
+ 'name' => 'openssh-client'
+ }) }
+ end
+
+ context "CentOS" do
+ it_behaves_like "a Linux OS" do
+ let :facts do
+ {
+ :operatingsystem => 'CentOS',
+ :osfamily => 'RedHat',
+ :lsbdistcodename => 'Final',
+ }
+ end
+ end
+ end
+
+end \ No newline at end of file
diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb
new file mode 100644
index 0000000..e3003d1
--- /dev/null
+++ b/spec/classes/init_spec.rb
@@ -0,0 +1,122 @@
+require 'spec_helper'
+
+describe 'sshd' do
+
+ shared_examples "a Linux OS" do
+ it { should compile.with_all_deps }
+ it { should contain_class('sshd') }
+ it { should contain_class('sshd::client') }
+
+ it { should contain_service('sshd').with({
+ :ensure => 'running',
+ :enable => true,
+ :hasstatus => true
+ })}
+
+ it { should contain_file('sshd_config').with(
+ {
+ 'ensure' => 'present',
+ 'owner' => 'root',
+ 'group' => '0',
+ 'mode' => '0600',
+ }
+ )}
+
+ context 'change ssh port' do
+ let(:params){{
+ :ports => [ 22222],
+ }}
+ it { should contain_file(
+ 'sshd_config'
+ ).with_content(/Port 22222/)}
+ end
+ end
+
+ context "Debian OS" do
+ let :facts do
+ {
+ :operatingsystem => 'Debian',
+ :osfamily => 'Debian',
+ :lsbdistcodename => 'wheezy',
+ }
+ end
+ it_behaves_like "a Linux OS"
+ it { should contain_package('openssh') }
+ it { should contain_class('sshd::debian') }
+ it { should contain_service('sshd').with(
+ :hasrestart => true
+ )}
+
+ context "Ubuntu" do
+ let :facts do
+ {
+ :operatingsystem => 'Ubuntu',
+ :lsbdistcodename => 'precise',
+ }
+ end
+ it_behaves_like "a Linux OS"
+ it { should contain_package('openssh') }
+ it { should contain_service('sshd').with({
+ :hasrestart => true
+ })}
+ end
+ end
+
+
+# context "RedHat OS" do
+# it_behaves_like "a Linux OS" do
+# let :facts do
+# {
+# :operatingsystem => 'RedHat',
+# :osfamily => 'RedHat',
+# }
+# end
+# end
+# end
+
+ context "CentOS" do
+ it_behaves_like "a Linux OS" do
+ let :facts do
+ {
+ :operatingsystem => 'CentOS',
+ :osfamily => 'RedHat',
+ :lsbdistcodename => 'Final',
+ }
+ end
+ end
+ end
+
+ context "Gentoo" do
+ let :facts do
+ {
+ :operatingsystem => 'Gentoo',
+ :osfamily => 'Gentoo',
+ }
+ end
+ it_behaves_like "a Linux OS"
+ it { should contain_class('sshd::gentoo') }
+ end
+
+ context "OpenBSD" do
+ let :facts do
+ {
+ :operatingsystem => 'OpenBSD',
+ :osfamily => 'OpenBSD',
+ }
+ end
+ it_behaves_like "a Linux OS"
+ it { should contain_class('sshd::openbsd') }
+ end
+
+# context "FreeBSD" do
+# it_behaves_like "a Linux OS" do
+# let :facts do
+# {
+# :operatingsystem => 'FreeBSD',
+# :osfamily => 'FreeBSD',
+# }
+# end
+# end
+# end
+
+end \ No newline at end of file
diff --git a/spec/defines/ssh_authorized_key_spec.rb b/spec/defines/ssh_authorized_key_spec.rb
new file mode 100644
index 0000000..c73a91c
--- /dev/null
+++ b/spec/defines/ssh_authorized_key_spec.rb
@@ -0,0 +1,45 @@
+require 'spec_helper'
+
+describe 'sshd::ssh_authorized_key' do
+
+ context 'manage authorized key' do
+ let(:title) { 'foo' }
+ let(:ssh_key) { 'some_secret_ssh_key' }
+
+ let(:params) {{
+ :key => ssh_key,
+ }}
+
+ it { should contain_ssh_authorized_key('foo').with({
+ 'ensure' => 'present',
+ 'type' => 'ssh-dss',
+ 'user' => 'foo',
+ 'target' => '/home/foo/.ssh/authorized_keys',
+ 'key' => ssh_key,
+ })
+ }
+ end
+ context 'manage authoried key with options' do
+ let(:title) { 'foo2' }
+ let(:ssh_key) { 'some_secret_ssh_key' }
+
+ let(:params) {{
+ :key => ssh_key,
+ :options => ['command="/usr/bin/date"',
+ 'no-pty','no-X11-forwarding','no-agent-forwarding',
+ 'no-port-forwarding']
+ }}
+
+ it { should contain_ssh_authorized_key('foo2').with({
+ 'ensure' => 'present',
+ 'type' => 'ssh-dss',
+ 'user' => 'foo2',
+ 'target' => '/home/foo2/.ssh/authorized_keys',
+ 'key' => ssh_key,
+ 'options' => ['command="/usr/bin/date"',
+ 'no-pty','no-X11-forwarding','no-agent-forwarding',
+ 'no-port-forwarding']
+ })
+ }
+ end
+end
diff --git a/spec/unit/parser/functions/ssh_keygen.rb b/spec/functions/ssh_keygen_spec.rb
index da45779..a6b5117 100644
--- a/spec/unit/parser/functions/ssh_keygen.rb
+++ b/spec/functions/ssh_keygen_spec.rb
@@ -1,44 +1,50 @@
-#! /usr/bin/env ruby
-
-
-require File.dirname(__FILE__) + '/../../../spec_helper'
-
+#! /usr/bin/env ruby -S rspec
+require 'spec_helper'
+require 'rspec-puppet'
require 'mocha'
require 'fileutils'
-describe "the ssh_keygen function" do
+describe 'ssh_keygen' do
- before :each do
- @scope = Puppet::Parser::Scope.new
- end
+ let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
- it "should exist" do
+ it 'should exist' do
Puppet::Parser::Functions.function("ssh_keygen").should == "function_ssh_keygen"
end
- it "should raise a ParseError if no argument is passed" do
- lambda { @scope.function_ssh_keygen }.should( raise_error(Puppet::ParseError))
+ it 'should raise a ParseError if no argument is passed' do
+ lambda {
+ scope.function_ssh_keygen([])
+ }.should(raise_error(Puppet::ParseError))
end
- it "should raise a ParseError if there is more than 1 arguments" do
- lambda { @scope.function_ssh_keygen("foo", "bar") }.should( raise_error(Puppet::ParseError))
+ it 'should raise a ParseError if there is more than 1 arguments' do
+ lambda {
+ scope.function_ssh_keygen(["foo", "bar"])
+ }.should( raise_error(Puppet::ParseError))
end
- it "should raise a ParseError if the argument is not fully qualified" do
- lambda { @scope.function_ssh_keygen("foo") }.should( raise_error(Puppet::ParseError))
+ it 'should raise a ParseError if the argument is not fully qualified' do
+ lambda {
+ scope.function_ssh_keygen(["foo"])
+ }.should( raise_error(Puppet::ParseError))
end
it "should raise a ParseError if the private key path is a directory" do
File.stubs(:directory?).with("/some_dir").returns(true)
- lambda { @scope.function_ssh_keygen("/some_dir") }.should( raise_error(Puppet::ParseError))
+ lambda {
+ scope.function_ssh_keygen(["/some_dir"])
+ }.should( raise_error(Puppet::ParseError))
end
it "should raise a ParseError if the public key path is a directory" do
File.stubs(:directory?).with("/some_dir.pub").returns(true)
- lambda { @scope.function_ssh_keygen("/some_dir") }.should( raise_error(Puppet::ParseError))
+ lambda {
+ scope.function_ssh_keygen(["/some_dir.pub"])
+ }.should( raise_error(Puppet::ParseError))
end
- describe "when executing properly" do
+ describe 'when executing properly' do
before do
File.stubs(:directory?).with('/tmp/a/b/c').returns(false)
File.stubs(:directory?).with('/tmp/a/b/c.pub').returns(false)
@@ -46,16 +52,20 @@ describe "the ssh_keygen function" do
File.stubs(:read).with('/tmp/a/b/c.pub').returns('publickey')
end
- it "should fail if the public but not the private key exists" do
- File.stubs(:exists?).with("/tmp/a/b/c").returns(true)
- File.stubs(:exists?).with("/tmp/a/b/c.pub").returns(false)
- lambda { @scope.function_ssh_keygen("/tmp/a/b/c") }.should( raise_error(Puppet::ParseError))
+ it 'should fail if the public but not the private key exists' do
+ File.stubs(:exists?).with('/tmp/a/b/c').returns(true)
+ File.stubs(:exists?).with('/tmp/a/b/c.pub').returns(false)
+ lambda {
+ scope.function_ssh_keygen(['/tmp/a/b/c'])
+ }.should( raise_error(Puppet::ParseError))
end
it "should fail if the private but not the public key exists" do
File.stubs(:exists?).with("/tmp/a/b/c").returns(false)
File.stubs(:exists?).with("/tmp/a/b/c.pub").returns(true)
- lambda { @scope.function_ssh_keygen("/tmp/a/b/c") }.should( raise_error(Puppet::ParseError))
+ lambda {
+ scope.function_ssh_keygen(["/tmp/a/b/c"])
+ }.should( raise_error(Puppet::ParseError))
end
@@ -64,7 +74,7 @@ describe "the ssh_keygen function" do
File.stubs(:exists?).with("/tmp/a/b/c.pub").returns(true)
File.stubs(:directory?).with('/tmp/a/b').returns(true)
Puppet::Util.expects(:execute).never
- result = @scope.function_ssh_keygen('/tmp/a/b/c')
+ result = scope.function_ssh_keygen(['/tmp/a/b/c'])
result.length.should == 2
result[0].should == 'privatekey'
result[1].should == 'publickey'
@@ -75,8 +85,8 @@ describe "the ssh_keygen function" do
File.stubs(:exists?).with("/tmp/a/b/c.pub").returns(false)
File.stubs(:directory?).with("/tmp/a/b").returns(false)
FileUtils.expects(:mkdir_p).with("/tmp/a/b", :mode => 0700)
- Puppet::Util.expects(:execute).returns("")
- result = @scope.function_ssh_keygen('/tmp/a/b/c')
+ Puppet::Util::Execution.expects(:execute).returns("")
+ result = scope.function_ssh_keygen(['/tmp/a/b/c'])
result.length.should == 2
result[0].should == 'privatekey'
result[1].should == 'publickey'
@@ -86,8 +96,8 @@ describe "the ssh_keygen function" do
File.stubs(:exists?).with("/tmp/a/b/c").returns(false)
File.stubs(:exists?).with("/tmp/a/b/c.pub").returns(false)
File.stubs(:directory?).with("/tmp/a/b").returns(true)
- Puppet::Util.expects(:execute).with(['/usr/bin/ssh-keygen','-t', 'rsa', '-b', '4096', '-f', '/tmp/a/b/c', '-P', '', '-q']).returns("")
- result = @scope.function_ssh_keygen('/tmp/a/b/c')
+ Puppet::Util::Execution.expects(:execute).with(['/usr/bin/ssh-keygen','-t', 'rsa', '-b', '4096', '-f', '/tmp/a/b/c', '-P', '', '-q']).returns("")
+ result = scope.function_ssh_keygen(['/tmp/a/b/c'])
result.length.should == 2
result[0].should == 'privatekey'
result[1].should == 'publickey'
@@ -97,8 +107,10 @@ describe "the ssh_keygen function" do
File.stubs(:exists?).with("/tmp/a/b/c").returns(false)
File.stubs(:exists?).with("/tmp/a/b/c.pub").returns(false)
File.stubs(:directory?).with("/tmp/a/b").returns(true)
- Puppet::Util.expects(:execute).with(['/usr/bin/ssh-keygen','-t', 'rsa', '-b', '4096', '-f', '/tmp/a/b/c', '-P', '', '-q']).returns("something is wrong")
- lambda { @scope.function_ssh_keygen("/tmp/a/b/c") }.should( raise_error(Puppet::ParseError))
+ Puppet::Util::Execution.expects(:execute).with(['/usr/bin/ssh-keygen','-t', 'rsa', '-b', '4096', '-f', '/tmp/a/b/c', '-P', '', '-q']).returns("something is wrong")
+ lambda {
+ scope.function_ssh_keygen(["/tmp/a/b/c"])
+ }.should( raise_error(Puppet::ParseError))
end
end
end
diff --git a/spec/spec.opts b/spec/spec.opts
deleted file mode 100644
index 91cd642..0000000
--- a/spec/spec.opts
+++ /dev/null
@@ -1,6 +0,0 @@
---format
-s
---colour
---loadby
-mtime
---backtrace
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 6ba62e1..b4123fd 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,16 +1,21 @@
-require 'pathname'
-dir = Pathname.new(__FILE__).parent
-$LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib')
+dir = File.expand_path(File.dirname(__FILE__))
+$LOAD_PATH.unshift File.join(dir, 'lib')
require 'puppet'
-gem 'rspec', '>= 1.2.9'
-require 'spec/autorun'
+require 'rspec'
+require 'puppetlabs_spec_helper/module_spec_helper'
+#require 'rspec-hiera-puppet'
+require 'rspec-puppet/coverage'
+require 'rspec/autorun'
-Dir[File.join(File.dirname(__FILE__), 'support', '*.rb')].each do |support_file|
- require support_file
-end
+fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
-# We need this because the RAL uses 'should' as a method. This
-# allows us the same behaviour but with a different method name.
-class Object
- alias :must :should
+RSpec.configure do |c|
+ c.module_path = File.join(fixture_path, 'modules')
+ c.manifest_dir = File.join(fixture_path, 'manifests')
+ c.pattern = "spec/*/*_spec.rb"
end
+
+Puppet::Util::Log.level = :warning
+Puppet::Util::Log.newdestination(:console)
+
+at_exit { RSpec::Puppet::Coverage.report! } \ No newline at end of file
diff --git a/spec/spec_helper_system.rb b/spec/spec_helper_system.rb
new file mode 100644
index 0000000..2c6812f
--- /dev/null
+++ b/spec/spec_helper_system.rb
@@ -0,0 +1,25 @@
+require 'rspec-system/spec_helper'
+require 'rspec-system-puppet/helpers'
+require 'rspec-system-serverspec/helpers'
+include Serverspec::Helper::RSpecSystem
+include Serverspec::Helper::DetectOS
+include RSpecSystemPuppet::Helpers
+
+RSpec.configure do |c|
+ # Project root
+ proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
+
+ # Enable colour
+ c.tty = true
+
+ c.include RSpecSystemPuppet::Helpers
+
+ # This is where we 'setup' the nodes before running our tests
+ c.before :suite do
+ # Install puppet
+ puppet_install
+ # Install modules and dependencies
+ puppet_module_install(:source => proj_root, :module_name => 'sshd')
+ shell('puppet module install puppetlabs-stdlib')
+ end
+end
diff --git a/templates/sshd_config/CentOS.erb b/templates/sshd_config/CentOS.erb
deleted file mode 100644
index 7498517..0000000
--- a/templates/sshd_config/CentOS.erb
+++ /dev/null
@@ -1,154 +0,0 @@
-# $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $
-
-# This is the sshd server system-wide configuration file. See
-# sshd_config(5) for more information.
-
-# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
-
-# The strategy used for options in the default sshd_config shipped with
-# OpenSSH is to specify options with their default value where
-# possible, but leave them commented. Uncommented options change a
-# default value.
-
-<% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
-<%= s %>
-<% end -%>
-
-# only protocol 2
-Protocol 2
-<% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
-<% if port == 'off' -%>
-#Port -- disabled by puppet
-<% else -%>
-Port <%= port %>
-<% end -%>
-<% end -%>
-
-# Use these options to restrict which interfaces/protocols sshd will bind to
-<% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
-ListenAddress <%= address %>
-<% end -%>
-
-# HostKey for protocol version 1
-#HostKey /etc/ssh/ssh_host_key
-# HostKeys for protocol version 2
-#HostKey /etc/ssh/ssh_host_rsa_key
-#HostKey /etc/ssh/ssh_host_dsa_key
-
-# Lifetime and size of ephemeral version 1 server key
-#KeyRegenerationInterval 1h
-#ServerKeyBits 768
-
-# Logging
-# obsoletes QuietMode and FascistLogging
-#SyslogFacility AUTH
-SyslogFacility AUTHPRIV
-#LogLevel INFO
-
-# Authentication:
-
-#LoginGraceTime 2m
-PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
-
-StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
-
-#MaxAuthTries 6
-
-RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
-
-PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
-
-AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
-
-# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
-RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
-
-# similar for protocol version 2
-HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
-
-# Change to yes if you don't trust ~/.ssh/known_hosts for
-# RhostsRSAAuthentication and HostbasedAuthentication
-#IgnoreUserKnownHosts no
-
-# Don't read the user's ~/.rhosts and ~/.shosts files
-IgnoreRhosts <%= scope.lookupvar('sshd::ignore_rhosts') %>
-
-# To disable tunneled clear text passwords, change to no here!
-PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
-
-# To enable empty passwords, change to yes (NOT RECOMMENDED)
-PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
-
-# Change to no to disable s/key passwords
-ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
-
-# Kerberos options
-#KerberosAuthentication no
-#KerberosOrLocalPasswd yes
-#KerberosTicketCleanup yes
-#KerberosGetAFSToken no
-
-# GSSAPI options
-#GSSAPIAuthentication no
-#GSSAPICleanupCredentials yes
-
-# Set this to 'yes' to enable PAM authentication, account processing,
-# and session processing. If this is enabled, PAM authentication will
-# be allowed through the ChallengeResponseAuthentication mechanism.
-# Depending on your PAM configuration, this may bypass the setting of
-# PasswordAuthentication, PermitEmptyPasswords, and
-# "PermitRootLogin without-password". If you just want the PAM account and
-# session checks to run without PAM authentication, then enable this but set
-# ChallengeResponseAuthentication=no
-#UsePAM no
-UsePAM <%= scope.lookupvar('sshd::use_pam') %>
-
-# Accept locale-related environment variables
-AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
-AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-AcceptEnv LC_IDENTIFICATION LC_ALL
-
-AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
-
-#GatewayPorts no
-#X11Forwarding no
-X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
-#X11DisplayOffset 10
-#X11UseLocalhost yes
-PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
-#PrintLastLog yes
-#TCPKeepAlive yes
-#UseLogin no
-#UsePrivilegeSeparation yes
-#PermitUserEnvironment no
-#Compression delayed
-#ClientAliveInterval 0
-#ClientAliveCountMax 3
-#ShowPatchLevel no
-#UseDNS yes
-#PidFile /var/run/sshd.pid
-#MaxStartups 10
-#PermitTunnel no
-#ChrootDirectory none
-
-# no default banner path
-#Banner /some/path
-
-# override default of no subsystems
-Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/libexec/openssh/sftp-server' : s %>
-
-<% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
-AllowUsers <%= s %>
-<% end -%>
-<% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
-AllowGroups <%= s %>
-<%- end -%>
-
-<% if scope.lookupvar('sshd::hardened_ssl') == 'yes' -%>
-Ciphers aes256-ctr
-MACs hmac-sha2-512
-<% end -%>
-
-<% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
-<%= s %>
-<% end -%>
diff --git a/templates/sshd_config/CentOS_5.erb b/templates/sshd_config/CentOS_5.erb
new file mode 120000
index 0000000..71b767a
--- /dev/null
+++ b/templates/sshd_config/CentOS_5.erb
@@ -0,0 +1 @@
+CentOS_6.erb \ No newline at end of file
diff --git a/templates/sshd_config/CentOS_6.erb b/templates/sshd_config/CentOS_6.erb
new file mode 100644
index 0000000..4593a91
--- /dev/null
+++ b/templates/sshd_config/CentOS_6.erb
@@ -0,0 +1,172 @@
+# $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $
+
+# This is the sshd server system-wide configuration file. See
+# sshd_config(5) for more information.
+
+# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
+
+# The strategy used for options in the default sshd_config shipped with
+# OpenSSH is to specify options with their default value where
+# possible, but leave them commented. Uncommented options change a
+# default value.
+
+<% unless (s=scope.lookupvar('::sshd::head_additional_options')).empty? -%>
+<%= s %>
+<% end -%>
+
+<% scope.lookupvar('::sshd::ports').to_a.each do |port| -%>
+<% if port == 'off' -%>
+#Port -- disabled by puppet
+<% else -%>
+Port <%= port %>
+<% end -%>
+<% end -%>
+
+# Use these options to restrict which interfaces/protocols sshd will bind to
+<% scope.lookupvar('::sshd::listen_address').to_a.each do |address| -%>
+ListenAddress <%= address %>
+<% end -%>
+
+# Disable legacy (protocol version 1) support in the server for new
+# installations. In future the default will change to require explicit
+# activation of protocol 1
+Protocol 2
+
+# HostKey for protocol version 1
+#HostKey /etc/ssh/ssh_host_key
+# HostKeys for protocol version 2
+#HostKey /etc/ssh/ssh_host_rsa_key
+#HostKey /etc/ssh/ssh_host_dsa_key
+
+# Lifetime and size of ephemeral version 1 server key
+#KeyRegenerationInterval 1h
+#ServerKeyBits 1024
+
+# Logging
+# obsoletes QuietMode and FascistLogging
+#SyslogFacility AUTH
+SyslogFacility AUTHPRIV
+#LogLevel INFO
+
+# Authentication:
+
+#LoginGraceTime 2m
+PermitRootLogin <%= scope.lookupvar('::sshd::permit_root_login') %>
+
+StrictModes <%= scope.lookupvar('::sshd::strict_modes') %>
+
+#MaxAuthTries 6
+
+RSAAuthentication <%= scope.lookupvar('::sshd::rsa_authentication') %>
+PubkeyAuthentication <%= scope.lookupvar('::sshd::pubkey_authentication') %>
+AuthorizedKeysFile <%= scope.lookupvar('::sshd::authorized_keys_file') %>
+#AuthorizedKeysCommand none
+#AuthorizedKeysCommandRunAs nobody
+
+# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
+RhostsRSAAuthentication <%= scope.lookupvar('::sshd::rhosts_rsa_authentication') %>
+
+# similar for protocol version 2
+HostbasedAuthentication <%= scope.lookupvar('::sshd::hostbased_authentication') %>
+
+# Change to yes if you don't trust ~/.ssh/known_hosts for
+# RhostsRSAAuthentication and HostbasedAuthentication
+#IgnoreUserKnownHosts no
+
+# Don't read the user's ~/.rhosts and ~/.shosts files
+IgnoreRhosts <%= scope.lookupvar('::sshd::ignore_rhosts') %>
+
+# To disable tunneled clear text passwords, change to no here!
+PasswordAuthentication <%= scope.lookupvar('::sshd::password_authentication') %>
+
+# To enable empty passwords, change to yes (NOT RECOMMENDED)
+PermitEmptyPasswords <%= scope.lookupvar('::sshd::permit_empty_passwords') %>
+
+# Change to no to disable s/key passwords
+ChallengeResponseAuthentication <%= scope.lookupvar('::sshd::challenge_response_authentication') %>
+
+# Kerberos options
+#KerberosAuthentication no
+#KerberosOrLocalPasswd yes
+#KerberosTicketCleanup yes
+#KerberosGetAFSToken no
+#KerberosUseKuserok yes
+
+# GSSAPI options
+#GSSAPIAuthentication no
+#GSSAPICleanupCredentials yes
+
+# Set this to 'yes' to enable PAM authentication, account processing,
+# and session processing. If this is enabled, PAM authentication will
+# be allowed through the ChallengeResponseAuthentication and
+# PasswordAuthentication. Depending on your PAM configuration,
+# PAM authentication via ChallengeResponseAuthentication may bypass
+# the setting of "PermitRootLogin without-password".
+# If you just want the PAM account and session checks to run without
+# PAM authentication, then enable this but set PasswordAuthentication
+# and ChallengeResponseAuthentication to 'no'.
+#UsePAM no
+UsePAM <%= scope.lookupvar('::sshd::use_pam') %>
+
+# Accept locale-related environment variables
+AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
+AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
+AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
+AcceptEnv XMODIFIERS
+
+#AllowAgentForwarding yes
+AllowTcpForwarding <%= scope.lookupvar('::sshd::tcp_forwarding') %>
+#GatewayPorts no
+#X11Forwarding no
+X11Forwarding <%= scope.lookupvar('::sshd::x11_forwarding') %>
+#X11DisplayOffset 10
+#X11UseLocalhost yes
+PrintMotd <%= scope.lookupvar('::sshd::print_motd') %>
+#PrintLastLog yes
+#TCPKeepAlive yes
+#UseLogin no
+#UsePrivilegeSeparation yes
+#PermitUserEnvironment no
+#Compression delayed
+#ClientAliveInterval 0
+#ClientAliveCountMax 3
+#ShowPatchLevel no
+#UseDNS yes
+#PidFile /var/run/sshd.pid
+#MaxStartups 10:30:100
+#PermitTunnel no
+#ChrootDirectory none
+
+# no default banner path
+#Banner /some/path
+
+# override default of no subsystems
+Subsystem sftp <%= (s=scope.lookupvar('::sshd::sftp_subsystem')).empty? ? '/usr/libexec/openssh/sftp-server' : s %>
+
+<% unless (s=scope.lookupvar('::sshd::allowed_users')).empty? -%>
+AllowUsers <%= s %>
+<% end -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_groups')).empty? -%>
+AllowGroups <%= s %>
+<%- end -%>
+
+<% if scope.lookupvar('::sshd::hardened') == 'yes' -%>
+<% if (scope.function_versioncmp([scope.lookupvar('::ssh_version'),'6.5'])) >= 0 -%>
+KexAlgorithms curve25519-sha256@libssh.org
+Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr
+MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
+<% else -%>
+Ciphers aes256-ctr
+MACs hmac-sha1
+<% end -%>
+<% end -%>
+
+# Example of overriding settings on a per-user basis
+#Match User anoncvs
+# X11Forwarding no
+# AllowTcpForwarding no
+# ForceCommand cvs server
+#
+<% unless (s=scope.lookupvar('::sshd::tail_additional_options')).empty? -%>
+<%= s %>
+<% end -%>
diff --git a/templates/sshd_config/CentOS_7.erb b/templates/sshd_config/CentOS_7.erb
new file mode 100644
index 0000000..f55fb9d
--- /dev/null
+++ b/templates/sshd_config/CentOS_7.erb
@@ -0,0 +1,186 @@
+# $OpenBSD: sshd_config,v 1.90 2013/05/16 04:09:14 dtucker Exp $
+
+# This is the sshd server system-wide configuration file. See
+# sshd_config(5) for more information.
+
+# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
+
+# The strategy used for options in the default sshd_config shipped with
+# OpenSSH is to specify options with their default value where
+# possible, but leave them commented. Uncommented options change a
+# default value.
+
+<% unless (s=scope.lookupvar('::sshd::head_additional_options')).empty? -%>
+<%= s %>
+<% end -%>
+
+# If you want to change the port on a SELinux system, you have to tell
+# SELinux about this change.
+# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
+#
+<% scope.lookupvar('::sshd::ports').to_a.each do |port| -%>
+<% if port == 'off' -%>
+#Port -- disabled by puppet
+<% else -%>
+Port <%= port %>
+<% end -%>
+<% end -%>
+<% scope.lookupvar('::sshd::listen_address').to_a.each do |address| -%>
+ListenAddress <%= address %>
+<% end -%>
+
+# The default requires explicit activation of protocol 1
+#Protocol 2
+
+# HostKey for protocol version 1
+#HostKey /etc/ssh/ssh_host_key
+# HostKeys for protocol version 2
+<% scope.lookupvar('::sshd::hostkey_type').to_a.each do |hostkey_type| -%>
+HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
+<% end -%>
+
+# Lifetime and size of ephemeral version 1 server key
+#KeyRegenerationInterval 1h
+#ServerKeyBits 1024
+
+# Ciphers and keying
+#RekeyLimit default none
+
+# Logging
+# obsoletes QuietMode and FascistLogging
+#SyslogFacility AUTH
+SyslogFacility AUTHPRIV
+#LogLevel INFO
+
+# Authentication:
+
+#LoginGraceTime 2m
+PermitRootLogin <%= scope.lookupvar('::sshd::permit_root_login') %>
+StrictModes <%= scope.lookupvar('::sshd::strict_modes') %>
+#MaxAuthTries 6
+#MaxSessions 10
+
+RSAAuthentication <%= scope.lookupvar('::sshd::rsa_authentication') %>
+PubkeyAuthentication <%= scope.lookupvar('::sshd::pubkey_authentication') %>
+AuthorizedKeysFile <%= scope.lookupvar('::sshd::authorized_keys_file') %>
+#AuthorizedPrincipalsFile none
+#AuthorizedKeysCommand none
+#AuthorizedKeysCommandRunAs nobody
+
+# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
+RhostsRSAAuthentication <%= scope.lookupvar('::sshd::rhosts_rsa_authentication') %>
+
+# similar for protocol version 2
+HostbasedAuthentication <%= scope.lookupvar('::sshd::hostbased_authentication') %>
+
+# Change to yes if you don't trust ~/.ssh/known_hosts for
+# RhostsRSAAuthentication and HostbasedAuthentication
+#IgnoreUserKnownHosts no
+
+# Don't read the user's ~/.rhosts and ~/.shosts files
+IgnoreRhosts <%= scope.lookupvar('::sshd::ignore_rhosts') %>
+
+# To disable tunneled clear text passwords, change to no here!
+PasswordAuthentication <%= scope.lookupvar('::sshd::password_authentication') %>
+
+# To enable empty passwords, change to yes (NOT RECOMMENDED)
+PermitEmptyPasswords <%= scope.lookupvar('::sshd::permit_empty_passwords') %>
+
+# Change to no to disable s/key passwords
+ChallengeResponseAuthentication <%= scope.lookupvar('::sshd::challenge_response_authentication') %>
+
+# Kerberos options
+#KerberosAuthentication no
+#KerberosOrLocalPasswd yes
+#KerberosTicketCleanup yes
+#KerberosGetAFSToken no
+#KerberosUseKuserok yes
+
+# GSSAPI options
+GSSAPIAuthentication no
+GSSAPICleanupCredentials yes
+#GSSAPIStrictAcceptorCheck yes
+#GSSAPIKeyExchange no
+
+# Set this to 'yes' to enable PAM authentication, account processing,
+# and session processing. If this is enabled, PAM authentication will
+# be allowed through the ChallengeResponseAuthentication and
+# PasswordAuthentication. Depending on your PAM configuration,
+# PAM authentication via ChallengeResponseAuthentication may bypass
+# the setting of "PermitRootLogin without-password".
+# If you just want the PAM account and session checks to run without
+# PAM authentication, then enable this but set PasswordAuthentication
+# and ChallengeResponseAuthentication to 'no'.
+# WARNING: 'UsePAM no' is not supported in Red Hat Enterprise Linux and may cause several
+# problems.
+#UsePAM no
+UsePAM <%= scope.lookupvar('::sshd::use_pam') %>
+
+#AllowAgentForwarding yes
+AllowTcpForwarding <%= scope.lookupvar('::sshd::tcp_forwarding') %>
+#GatewayPorts no
+#X11Forwarding no
+X11Forwarding <%= scope.lookupvar('::sshd::x11_forwarding') %>
+#X11DisplayOffset 10
+#X11UseLocalhost yes
+PrintMotd <%= scope.lookupvar('::sshd::print_motd') %>
+#PrintLastLog yes
+#TCPKeepAlive yes
+#UseLogin no
+UsePrivilegeSeparation sandbox # Default for new installations.
+#PermitUserEnvironment no
+#Compression delayed
+#ClientAliveInterval 0
+#ClientAliveCountMax 3
+#ShowPatchLevel no
+#UseDNS yes
+#PidFile /var/run/sshd.pid
+#MaxStartups 10:30:100
+#PermitTunnel no
+#ChrootDirectory none
+#VersionAddendum none
+
+# no default banner path
+#Banner none
+
+# Accept locale-related environment variables
+AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
+AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
+AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
+AcceptEnv XMODIFIERS
+
+
+# override default of no subsystems
+Subsystem sftp <%= (s=scope.lookupvar('::sshd::sftp_subsystem')).empty? ? '/usr/libexec/openssh/sftp-server' : s %>
+
+<% unless (s=scope.lookupvar('::sshd::allowed_users')).empty? -%>
+AllowUsers <%= s %>
+<% end -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_groups')).empty? -%>
+AllowGroups <%= s %>
+<%- end -%>
+
+# Uncomment this if you want to use .local domain
+#Host *.local
+# CheckHostIP no
+
+<% if scope.lookupvar('::sshd::hardened') == 'yes' -%>
+<% if (scope.function_versioncmp([scope.lookupvar('::ssh_version'),'6.5'])) >= 0 -%>
+KexAlgorithms curve25519-sha256@libssh.org
+Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr
+MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
+<% else -%>
+Ciphers aes256-ctr
+MACs hmac-sha1
+<% end -%>
+<% end -%>
+
+# Example of overriding settings on a per-user basis
+#Match User anoncvs
+# X11Forwarding no
+# AllowTcpForwarding no
+# ForceCommand cvs server
+
+<% unless (s=scope.lookupvar('::sshd::tail_additional_options')).empty? -%>
+<%= s %>
+<% end -%>
diff --git a/templates/sshd_config/CentOS_Final.erb b/templates/sshd_config/CentOS_Final.erb
deleted file mode 100644
index 7498517..0000000
--- a/templates/sshd_config/CentOS_Final.erb
+++ /dev/null
@@ -1,154 +0,0 @@
-# $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $
-
-# This is the sshd server system-wide configuration file. See
-# sshd_config(5) for more information.
-
-# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
-
-# The strategy used for options in the default sshd_config shipped with
-# OpenSSH is to specify options with their default value where
-# possible, but leave them commented. Uncommented options change a
-# default value.
-
-<% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
-<%= s %>
-<% end -%>
-
-# only protocol 2
-Protocol 2
-<% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
-<% if port == 'off' -%>
-#Port -- disabled by puppet
-<% else -%>
-Port <%= port %>
-<% end -%>
-<% end -%>
-
-# Use these options to restrict which interfaces/protocols sshd will bind to
-<% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
-ListenAddress <%= address %>
-<% end -%>
-
-# HostKey for protocol version 1
-#HostKey /etc/ssh/ssh_host_key
-# HostKeys for protocol version 2
-#HostKey /etc/ssh/ssh_host_rsa_key
-#HostKey /etc/ssh/ssh_host_dsa_key
-
-# Lifetime and size of ephemeral version 1 server key
-#KeyRegenerationInterval 1h
-#ServerKeyBits 768
-
-# Logging
-# obsoletes QuietMode and FascistLogging
-#SyslogFacility AUTH
-SyslogFacility AUTHPRIV
-#LogLevel INFO
-
-# Authentication:
-
-#LoginGraceTime 2m
-PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
-
-StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
-
-#MaxAuthTries 6
-
-RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
-
-PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
-
-AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
-
-# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
-RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
-
-# similar for protocol version 2
-HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
-
-# Change to yes if you don't trust ~/.ssh/known_hosts for
-# RhostsRSAAuthentication and HostbasedAuthentication
-#IgnoreUserKnownHosts no
-
-# Don't read the user's ~/.rhosts and ~/.shosts files
-IgnoreRhosts <%= scope.lookupvar('sshd::ignore_rhosts') %>
-
-# To disable tunneled clear text passwords, change to no here!
-PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
-
-# To enable empty passwords, change to yes (NOT RECOMMENDED)
-PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
-
-# Change to no to disable s/key passwords
-ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
-
-# Kerberos options
-#KerberosAuthentication no
-#KerberosOrLocalPasswd yes
-#KerberosTicketCleanup yes
-#KerberosGetAFSToken no
-
-# GSSAPI options
-#GSSAPIAuthentication no
-#GSSAPICleanupCredentials yes
-
-# Set this to 'yes' to enable PAM authentication, account processing,
-# and session processing. If this is enabled, PAM authentication will
-# be allowed through the ChallengeResponseAuthentication mechanism.
-# Depending on your PAM configuration, this may bypass the setting of
-# PasswordAuthentication, PermitEmptyPasswords, and
-# "PermitRootLogin without-password". If you just want the PAM account and
-# session checks to run without PAM authentication, then enable this but set
-# ChallengeResponseAuthentication=no
-#UsePAM no
-UsePAM <%= scope.lookupvar('sshd::use_pam') %>
-
-# Accept locale-related environment variables
-AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
-AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-AcceptEnv LC_IDENTIFICATION LC_ALL
-
-AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
-
-#GatewayPorts no
-#X11Forwarding no
-X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
-#X11DisplayOffset 10
-#X11UseLocalhost yes
-PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
-#PrintLastLog yes
-#TCPKeepAlive yes
-#UseLogin no
-#UsePrivilegeSeparation yes
-#PermitUserEnvironment no
-#Compression delayed
-#ClientAliveInterval 0
-#ClientAliveCountMax 3
-#ShowPatchLevel no
-#UseDNS yes
-#PidFile /var/run/sshd.pid
-#MaxStartups 10
-#PermitTunnel no
-#ChrootDirectory none
-
-# no default banner path
-#Banner /some/path
-
-# override default of no subsystems
-Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/libexec/openssh/sftp-server' : s %>
-
-<% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
-AllowUsers <%= s %>
-<% end -%>
-<% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
-AllowGroups <%= s %>
-<%- end -%>
-
-<% if scope.lookupvar('sshd::hardened_ssl') == 'yes' -%>
-Ciphers aes256-ctr
-MACs hmac-sha2-512
-<% end -%>
-
-<% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
-<%= s %>
-<% end -%>
diff --git a/templates/sshd_config/Debian_etch.erb b/templates/sshd_config/Debian_etch.erb
deleted file mode 100644
index 75b2931..0000000
--- a/templates/sshd_config/Debian_etch.erb
+++ /dev/null
@@ -1,122 +0,0 @@
-# Package generated configuration file
-# See the sshd(8) manpage for details
-
-<% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
-<%= s %>
-<% end -%>
-
-# What ports, IPs and protocols we listen for
-<% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
-<% if port == 'off' -%>
-#Port -- disabled by puppet
-<% else -%>
-Port <%= port %>
-<% end -%>
-<% end -%>
-
-# Use these options to restrict which interfaces/protocols sshd will bind to
-<% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
-ListenAddress <%= address %>
-<% end -%>
-Protocol 2
-# HostKeys for protocol version 2
-HostKey /etc/ssh/ssh_host_rsa_key
-HostKey /etc/ssh/ssh_host_dsa_key
-#Privilege Separation is turned on for security
-UsePrivilegeSeparation yes
-
-# ...but breaks Pam auth via kbdint, so we have to turn it off
-# Use PAM authentication via keyboard-interactive so PAM modules can
-# properly interface with the user (off due to PrivSep)
-#PAMAuthenticationViaKbdInt no
-# Lifetime and size of ephemeral version 1 server key
-KeyRegenerationInterval 3600
-ServerKeyBits 768
-
-# Logging
-SyslogFacility AUTH
-LogLevel INFO
-
-# Authentication:
-LoginGraceTime 600
-PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
-
-StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
-
-RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
-
-PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
-
-AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
-
-# For this to work you will also need host keys in /etc/ssh_known_hosts
-RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
-
-# Don't read the user's ~/.rhosts and ~/.shosts files
-IgnoreRhosts <%= scope.lookupvar('sshd::ignore_rhosts') %>
-
-# similar for protocol version 2
-HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
-
-# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
-#IgnoreUserKnownHosts yes
-
-# To enable empty passwords, change to yes (NOT RECOMMENDED)
-PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
-
-# Change to no to disable s/key passwords
-ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
-
-# To disable tunneled clear text passwords, change to no here!
-PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
-
-# To change Kerberos options
-#KerberosAuthentication no
-#KerberosOrLocalPasswd yes
-#AFSTokenPassing no
-#KerberosTicketCleanup no
-
-# Kerberos TGT Passing does only work with the AFS kaserver
-#KerberosTgtPassing yes
-
-X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
-X11DisplayOffset 10
-KeepAlive yes
-#UseLogin no
-
-#MaxStartups 10:30:60
-#Banner /etc/issue.net
-#ReverseMappingCheck yes
-
-Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/lib/openssh/sftp-server' : s %>
-
-# Set this to 'yes' to enable PAM authentication, account processing,
-# and session processing. If this is enabled, PAM authentication will
-# be allowed through the ChallengeResponseAuthentication and
-# PasswordAuthentication. Depending on your PAM configuration,
-# PAM authentication via ChallengeResponseAuthentication may bypass
-# the setting of "PermitRootLogin without-password".
-# If you just want the PAM account and session checks to run without
-# PAM authentication, then enable this but set PasswordAuthentication
-# and ChallengeResponseAuthentication to 'no'.
-UsePAM <%= scope.lookupvar('sshd::use_pam') %>
-
-AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
-
-<% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
-AllowUsers <%= s %>
-<% end -%>
-<% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
-AllowGroups <%= s %>
-<%- end -%>
-
-PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
-
-<% if scope.lookupvar('sshd::hardened_ssl') == 'yes' -%>
-Ciphers aes256-ctr
-MACs hmac-sha2-512
-<% end -%>
-
-<% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
-<%= s %>
-<% end -%>
diff --git a/templates/sshd_config/Debian_jessie.erb b/templates/sshd_config/Debian_jessie.erb
index 737f7a7..91dbfff 100644
--- a/templates/sshd_config/Debian_jessie.erb
+++ b/templates/sshd_config/Debian_jessie.erb
@@ -1,14 +1,14 @@
# This file is managed by Puppet, all local modifications will be overwritten
#
# Package generated configuration file
-# See the sshd(8) manpage for details
+# See the sshd_config(5) manpage for details
-<% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::head_additional_options')).empty? -%>
<%= s %>
<% end -%>
# What ports, IPs and protocols we listen for
-<% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
+<% scope.lookupvar('::sshd::ports').to_a.each do |port| -%>
<% if port == 'off' -%>
#Port -- disabled by puppet
<% else -%>
@@ -17,80 +17,79 @@ Port <%= port %>
<% end -%>
# Use these options to restrict which interfaces/protocols sshd will bind to
-<% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
+<% scope.lookupvar('::sshd::listen_address').to_a.each do |address| -%>
ListenAddress <%= address %>
<% end -%>
Protocol 2
# HostKeys for protocol version 2
-HostKey /etc/ssh/ssh_host_rsa_key
-#HostKey /etc/ssh/ssh_host_dsa_key
-#HostKey /etc/ssh/ssh_host_ecdsa_key
+<% scope.lookupvar('::sshd::hostkey_type').to_a.each do |hostkey_type| -%>
+HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
+<% end -%>
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
-ServerKeyBits 768
+ServerKeyBits 1024
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
-LoginGraceTime 600
-PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
-
-StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
-
-RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
+LoginGraceTime 120
+PermitRootLogin <%= scope.lookupvar('::sshd::permit_root_login') %>
+StrictModes <%= scope.lookupvar('::sshd::strict_modes') %>
-PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
-
-AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
+RSAAuthentication <%= scope.lookupvar('::sshd::rsa_authentication') %>
+PubkeyAuthentication <%= scope.lookupvar('::sshd::pubkey_authentication') %>
+AuthorizedKeysFile <%= scope.lookupvar('::sshd::authorized_keys_file') %>
# Don't read the user's ~/.rhosts and ~/.shosts files
-IgnoreRhosts <%= scope.lookupvar('sshd::ignore_rhosts') %>
+IgnoreRhosts <%= scope.lookupvar('::sshd::ignore_rhosts') %>
# For this to work you will also need host keys in /etc/ssh_known_hosts
-RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
+RhostsRSAAuthentication <%= scope.lookupvar('::sshd::rhosts_rsa_authentication') %>
# similar for protocol version 2
-HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
+HostbasedAuthentication <%= scope.lookupvar('::sshd::hostbased_authentication') %>
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
-PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
+PermitEmptyPasswords <%= scope.lookupvar('::sshd::permit_empty_passwords') %>
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
-ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
+ChallengeResponseAuthentication <%= scope.lookupvar('::sshd::challenge_response_authentication') %>
-# To disable tunneled clear text passwords, change to no here!
-PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
+# Change to no to disable tunnelled clear text passwords
+PasswordAuthentication <%= scope.lookupvar('::sshd::password_authentication') %>
# Kerberos options
-KerberosAuthentication <%= scope.lookupvar('sshd::kerberos_authentication') %>
-KerberosOrLocalPasswd <%= scope.lookupvar('sshd::kerberos_orlocalpasswd') %>
-KerberosTicketCleanup <%= scope.lookupvar('sshd::kerberos_ticketcleanup') %>
+KerberosAuthentication <%= scope.lookupvar('::sshd::kerberos_authentication') %>
+#KerberosGetAFSToken no
+KerberosOrLocalPasswd <%= scope.lookupvar('::sshd::kerberos_orlocalpasswd') %>
+KerberosTicketCleanup <%= scope.lookupvar('::sshd::kerberos_ticketcleanup') %>
# GSSAPI options
-GSSAPIAuthentication <%= scope.lookupvar('sshd::gssapi_authentication') %>
-GSSAPICleanupCredentials <%= scope.lookupvar('sshd::gssapi_cleanupcredentials') %>
+GSSAPIAuthentication <%= scope.lookupvar('::sshd::gssapi_authentication') %>
+GSSAPICleanupCredentials <%= scope.lookupvar('::sshd::gssapi_cleanupcredentials') %>
-X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
+X11Forwarding <%= scope.lookupvar('::sshd::x11_forwarding') %>
X11DisplayOffset 10
-PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
+PrintMotd <%= scope.lookupvar('::sshd::print_motd') %>
PrintLastLog yes
TCPKeepAlive yes
-
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
+# do not reveal debian version (default is yes)
+DebianBanner no
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
-Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/lib/openssh/sftp-server' : s %>
+Subsystem sftp <%= (s=scope.lookupvar('::sshd::sftp_subsystem')).empty? ? '/usr/lib/openssh/sftp-server' : s %>
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
@@ -101,24 +100,25 @@ Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ?
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
-UsePAM <%= scope.lookupvar('sshd::use_pam') %>
+UsePAM <%= scope.lookupvar('::sshd::use_pam') %>
-AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
+AllowTcpForwarding <%= scope.lookupvar('::sshd::tcp_forwarding') %>
-AllowAgentForwarding <%= scope.lookupvar('sshd::agent_forwarding') %>
+AllowAgentForwarding <%= scope.lookupvar('::sshd::agent_forwarding') %>
-<% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_users')).empty? -%>
AllowUsers <%= s %>
<% end -%>
-<% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_groups')).empty? -%>
AllowGroups <%= s %>
<%- end -%>
-<% if scope.lookupvar('sshd::hardened_ssl') == 'yes' -%>
-Ciphers aes256-ctr
-MACs hmac-sha2-512
+<% if scope.lookupvar('::sshd::hardened') == 'yes' -%>
+KexAlgorithms curve25519-sha256@libssh.org
+Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr
+MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
<% end -%>
-<% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::tail_additional_options')).empty? -%>
<%= s %>
<% end -%>
diff --git a/templates/sshd_config/Debian_lenny.erb b/templates/sshd_config/Debian_lenny.erb
deleted file mode 100644
index 8cbea30..0000000
--- a/templates/sshd_config/Debian_lenny.erb
+++ /dev/null
@@ -1,127 +0,0 @@
-# Package generated configuration file
-# See the sshd(8) manpage for details
-
-<% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
-<%= s %>
-<% end -%>
-
-# What ports, IPs and protocols we listen for
-<% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
-<% if port == 'off' -%>
-#Port -- disabled by puppet
-<% else -%>
-Port <%= port %>
-<% end -%>
-<% end -%>
-
-# Use these options to restrict which interfaces/protocols sshd will bind to
-<% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
-ListenAddress <%= address %>
-<% end -%>
-Protocol 2
-# HostKeys for protocol version 2
-HostKey /etc/ssh/ssh_host_rsa_key
-HostKey /etc/ssh/ssh_host_dsa_key
-#Privilege Separation is turned on for security
-UsePrivilegeSeparation yes
-
-# ...but breaks Pam auth via kbdint, so we have to turn it off
-# Use PAM authentication via keyboard-interactive so PAM modules can
-# properly interface with the user (off due to PrivSep)
-#PAMAuthenticationViaKbdInt no
-# Lifetime and size of ephemeral version 1 server key
-KeyRegenerationInterval 3600
-ServerKeyBits 768
-
-# Logging
-SyslogFacility AUTH
-LogLevel INFO
-
-# Authentication:
-LoginGraceTime 600
-PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
-
-StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
-
-RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
-
-PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
-
-AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
-
-# For this to work you will also need host keys in /etc/ssh_known_hosts
-RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
-
-# Don't read the user's ~/.rhosts and ~/.shosts files
-IgnoreRhosts <%= scope.lookupvar('sshd::ignore_rhosts') %>
-
-# similar for protocol version 2
-HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
-
-# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
-#IgnoreUserKnownHosts yes
-
-# To enable empty passwords, change to yes (NOT RECOMMENDED)
-PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
-
-# Change to no to disable s/key passwords
-ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
-
-# To disable tunneled clear text passwords, change to no here!
-PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
-
-# To change Kerberos options
-#KerberosAuthentication no
-#KerberosOrLocalPasswd yes
-#AFSTokenPassing no
-#KerberosTicketCleanup no
-
-# Kerberos TGT Passing does only work with the AFS kaserver
-#KerberosTgtPassing yes
-
-X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
-X11DisplayOffset 10
-KeepAlive yes
-#UseLogin no
-
-#MaxStartups 10:30:60
-#Banner /etc/issue.net
-#ReverseMappingCheck yes
-
-# Allow client to pass locale environment variables
-AcceptEnv LANG LC_*
-
-Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/lib/openssh/sftp-server' : s %>
-
-# Set this to 'yes' to enable PAM authentication, account processing,
-# and session processing. If this is enabled, PAM authentication will
-# be allowed through the ChallengeResponseAuthentication and
-# PasswordAuthentication. Depending on your PAM configuration,
-# PAM authentication via ChallengeResponseAuthentication may bypass
-# the setting of "PermitRootLogin without-password".
-# If you just want the PAM account and session checks to run without
-# PAM authentication, then enable this but set PasswordAuthentication
-# and ChallengeResponseAuthentication to 'no'.
-UsePAM <%= scope.lookupvar('sshd::use_pam') %>
-
-AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
-
-AllowAgentForwarding <%= scope.lookupvar('sshd::agent_forwarding') %>
-
-<% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
-AllowUsers <%= s %>
-<% end -%>
-<% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
-AllowGroups <%= s %>
-<%- end -%>
-
-PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
-
-<% if scope.lookupvar('sshd::hardened_ssl') == 'yes' -%>
-Ciphers aes256-ctr
-MACs hmac-sha1
-<% end -%>
-
-<% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
-<%= s %>
-<% end -%>
diff --git a/templates/sshd_config/Debian_sid.erb b/templates/sshd_config/Debian_sid.erb
index 60c15fa..91dbfff 100644
--- a/templates/sshd_config/Debian_sid.erb
+++ b/templates/sshd_config/Debian_sid.erb
@@ -1,14 +1,14 @@
# This file is managed by Puppet, all local modifications will be overwritten
#
# Package generated configuration file
-# See the sshd(8) manpage for details
+# See the sshd_config(5) manpage for details
-<% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::head_additional_options')).empty? -%>
<%= s %>
<% end -%>
# What ports, IPs and protocols we listen for
-<% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
+<% scope.lookupvar('::sshd::ports').to_a.each do |port| -%>
<% if port == 'off' -%>
#Port -- disabled by puppet
<% else -%>
@@ -17,79 +17,79 @@ Port <%= port %>
<% end -%>
# Use these options to restrict which interfaces/protocols sshd will bind to
-<% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
+<% scope.lookupvar('::sshd::listen_address').to_a.each do |address| -%>
ListenAddress <%= address %>
<% end -%>
Protocol 2
# HostKeys for protocol version 2
-HostKey /etc/ssh/ssh_host_rsa_key
-HostKey /etc/ssh/ssh_host_dsa_key
+<% scope.lookupvar('::sshd::hostkey_type').to_a.each do |hostkey_type| -%>
+HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
+<% end -%>
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
-ServerKeyBits 768
+ServerKeyBits 1024
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
-LoginGraceTime 600
-PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
-
-StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
-
-RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
+LoginGraceTime 120
+PermitRootLogin <%= scope.lookupvar('::sshd::permit_root_login') %>
+StrictModes <%= scope.lookupvar('::sshd::strict_modes') %>
-PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
-
-AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
+RSAAuthentication <%= scope.lookupvar('::sshd::rsa_authentication') %>
+PubkeyAuthentication <%= scope.lookupvar('::sshd::pubkey_authentication') %>
+AuthorizedKeysFile <%= scope.lookupvar('::sshd::authorized_keys_file') %>
# Don't read the user's ~/.rhosts and ~/.shosts files
-IgnoreRhosts <%= scope.lookupvar('sshd::ignore_rhosts') %>
+IgnoreRhosts <%= scope.lookupvar('::sshd::ignore_rhosts') %>
# For this to work you will also need host keys in /etc/ssh_known_hosts
-RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
+RhostsRSAAuthentication <%= scope.lookupvar('::sshd::rhosts_rsa_authentication') %>
# similar for protocol version 2
-HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
+HostbasedAuthentication <%= scope.lookupvar('::sshd::hostbased_authentication') %>
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
-PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
+PermitEmptyPasswords <%= scope.lookupvar('::sshd::permit_empty_passwords') %>
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
-ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
+ChallengeResponseAuthentication <%= scope.lookupvar('::sshd::challenge_response_authentication') %>
-# To disable tunneled clear text passwords, change to no here!
-PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
+# Change to no to disable tunnelled clear text passwords
+PasswordAuthentication <%= scope.lookupvar('::sshd::password_authentication') %>
# Kerberos options
-KerberosAuthentication <%= scope.lookupvar('sshd::kerberos_authentication') %>
-KerberosOrLocalPasswd <%= scope.lookupvar('sshd::kerberos_orlocalpasswd') %>
-KerberosTicketCleanup <%= scope.lookupvar('sshd::kerberos_ticketcleanup') %>
+KerberosAuthentication <%= scope.lookupvar('::sshd::kerberos_authentication') %>
+#KerberosGetAFSToken no
+KerberosOrLocalPasswd <%= scope.lookupvar('::sshd::kerberos_orlocalpasswd') %>
+KerberosTicketCleanup <%= scope.lookupvar('::sshd::kerberos_ticketcleanup') %>
# GSSAPI options
-GSSAPIAuthentication <%= scope.lookupvar('sshd::gssapi_authentication') %>
-GSSAPICleanupCredentials <%= scope.lookupvar('sshd::gssapi_cleanupcredentials') %>
+GSSAPIAuthentication <%= scope.lookupvar('::sshd::gssapi_authentication') %>
+GSSAPICleanupCredentials <%= scope.lookupvar('::sshd::gssapi_cleanupcredentials') %>
-X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
+X11Forwarding <%= scope.lookupvar('::sshd::x11_forwarding') %>
X11DisplayOffset 10
-PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
+PrintMotd <%= scope.lookupvar('::sshd::print_motd') %>
PrintLastLog yes
TCPKeepAlive yes
-
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
+# do not reveal debian version (default is yes)
+DebianBanner no
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
-Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/lib/openssh/sftp-server' : s %>
+Subsystem sftp <%= (s=scope.lookupvar('::sshd::sftp_subsystem')).empty? ? '/usr/lib/openssh/sftp-server' : s %>
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
@@ -100,24 +100,25 @@ Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ?
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
-UsePAM <%= scope.lookupvar('sshd::use_pam') %>
+UsePAM <%= scope.lookupvar('::sshd::use_pam') %>
-AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
+AllowTcpForwarding <%= scope.lookupvar('::sshd::tcp_forwarding') %>
-AllowAgentForwarding <%= scope.lookupvar('sshd::agent_forwarding') %>
+AllowAgentForwarding <%= scope.lookupvar('::sshd::agent_forwarding') %>
-<% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_users')).empty? -%>
AllowUsers <%= s %>
<% end -%>
-<% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_groups')).empty? -%>
AllowGroups <%= s %>
<%- end -%>
-<% if scope.lookupvar('sshd::hardened_ssl') == 'yes' -%>
-Ciphers aes256-ctr
-MACs hmac-sha2-512
+<% if scope.lookupvar('::sshd::hardened') == 'yes' -%>
+KexAlgorithms curve25519-sha256@libssh.org
+Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr
+MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
<% end -%>
-<% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::tail_additional_options')).empty? -%>
<%= s %>
<% end -%>
diff --git a/templates/sshd_config/Debian_squeeze.erb b/templates/sshd_config/Debian_squeeze.erb
index 375846a..649b320 100644
--- a/templates/sshd_config/Debian_squeeze.erb
+++ b/templates/sshd_config/Debian_squeeze.erb
@@ -3,12 +3,12 @@
# Package generated configuration file
# See the sshd(8) manpage for details
-<% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::head_additional_options')).empty? -%>
<%= s %>
<% end -%>
# What ports, IPs and protocols we listen for
-<% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
+<% scope.lookupvar('::sshd::ports').to_a.each do |port| -%>
<% if port == 'off' -%>
#Port -- disabled by puppet
<% else -%>
@@ -17,13 +17,15 @@ Port <%= port %>
<% end -%>
# Use these options to restrict which interfaces/protocols sshd will bind to
-<% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
+<% scope.lookupvar('::sshd::listen_address').to_a.each do |address| -%>
ListenAddress <%= address %>
<% end -%>
Protocol 2
# HostKeys for protocol version 2
-HostKey /etc/ssh/ssh_host_rsa_key
-#HostKey /etc/ssh/ssh_host_dsa_key
+<% scope.lookupvar('::sshd::hostkey_type').to_a.each do |hostkey_type| -%>
+HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
+<% end -%>
+
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
@@ -37,47 +39,47 @@ LogLevel INFO
# Authentication:
LoginGraceTime 120
-PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
+PermitRootLogin <%= scope.lookupvar('::sshd::permit_root_login') %>
-StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
+StrictModes <%= scope.lookupvar('::sshd::strict_modes') %>
-RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
+RSAAuthentication <%= scope.lookupvar('::sshd::rsa_authentication') %>
-PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
+PubkeyAuthentication <%= scope.lookupvar('::sshd::pubkey_authentication') %>
-AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
+AuthorizedKeysFile <%= scope.lookupvar('::sshd::authorized_keys_file') %>
# Don't read the user's ~/.rhosts and ~/.shosts files
-IgnoreRhosts <%= scope.lookupvar('sshd::ignore_rhosts') %>
+IgnoreRhosts <%= scope.lookupvar('::sshd::ignore_rhosts') %>
# For this to work you will also need host keys in /etc/ssh_known_hosts
-RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
+RhostsRSAAuthentication <%= scope.lookupvar('::sshd::rhosts_rsa_authentication') %>
# similar for protocol version 2
-HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
+HostbasedAuthentication <%= scope.lookupvar('::sshd::hostbased_authentication') %>
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
-PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
+PermitEmptyPasswords <%= scope.lookupvar('::sshd::permit_empty_passwords') %>
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
-ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
+ChallengeResponseAuthentication <%= scope.lookupvar('::sshd::challenge_response_authentication') %>
# To disable tunneled clear text passwords, change to no here!
-PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
+PasswordAuthentication <%= scope.lookupvar('::sshd::password_authentication') %>
# Kerberos options
-KerberosAuthentication <%= scope.lookupvar('sshd::kerberos_authentication') %>
-KerberosOrLocalPasswd <%= scope.lookupvar('sshd::kerberos_orlocalpasswd') %>
-KerberosTicketCleanup <%= scope.lookupvar('sshd::kerberos_ticketcleanup') %>
+KerberosAuthentication <%= scope.lookupvar('::sshd::kerberos_authentication') %>
+KerberosOrLocalPasswd <%= scope.lookupvar('::sshd::kerberos_orlocalpasswd') %>
+KerberosTicketCleanup <%= scope.lookupvar('::sshd::kerberos_ticketcleanup') %>
# GSSAPI options
-GSSAPIAuthentication <%= scope.lookupvar('sshd::gssapi_authentication') %>
-GSSAPICleanupCredentials <%= scope.lookupvar('sshd::gssapi_cleanupcredentials') %>
+GSSAPIAuthentication <%= scope.lookupvar('::sshd::gssapi_authentication') %>
+GSSAPICleanupCredentials <%= scope.lookupvar('::sshd::gssapi_cleanupcredentials') %>
-X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
+X11Forwarding <%= scope.lookupvar('::sshd::x11_forwarding') %>
X11DisplayOffset 10
-PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
+PrintMotd <%= scope.lookupvar('::sshd::print_motd') %>
PrintLastLog yes
TCPKeepAlive yes
@@ -85,11 +87,13 @@ TCPKeepAlive yes
#MaxStartups 10:30:60
#Banner /etc/issue.net
+# do not reveal debian version (default is yes)
+DebianBanner no
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
-Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/lib/openssh/sftp-server' : s %>
+Subsystem sftp <%= (s=scope.lookupvar('::sshd::sftp_subsystem')).empty? ? '/usr/lib/openssh/sftp-server' : s %>
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
@@ -100,24 +104,24 @@ Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ?
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
-UsePAM <%= scope.lookupvar('sshd::use_pam') %>
+UsePAM <%= scope.lookupvar('::sshd::use_pam') %>
-AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
+AllowTcpForwarding <%= scope.lookupvar('::sshd::tcp_forwarding') %>
-AllowAgentForwarding <%= scope.lookupvar('sshd::agent_forwarding') %>
+AllowAgentForwarding <%= scope.lookupvar('::sshd::agent_forwarding') %>
-<% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_users')).empty? -%>
AllowUsers <%= s %>
<% end -%>
-<% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_groups')).empty? -%>
AllowGroups <%= s %>
<%- end -%>
-<% if scope.lookupvar('sshd::hardened_ssl') == 'yes' -%>
+<% if scope.lookupvar('::sshd::hardened') == 'yes' -%>
Ciphers aes256-ctr
-MACs hmac-sha1
+MACs hmac-sha2-512
<% end -%>
-<% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::tail_additional_options')).empty? -%>
<%= s %>
<% end -%>
diff --git a/templates/sshd_config/Debian_wheezy.erb b/templates/sshd_config/Debian_wheezy.erb
index 737f7a7..bcb1528 100644
--- a/templates/sshd_config/Debian_wheezy.erb
+++ b/templates/sshd_config/Debian_wheezy.erb
@@ -3,12 +3,12 @@
# Package generated configuration file
# See the sshd(8) manpage for details
-<% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::head_additional_options')).empty? -%>
<%= s %>
<% end -%>
# What ports, IPs and protocols we listen for
-<% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
+<% scope.lookupvar('::sshd::ports').to_a.each do |port| -%>
<% if port == 'off' -%>
#Port -- disabled by puppet
<% else -%>
@@ -17,14 +17,14 @@ Port <%= port %>
<% end -%>
# Use these options to restrict which interfaces/protocols sshd will bind to
-<% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
+<% scope.lookupvar('::sshd::listen_address').to_a.each do |address| -%>
ListenAddress <%= address %>
<% end -%>
Protocol 2
# HostKeys for protocol version 2
-HostKey /etc/ssh/ssh_host_rsa_key
-#HostKey /etc/ssh/ssh_host_dsa_key
-#HostKey /etc/ssh/ssh_host_ecdsa_key
+<% scope.lookupvar('::sshd::hostkey_type').to_a.each do |hostkey_type| -%>
+HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
+<% end -%>
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
@@ -37,48 +37,48 @@ SyslogFacility AUTH
LogLevel INFO
# Authentication:
-LoginGraceTime 600
-PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
+LoginGraceTime 120
+PermitRootLogin <%= scope.lookupvar('::sshd::permit_root_login') %>
-StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
+StrictModes <%= scope.lookupvar('::sshd::strict_modes') %>
-RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
+RSAAuthentication <%= scope.lookupvar('::sshd::rsa_authentication') %>
-PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
+PubkeyAuthentication <%= scope.lookupvar('::sshd::pubkey_authentication') %>
-AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
+AuthorizedKeysFile <%= scope.lookupvar('::sshd::authorized_keys_file') %>
# Don't read the user's ~/.rhosts and ~/.shosts files
-IgnoreRhosts <%= scope.lookupvar('sshd::ignore_rhosts') %>
+IgnoreRhosts <%= scope.lookupvar('::sshd::ignore_rhosts') %>
# For this to work you will also need host keys in /etc/ssh_known_hosts
-RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
+RhostsRSAAuthentication <%= scope.lookupvar('::sshd::rhosts_rsa_authentication') %>
# similar for protocol version 2
-HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
+HostbasedAuthentication <%= scope.lookupvar('::sshd::hostbased_authentication') %>
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
-PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
+PermitEmptyPasswords <%= scope.lookupvar('::sshd::permit_empty_passwords') %>
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
-ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
+ChallengeResponseAuthentication <%= scope.lookupvar('::sshd::challenge_response_authentication') %>
# To disable tunneled clear text passwords, change to no here!
-PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
+PasswordAuthentication <%= scope.lookupvar('::sshd::password_authentication') %>
# Kerberos options
-KerberosAuthentication <%= scope.lookupvar('sshd::kerberos_authentication') %>
-KerberosOrLocalPasswd <%= scope.lookupvar('sshd::kerberos_orlocalpasswd') %>
-KerberosTicketCleanup <%= scope.lookupvar('sshd::kerberos_ticketcleanup') %>
+KerberosAuthentication <%= scope.lookupvar('::sshd::kerberos_authentication') %>
+KerberosOrLocalPasswd <%= scope.lookupvar('::sshd::kerberos_orlocalpasswd') %>
+KerberosTicketCleanup <%= scope.lookupvar('::sshd::kerberos_ticketcleanup') %>
# GSSAPI options
-GSSAPIAuthentication <%= scope.lookupvar('sshd::gssapi_authentication') %>
-GSSAPICleanupCredentials <%= scope.lookupvar('sshd::gssapi_cleanupcredentials') %>
+GSSAPIAuthentication <%= scope.lookupvar('::sshd::gssapi_authentication') %>
+GSSAPICleanupCredentials <%= scope.lookupvar('::sshd::gssapi_cleanupcredentials') %>
-X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
+X11Forwarding <%= scope.lookupvar('::sshd::x11_forwarding') %>
X11DisplayOffset 10
-PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
+PrintMotd <%= scope.lookupvar('::sshd::print_motd') %>
PrintLastLog yes
TCPKeepAlive yes
@@ -86,11 +86,13 @@ TCPKeepAlive yes
#MaxStartups 10:30:60
#Banner /etc/issue.net
+# do not reveal debian version (default is yes)
+DebianBanner no
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
-Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/lib/openssh/sftp-server' : s %>
+Subsystem sftp <%= (s=scope.lookupvar('::sshd::sftp_subsystem')).empty? ? '/usr/lib/openssh/sftp-server' : s %>
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
@@ -101,24 +103,30 @@ Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ?
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
-UsePAM <%= scope.lookupvar('sshd::use_pam') %>
+UsePAM <%= scope.lookupvar('::sshd::use_pam') %>
-AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
+AllowTcpForwarding <%= scope.lookupvar('::sshd::tcp_forwarding') %>
-AllowAgentForwarding <%= scope.lookupvar('sshd::agent_forwarding') %>
+AllowAgentForwarding <%= scope.lookupvar('::sshd::agent_forwarding') %>
-<% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_users')).empty? -%>
AllowUsers <%= s %>
<% end -%>
-<% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_groups')).empty? -%>
AllowGroups <%= s %>
<%- end -%>
-<% if scope.lookupvar('sshd::hardened_ssl') == 'yes' -%>
+<% if scope.lookupvar('::sshd::hardened') == 'yes' -%>
+<% if (scope.function_versioncmp([scope.lookupvar('::ssh_version'),'6.5'])) >= 0 -%>
+KexAlgorithms curve25519-sha256@libssh.org
+Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr
+MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
+<% else -%>
Ciphers aes256-ctr
MACs hmac-sha2-512
<% end -%>
+<% end -%>
-<% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::tail_additional_options')).empty? -%>
<%= s %>
<% end -%>
diff --git a/templates/sshd_config/FreeBSD.erb b/templates/sshd_config/FreeBSD.erb
index 81b7e10..40a4caa 100644
--- a/templates/sshd_config/FreeBSD.erb
+++ b/templates/sshd_config/FreeBSD.erb
@@ -16,12 +16,12 @@
#VersionAddendum FreeBSD-20100308
-<% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::head_additional_options')).empty? -%>
<%= s %>
<% end -%>
# What ports, IPs and protocols we listen for
-<% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
+<% scope.lookupvar('::sshd::ports').to_a.each do |port| -%>
<% if port == 'off' -%>
#Port -- disabled by puppet
<% else -%>
@@ -30,7 +30,7 @@ Port <%= port %>
<% end -%>
#AddressFamily any
-<% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
+<% scope.lookupvar('::sshd::listen_address').to_a.each do |address| -%>
ListenAddress <%= address %>
<% end -%>
@@ -40,8 +40,9 @@ Protocol 2
# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
-HostKey /etc/ssh/ssh_host_rsa_key
-HostKey /etc/ssh/ssh_host_dsa_key
+<% scope.lookupvar('::sshd::hostkey_type').to_a.each do |hostkey_type| -%>
+HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
+<% end -%>
# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
@@ -55,24 +56,24 @@ LogLevel INFO
# Authentication:
LoginGraceTime 600
-PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
+PermitRootLogin <%= scope.lookupvar('::sshd::permit_root_login') %>
-StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
+StrictModes <%= scope.lookupvar('::sshd::strict_modes') %>
#MaxAuthTries 6
#MaxSessions 10
-RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
+RSAAuthentication <%= scope.lookupvar('::sshd::rsa_authentication') %>
-PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
+PubkeyAuthentication <%= scope.lookupvar('::sshd::pubkey_authentication') %>
-AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
+AuthorizedKeysFile <%= scope.lookupvar('::sshd::authorized_keys_file') %>
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
-RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
+RhostsRSAAuthentication <%= scope.lookupvar('::sshd::rhosts_rsa_authentication') %>
# similar for protocol version 2
-HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
+HostbasedAuthentication <%= scope.lookupvar('::sshd::hostbased_authentication') %>
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
@@ -81,21 +82,21 @@ HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
#IgnoreRhosts yes
# Change to yes to enable built-in password authentication.
-PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
+PasswordAuthentication <%= scope.lookupvar('::sshd::password_authentication') %>
-PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
+PermitEmptyPasswords <%= scope.lookupvar('::sshd::permit_empty_passwords') %>
# Change to no to disable PAM authentication
-ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
+ChallengeResponseAuthentication <%= scope.lookupvar('::sshd::challenge_response_authentication') %>
# Kerberos options
-KerberosAuthentication <%= scope.lookupvar('sshd::kerberos_authentication') %>
-KerberosOrLocalPasswd <%= scope.lookupvar('sshd::kerberos_orlocalpasswd') %>
-KerberosTicketCleanup <%= scope.lookupvar('sshd::kerberos_ticketcleanup') %>
+KerberosAuthentication <%= scope.lookupvar('::sshd::kerberos_authentication') %>
+KerberosOrLocalPasswd <%= scope.lookupvar('::sshd::kerberos_orlocalpasswd') %>
+KerberosTicketCleanup <%= scope.lookupvar('::sshd::kerberos_ticketcleanup') %>
# GSSAPI options
-GSSAPIAuthentication <%= scope.lookupvar('sshd::gssapi_authentication') %>
-GSSAPICleanupCredentials <%= scope.lookupvar('sshd::gssapi_cleanupcredentials') %>
+GSSAPIAuthentication <%= scope.lookupvar('::sshd::gssapi_authentication') %>
+GSSAPICleanupCredentials <%= scope.lookupvar('::sshd::gssapi_cleanupcredentials') %>
# Set this to 'no' to disable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
@@ -106,14 +107,14 @@ GSSAPICleanupCredentials <%= scope.lookupvar('sshd::gssapi_cleanupcredentials')
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
-UsePAM <%= scope.lookupvar('sshd::use_pam') %>
+UsePAM <%= scope.lookupvar('::sshd::use_pam') %>
-AllowAgentForwarding <%= scope.lookupvar('sshd::agent_forwarding') %>
+AllowAgentForwarding <%= scope.lookupvar('::sshd::agent_forwarding') %>
-AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
+AllowTcpForwarding <%= scope.lookupvar('::sshd::tcp_forwarding') %>
#GatewayPorts no
-X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
+X11Forwarding <%= scope.lookupvar('::sshd::x11_forwarding') %>
X11DisplayOffset 10
#X11UseLocalhost yes
@@ -136,7 +137,7 @@ TCPKeepAlive yes
#Banner none
# override default of no subsystems
-Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/libexec/sftp-server' : s %>
+Subsystem sftp <%= (s=scope.lookupvar('::sshd::sftp_subsystem')).empty? ? '/usr/libexec/sftp-server' : s %>
# Example of overriding settings on a per-user basis
#Match User anoncvs
@@ -144,18 +145,24 @@ Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ?
# AllowTcpForwarding no
# ForceCommand cvs server
-<% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_users')).empty? -%>
AllowUsers <%= s %>
<% end -%>
-<% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_groups')).empty? -%>
AllowGroups <%= s %>
<%- end -%>
-<% if scope.lookupvar('sshd::hardened_ssl') == 'yes' -%>
+<% if scope.lookupvar('::sshd::hardened') == 'yes' -%>
+<% if (scope.function_versioncmp([scope.lookupvar('::ssh_version'),'6.5'])) >= 0 -%>
+KexAlgorithms curve25519-sha256@libssh.org
+Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr
+MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
+<% else -%>
Ciphers aes256-ctr
MACs hmac-sha2-512
<% end -%>
+<% end -%>
-<% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::tail_additional_options')).empty? -%>
<%= s %>
<% end -%>
diff --git a/templates/sshd_config/Gentoo.erb b/templates/sshd_config/Gentoo.erb
index cdd51d8..753e24a 100644
--- a/templates/sshd_config/Gentoo.erb
+++ b/templates/sshd_config/Gentoo.erb
@@ -10,11 +10,11 @@
# possible, but leave them commented. Uncommented options change a
# default value.
-<% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::head_additional_options')).empty? -%>
<%= s %>
<% end -%>
-<% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
+<% scope.lookupvar('::sshd::ports').to_a.each do |port| -%>
<% if port == 'off' -%>
#Port -- disabled by puppet
<% else -%>
@@ -23,7 +23,7 @@ Port <%= port %>
<% end -%>
# Use these options to restrict which interfaces/protocols sshd will bind to
-<% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
+<% scope.lookupvar('::sshd::listen_address').to_a.each do |address| -%>
ListenAddress <%= address %>
<% end -%>
#AddressFamily any
@@ -51,39 +51,39 @@ Protocol 2
# Authentication:
#LoginGraceTime 2m
-PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
+PermitRootLogin <%= scope.lookupvar('::sshd::permit_root_login') %>
-StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
+StrictModes <%= scope.lookupvar('::sshd::strict_modes') %>
#MaxAuthTries 6
-RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
+RSAAuthentication <%= scope.lookupvar('::sshd::rsa_authentication') %>
-PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
+PubkeyAuthentication <%= scope.lookupvar('::sshd::pubkey_authentication') %>
-AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
+AuthorizedKeysFile <%= scope.lookupvar('::sshd::authorized_keys_file') %>
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
-RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
+RhostsRSAAuthentication <%= scope.lookupvar('::sshd::rhosts_rsa_authentication') %>
# similar for protocol version 2
-HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
+HostbasedAuthentication <%= scope.lookupvar('::sshd::hostbased_authentication') %>
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
-IgnoreRhosts <%= scope.lookupvar('sshd::ignore_rhosts') %>
+IgnoreRhosts <%= scope.lookupvar('::sshd::ignore_rhosts') %>
# To disable tunneled clear text passwords, change to no here!
-PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
+PasswordAuthentication <%= scope.lookupvar('::sshd::password_authentication') %>
# To enable empty passwords, change to yes (NOT RECOMMENDED)
-PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
+PermitEmptyPasswords <%= scope.lookupvar('::sshd::permit_empty_passwords') %>
# Change to no to disable s/key passwords
-ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
+ChallengeResponseAuthentication <%= scope.lookupvar('::sshd::challenge_response_authentication') %>
# Kerberos options
#KerberosAuthentication no
@@ -106,15 +106,15 @@ ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_au
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
-UsePAM <%= scope.lookupvar('sshd::use_pam') %>
+UsePAM <%= scope.lookupvar('::sshd::use_pam') %>
-AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
+AllowTcpForwarding <%= scope.lookupvar('::sshd::tcp_forwarding') %>
#GatewayPorts no
-X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
+X11Forwarding <%= scope.lookupvar('::sshd::x11_forwarding') %>
#X11DisplayOffset 10
#X11UseLocalhost yes
-PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
+PrintMotd <%= scope.lookupvar('::sshd::print_motd') %>
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
@@ -132,7 +132,7 @@ PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
#Banner /some/path
# override default of no subsystems
-Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/lib/misc/sftp-server' : s %>
+Subsystem sftp <%= (s=scope.lookupvar('::sshd::sftp_subsystem')).empty? ? '/usr/lib/misc/sftp-server' : s %>
# Example of overriding settings on a per-user basis
#Match User anoncvs
@@ -140,19 +140,25 @@ Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ?
# AllowTcpForwarding no
# ForceCommand cvs server
-<% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_users')).empty? -%>
AllowUsers <%= s %>
<% end -%>
-<% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_groups')).empty? -%>
AllowGroups <%= s %>
<%- end -%>
-<% if scope.lookupvar('sshd::hardened_ssl') == 'yes' -%>
+<% if scope.lookupvar('::sshd::hardened') == 'yes' -%>
+<% if (scope.function_versioncmp([scope.lookupvar('::ssh_version'),'6.5'])) >= 0 -%>
+KexAlgorithms curve25519-sha256@libssh.org
+Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr
+MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
+<% else -%>
Ciphers aes256-ctr
MACs hmac-sha2-512
<% end -%>
+<% end -%>
-<% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::tail_additional_options')).empty? -%>
<%= s %>
<% end -%>
diff --git a/templates/sshd_config/OpenBSD.erb b/templates/sshd_config/OpenBSD.erb
index ea6e8a8..aec299c 100644
--- a/templates/sshd_config/OpenBSD.erb
+++ b/templates/sshd_config/OpenBSD.erb
@@ -8,11 +8,11 @@
# possible, but leave them commented. Uncommented options change a
# default value.
-<% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::head_additional_options')).empty? -%>
<%= s %>
<% end -%>
-<% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
+<% scope.lookupvar('::sshd::ports').to_a.each do |port| -%>
<% if port == 'off' -%>
#Port -- disabled by puppet
<% else -%>
@@ -21,7 +21,7 @@ Port <%= port %>
<% end -%>
# Use these options to restrict which interfaces/protocols sshd will bind to
-<% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
+<% scope.lookupvar('::sshd::listen_address').to_a.each do |address| -%>
ListenAddress <%= address %>
<% end -%>
#Protocol 2,1
@@ -45,39 +45,39 @@ ListenAddress <%= address %>
# Authentication:
#LoginGraceTime 2m
-PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
+PermitRootLogin <%= scope.lookupvar('::sshd::permit_root_login') %>
-StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
+StrictModes <%= scope.lookupvar('::sshd::strict_modes') %>
#MaxAuthTries 6
-RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
+RSAAuthentication <%= scope.lookupvar('::sshd::rsa_authentication') %>
-PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
+PubkeyAuthentication <%= scope.lookupvar('::sshd::pubkey_authentication') %>
-AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
+AuthorizedKeysFile <%= scope.lookupvar('::sshd::authorized_keys_file') %>
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
-RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
+RhostsRSAAuthentication <%= scope.lookupvar('::sshd::rhosts_rsa_authentication') %>
# similar for protocol version 2
-HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
+HostbasedAuthentication <%= scope.lookupvar('::sshd::hostbased_authentication') %>
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
-IgnoreRhosts <%= scope.lookupvar('sshd::ignore_rhosts') %>
+IgnoreRhosts <%= scope.lookupvar('::sshd::ignore_rhosts') %>
# To disable tunneled clear text passwords, change to no here!
-PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
+PasswordAuthentication <%= scope.lookupvar('::sshd::password_authentication') %>
# To enable empty passwords, change to yes (NOT RECOMMENDED)
-PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
+PermitEmptyPasswords <%= scope.lookupvar('::sshd::permit_empty_passwords') %>
# Change to no to disable s/key passwords
-ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
+ChallengeResponseAuthentication <%= scope.lookupvar('::sshd::challenge_response_authentication') %>
# Kerberos options
#KerberosAuthentication no
@@ -89,13 +89,13 @@ ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_au
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
-AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
+AllowTcpForwarding <%= scope.lookupvar('::sshd::tcp_forwarding') %>
#GatewayPorts no
-X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
+X11Forwarding <%= scope.lookupvar('::sshd::x11_forwarding') %>
#X11DisplayOffset 10
#X11UseLocalhost yes
-PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
+PrintMotd <%= scope.lookupvar('::sshd::print_motd') %>
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
@@ -113,12 +113,12 @@ PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
#Banner /some/path
# override default of no subsystems
-Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/libexec/sftp-server' : s %>
+Subsystem sftp <%= (s=scope.lookupvar('::sshd::sftp_subsystem')).empty? ? '/usr/libexec/sftp-server' : s %>
-<% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_users')).empty? -%>
AllowUsers <%= s %>
<% end -%>
-<% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_groups')).empty? -%>
AllowGroups <%= s %>
<%- end -%>
@@ -128,11 +128,17 @@ AllowGroups <%= s %>
# AllowTcpForwarding no
# ForceCommand cvs server
-<% if scope.lookupvar('sshd::hardened_ssl') == 'yes' -%>
+<% if scope.lookupvar('::sshd::hardened') == 'yes' -%>
+<% if (scope.function_versioncmp([scope.lookupvar('::ssh_version'),'6.5'])) >= 0 -%>
+KexAlgorithms curve25519-sha256@libssh.org
+Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr
+MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
+<% else -%>
Ciphers aes256-ctr
MACs hmac-sha2-512
<% end -%>
+<% end -%>
-<% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::tail_additional_options')).empty? -%>
<%= s %>
<% end -%>
diff --git a/templates/sshd_config/Ubuntu.erb b/templates/sshd_config/Ubuntu.erb
index 40040d1..1adb4f2 100644
--- a/templates/sshd_config/Ubuntu.erb
+++ b/templates/sshd_config/Ubuntu.erb
@@ -3,12 +3,12 @@
# Package generated configuration file
# See the sshd(8) manpage for details
-<% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::head_additional_options')).empty? -%>
<%= s %>
<% end -%>
# What ports, IPs and protocols we listen for
-<% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
+<% scope.lookupvar('::sshd::ports').to_a.each do |port| -%>
<% if port == 'off' -%>
#Port -- disabled by puppet
<% else -%>
@@ -17,13 +17,15 @@ Port <%= port %>
<% end -%>
# Use these options to restrict which interfaces/protocols sshd will bind to
-<% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
+<% scope.lookupvar('::sshd::listen_address').to_a.each do |address| -%>
ListenAddress <%= address %>
<% end -%>
Protocol 2
# HostKeys for protocol version 2
-HostKey /etc/ssh/ssh_host_rsa_key
-HostKey /etc/ssh/ssh_host_dsa_key
+<% scope.lookupvar('::sshd::hostkey_type').to_a.each do |hostkey_type| -%>
+HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
+<% end -%>
+
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
@@ -37,47 +39,47 @@ LogLevel INFO
# Authentication:
LoginGraceTime 120
-PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
+PermitRootLogin <%= scope.lookupvar('::sshd::permit_root_login') %>
-StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
+StrictModes <%= scope.lookupvar('::sshd::strict_modes') %>
-RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
+RSAAuthentication <%= scope.lookupvar('::sshd::rsa_authentication') %>
-PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
+PubkeyAuthentication <%= scope.lookupvar('::sshd::pubkey_authentication') %>
-AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
+AuthorizedKeysFile <%= scope.lookupvar('::sshd::authorized_keys_file') %>
# Don't read the user's ~/.rhosts and ~/.shosts files
-IgnoreRhosts <%= scope.lookupvar('sshd::ignore_rhosts') %>
+IgnoreRhosts <%= scope.lookupvar('::sshd::ignore_rhosts') %>
# For this to work you will also need host keys in /etc/ssh_known_hosts
-RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
+RhostsRSAAuthentication <%= scope.lookupvar('::sshd::rhosts_rsa_authentication') %>
# similar for protocol version 2
-HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
+HostbasedAuthentication <%= scope.lookupvar('::sshd::hostbased_authentication') %>
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
-PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
+PermitEmptyPasswords <%= scope.lookupvar('::sshd::permit_empty_passwords') %>
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
-ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
+ChallengeResponseAuthentication <%= scope.lookupvar('::sshd::challenge_response_authentication') %>
# To disable tunneled clear text passwords, change to no here!
-PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
+PasswordAuthentication <%= scope.lookupvar('::sshd::password_authentication') %>
# Kerberos options
-KerberosAuthentication <%= scope.lookupvar('sshd::kerberos_authentication') %>
-KerberosOrLocalPasswd <%= scope.lookupvar('sshd::kerberos_orlocalpasswd') %>
-KerberosTicketCleanup <%= scope.lookupvar('sshd::kerberos_ticketcleanup') %>
+KerberosAuthentication <%= scope.lookupvar('::sshd::kerberos_authentication') %>
+KerberosOrLocalPasswd <%= scope.lookupvar('::sshd::kerberos_orlocalpasswd') %>
+KerberosTicketCleanup <%= scope.lookupvar('::sshd::kerberos_ticketcleanup') %>
# GSSAPI options
-GSSAPIAuthentication <%= scope.lookupvar('sshd::gssapi_authentication') %>
-GSSAPICleanupCredentials <%= scope.lookupvar('sshd::gssapi_cleanupcredentials') %>
+GSSAPIAuthentication <%= scope.lookupvar('::sshd::gssapi_authentication') %>
+GSSAPICleanupCredentials <%= scope.lookupvar('::sshd::gssapi_cleanupcredentials') %>
-X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
+X11Forwarding <%= scope.lookupvar('::sshd::x11_forwarding') %>
X11DisplayOffset 10
-PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
+PrintMotd <%= scope.lookupvar('::sshd::print_motd') %>
PrintLastLog yes
TCPKeepAlive yes
@@ -85,11 +87,13 @@ TCPKeepAlive yes
#MaxStartups 10:30:60
#Banner /etc/issue.net
+# do not reveal debian version (default is yes)
+DebianBanner no
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
-Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/lib/openssh/sftp-server' : s %>
+Subsystem sftp <%= (s=scope.lookupvar('::sshd::sftp_subsystem')).empty? ? '/usr/lib/openssh/sftp-server' : s %>
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
@@ -100,24 +104,30 @@ Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ?
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
-UsePAM <%= scope.lookupvar('sshd::use_pam') %>
+UsePAM <%= scope.lookupvar('::sshd::use_pam') %>
-AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
+AllowTcpForwarding <%= scope.lookupvar('::sshd::tcp_forwarding') %>
-AllowAgentForwarding <%= scope.lookupvar('sshd::agent_forwarding') %>
+AllowAgentForwarding <%= scope.lookupvar('::sshd::agent_forwarding') %>
-<% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_users')).empty? -%>
AllowUsers <%= s %>
<% end -%>
-<% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_groups')).empty? -%>
AllowGroups <%= s %>
<%- end -%>
-<% if scope.lookupvar('sshd::hardened_ssl') == 'yes' -%>
+<% if scope.lookupvar('::sshd::hardened') == 'yes' -%>
+<% if (scope.function_versioncmp([scope.lookupvar('::ssh_version'),'6.5'])) >= 0 -%>
+KexAlgorithms curve25519-sha256@libssh.org
+Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr
+MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
+<% else -%>
Ciphers aes256-ctr
MACs hmac-sha2-512
<% end -%>
+<% end -%>
-<% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::tail_additional_options')).empty? -%>
<%= s %>
<% end -%>
diff --git a/templates/sshd_config/Ubuntu_lucid.erb b/templates/sshd_config/Ubuntu_lucid.erb
index 4d5f640..4d147a2 100644
--- a/templates/sshd_config/Ubuntu_lucid.erb
+++ b/templates/sshd_config/Ubuntu_lucid.erb
@@ -1,12 +1,12 @@
# Package generated configuration file
# See the sshd(8) manpage for details
-<% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::head_additional_options')).empty? -%>
<%= s %>
<% end -%>
# What ports, IPs and protocols we listen for
-<% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
+<% scope.lookupvar('::sshd::ports').to_a.each do |port| -%>
<% if port == 'off' -%>
#Port -- disabled by puppet
<% else -%>
@@ -15,13 +15,15 @@ Port <%= port %>
<% end -%>
# Use these options to restrict which interfaces/protocols sshd will bind to
-<% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
+<% scope.lookupvar('::sshd::listen_address').to_a.each do |address| -%>
ListenAddress <%= address %>
<% end -%>
Protocol 2
# HostKeys for protocol version 2
-HostKey /etc/ssh/ssh_host_rsa_key
-HostKey /etc/ssh/ssh_host_dsa_key
+<% scope.lookupvar('::sshd::hostkey_type').to_a.each do |hostkey_type| -%>
+HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
+<% end -%>
+
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
@@ -39,36 +41,36 @@ LogLevel INFO
# Authentication:
LoginGraceTime 600
-PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
+PermitRootLogin <%= scope.lookupvar('::sshd::permit_root_login') %>
-StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
+StrictModes <%= scope.lookupvar('::sshd::strict_modes') %>
-RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
+RSAAuthentication <%= scope.lookupvar('::sshd::rsa_authentication') %>
-PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
+PubkeyAuthentication <%= scope.lookupvar('::sshd::pubkey_authentication') %>
-AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
+AuthorizedKeysFile <%= scope.lookupvar('::sshd::authorized_keys_file') %>
# For this to work you will also need host keys in /etc/ssh_known_hosts
-RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
+RhostsRSAAuthentication <%= scope.lookupvar('::sshd::rhosts_rsa_authentication') %>
# Don't read the user's ~/.rhosts and ~/.shosts files
-IgnoreRhosts <%= scope.lookupvar('sshd::ignore_rhosts') %>
+IgnoreRhosts <%= scope.lookupvar('::sshd::ignore_rhosts') %>
# similar for protocol version 2
-HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
+HostbasedAuthentication <%= scope.lookupvar('::sshd::hostbased_authentication') %>
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
-PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
+PermitEmptyPasswords <%= scope.lookupvar('::sshd::permit_empty_passwords') %>
# Change to no to disable s/key passwords
-ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
+ChallengeResponseAuthentication <%= scope.lookupvar('::sshd::challenge_response_authentication') %>
# To disable tunneled clear text passwords, change to no here!
-PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
+PasswordAuthentication <%= scope.lookupvar('::sshd::password_authentication') %>
# To change Kerberos options
#KerberosAuthentication no
@@ -79,16 +81,18 @@ PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
# Kerberos TGT Passing does only work with the AFS kaserver
#KerberosTgtPassing yes
-X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
+X11Forwarding <%= scope.lookupvar('::sshd::x11_forwarding') %>
X11DisplayOffset 10
KeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
+# do not reveal debian version (default is yes)
+DebianBanner no
#ReverseMappingCheck yes
-Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/lib/openssh/sftp-server' : s %>
+Subsystem sftp <%= (s=scope.lookupvar('::sshd::sftp_subsystem')).empty? ? '/usr/lib/openssh/sftp-server' : s %>
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
@@ -99,28 +103,34 @@ Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ?
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
-UsePAM <%= scope.lookupvar('sshd::use_pam') %>
+UsePAM <%= scope.lookupvar('::sshd::use_pam') %>
HostbasedUsesNameFromPacketOnly yes
-AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
+AllowTcpForwarding <%= scope.lookupvar('::sshd::tcp_forwarding') %>
-AllowAgentForwarding <%= scope.lookupvar('sshd::agent_forwarding') %>
+AllowAgentForwarding <%= scope.lookupvar('::sshd::agent_forwarding') %>
-<% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_users')).empty? -%>
AllowUsers <%= s %>
<% end -%>
-<% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::allowed_groups')).empty? -%>
AllowGroups <%= s %>
<%- end -%>
-PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
+PrintMotd <%= scope.lookupvar('::sshd::print_motd') %>
-<% if scope.lookupvar('sshd::hardened_ssl') == 'yes' -%>
+<% if scope.lookupvar('::sshd::hardened') == 'yes' -%>
+<% if (scope.function_versioncmp([scope.lookupvar('::ssh_version'),'6.5'])) >= 0 -%>
+KexAlgorithms curve25519-sha256@libssh.org
+Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr
+MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
+<% else -%>
Ciphers aes256-ctr
MACs hmac-sha2-512
<% end -%>
+<% end -%>
-<% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
+<% unless (s=scope.lookupvar('::sshd::tail_additional_options')).empty? -%>
<%= s %>
<% end -%>
diff --git a/templates/sshd_config/Ubuntu_quantal.erb b/templates/sshd_config/Ubuntu_quantal.erb
new file mode 120000
index 0000000..6502bfc
--- /dev/null
+++ b/templates/sshd_config/Ubuntu_quantal.erb
@@ -0,0 +1 @@
+Ubuntu.erb \ No newline at end of file
diff --git a/templates/sshd_config/Ubuntu_raring.erb b/templates/sshd_config/Ubuntu_raring.erb
new file mode 120000
index 0000000..6502bfc
--- /dev/null
+++ b/templates/sshd_config/Ubuntu_raring.erb
@@ -0,0 +1 @@
+Ubuntu.erb \ No newline at end of file
diff --git a/templates/sshd_config/Ubuntu_saucy.erb b/templates/sshd_config/Ubuntu_saucy.erb
new file mode 120000
index 0000000..6502bfc
--- /dev/null
+++ b/templates/sshd_config/Ubuntu_saucy.erb
@@ -0,0 +1 @@
+Ubuntu.erb \ No newline at end of file
diff --git a/templates/sshd_config/Ubuntu_trusty.erb b/templates/sshd_config/Ubuntu_trusty.erb
index ccfb67c..6502bfc 120000
--- a/templates/sshd_config/Ubuntu_trusty.erb
+++ b/templates/sshd_config/Ubuntu_trusty.erb
@@ -1 +1 @@
-Ubuntu_lucid.erb \ No newline at end of file
+Ubuntu.erb \ No newline at end of file
diff --git a/templates/sshd_config/Ubuntu_utopic.erb b/templates/sshd_config/Ubuntu_utopic.erb
new file mode 120000
index 0000000..6502bfc
--- /dev/null
+++ b/templates/sshd_config/Ubuntu_utopic.erb
@@ -0,0 +1 @@
+Ubuntu.erb \ No newline at end of file
diff --git a/templates/sshd_config/Ubuntu_vivid.erb b/templates/sshd_config/Ubuntu_vivid.erb
new file mode 120000
index 0000000..6502bfc
--- /dev/null
+++ b/templates/sshd_config/Ubuntu_vivid.erb
@@ -0,0 +1 @@
+Ubuntu.erb \ No newline at end of file
diff --git a/templates/sshd_config/Ubuntu_wily.erb b/templates/sshd_config/Ubuntu_wily.erb
new file mode 120000
index 0000000..6502bfc
--- /dev/null
+++ b/templates/sshd_config/Ubuntu_wily.erb
@@ -0,0 +1 @@
+Ubuntu.erb \ No newline at end of file
diff --git a/templates/sshd_config/Ubuntu_xenial.erb b/templates/sshd_config/Ubuntu_xenial.erb
new file mode 120000
index 0000000..6502bfc
--- /dev/null
+++ b/templates/sshd_config/Ubuntu_xenial.erb
@@ -0,0 +1 @@
+Ubuntu.erb \ No newline at end of file
diff --git a/templates/sshd_config/XenServer_xenenterprise.erb b/templates/sshd_config/XenServer_xenenterprise.erb
new file mode 120000
index 0000000..71b767a
--- /dev/null
+++ b/templates/sshd_config/XenServer_xenenterprise.erb
@@ -0,0 +1 @@
+CentOS_6.erb \ No newline at end of file