Skip to content

Instantly share code, notes, and snippets.

@sohooo
Last active August 29, 2015 14:01
Show Gist options
  • Save sohooo/fd8e12531d6e70387ea1 to your computer and use it in GitHub Desktop.
Save sohooo/fd8e12531d6e70387ea1 to your computer and use it in GitHub Desktop.
Creating jailed users based on my jailkit module; interfacing with common::shelluser.
common::jailuser { 'nova':
sections => ['jk_lsh', 'basicshell'],
binds => ['/var/log => log', '/opt => opt'],
keys => ['funky', 'george'],
}
define common::jailuser(
$user = $title,
$sections = [],
$binds = [],
$keys = [],
) {
validate_array($sections)
validate_array($binds)
validate_array($keys)
$jailroot = '/opt/jails'
$userjail = "${jailroot}/${user}"
$userhome = "${userjail}/./home/${user}"
common::shelluser { $user:
keys => $keys,
homepath => $userhome,
}
require jailkit
jail { $userjail:
ensure => present,
sections => $sections,
}
jailuser { $user:
ensure => present,
jail => $userjail,
}
# common::jailuser::bind stuff...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment