Skip to content

Commit

Permalink
simplify and fix default values
Browse files Browse the repository at this point in the history
  • Loading branch information
nod0n committed Aug 18, 2021
1 parent e3d5b25 commit 0442d89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
4 changes: 2 additions & 2 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Data type: `Any`
The group that will own the corresponding home directory in the jail,
giving the user a place to land. Also sets group ownership for `/incoming`.

Default value: ``undef``
Default value: `$user`

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

Expand All @@ -119,7 +119,7 @@ Data type: `Any`
Set the group that SSHd will look for when redirecting users to the jail.
Useful for shared jails. Defaults to the value of `group`.

Default value: ``undef``
Default value: `$group`

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

Expand Down
17 changes: 3 additions & 14 deletions manifests/jail.pp
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,13 @@
define sftp_jail::jail (
$jail_name = $name,
$user = undef,
$group = undef,
$match_group = undef,
$group = $user,
$match_group = $group,
$password_authentication = 'no',
) {
include sftp_jail
$jail_base = "${sftp_jail::chroot_base}/${jail_name}"

if ($match_group) {
$ssh_match_group = $match_group
}
else {
$ssh_match_group = $group
}

if !($group) {
$group = $user
}

file { [$jail_base, "${jail_base}/home"]:
ensure => 'directory',
owner => 'root',
Expand All @@ -91,7 +80,7 @@
mode => '0755',
}

ssh::server::match_block { $ssh_match_group:
ssh::server::match_block { $match_group:
type => 'Group',
options => {
'ChrootDirectory' => $jail_base,
Expand Down

0 comments on commit 0442d89

Please sign in to comment.