Skip to content

Commit

Permalink
Merge pull request #91 from nod0n/hiera_support
Browse files Browse the repository at this point in the history
accept jails and users as class parameters
  • Loading branch information
bastelfreak committed Oct 25, 2021
2 parents 1871049 + 24f176d commit 1af4c16
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
18 changes: 18 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,29 @@ Manage SFTP Jails

The following parameters are available in the `sftp_jail` class:

* [`jails`](#jails)
* [`users`](#users)
* [`chroot_base`](#chroot_base)
* [`sub_dirs`](#sub_dirs)
* [`merge_subdirs`](#merge_subdirs)
* [`password_authentication`](#password_authentication)

##### <a name="jails"></a>`jails`

Data type: `Hash[String[1],Hash]`

Jails to create. See `sftp_jail::jail` for more details.

Default value: `{}`

##### <a name="users"></a>`users`

Data type: `Hash[String[1],Hash]`

Users to create. See `sftp_jail::user` for more details.

Default value: `{}`

##### <a name="chroot_base"></a>`chroot_base`

Data type: `Stdlib::Absolutepath`
Expand Down
15 changes: 15 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @summary Manage SFTP Jails
#
# @param jails
# Jails to create. See `sftp_jail::jail` for more details.
#
# @param users
# Users to create. See `sftp_jail::user` for more details.
#
# @param chroot_base
# All jails are located in this directory.
#
Expand All @@ -19,6 +25,8 @@
# impact SFTP users which are put in a chroot jail by this module.
#
class sftp_jail (
Hash[String[1],Hash] $jails = {},
Hash[String[1],Hash] $users = {},
Stdlib::Absolutepath $chroot_base = '/chroot',
Sftp_jail::Sub_dirs $sub_dirs = [],
Boolean $merge_subdirs = false,
Expand All @@ -30,4 +38,11 @@
group => 'root',
mode => '0755',
}

$jails.each |$jail, $properties| {
sftp_jail::jail { $jail: * => $properties }
}
$users.each |$user, $properties| {
sftp_jail::jail { $user: * => $properties }
}
}

0 comments on commit 1af4c16

Please sign in to comment.