Commit d46db38c authored by varac's avatar varac

possibilty to create a ssh keypair on the master

added following parameters to backupninja::duplicity
and backupninja::client::key :

$createkey
$keystorefspath
$keydest
$keydestname
parent 1bceb46b
......@@ -46,8 +46,10 @@ class backupninja::client::defaults {
class backupninja::client inherits backupninja::client::defaults {
define key(
$user = false, $host = false, $installkey=false, $keyowner=false,
$keygroup=false, $keystore=false, $keytype=false)
$user = false, $host = false, $createkey=false, $installkey=false,
$keyowner=false, $keygroup=false, $keystore=false, $keystorefspath='',
$keytype=false,
$keydest=false, $keydestname=false )
{
$real_user = $user ? {
false => $name,
......@@ -78,9 +80,23 @@ class backupninja::client inherits backupninja::client::defaults {
false => "${backupninja::client::defaults::real_keytype}",
default => $keytype,
}
$key_dest = $keydest ? {
false => "${backupninja::client::defaults::real_keydestination}",
default => $keydest,
}
$key_dest_name = $keydestname ? {
false => "id_$key_type",
default => $keydestname,
}
$key_dest_file = "${key_dest}/${key_dest_name}"
$key_dest = "${backupninja::client::defaults::real_keydestination}"
$key_dest_file = "$key_dest/id_$key_type"
if $createkey == true {
if $keystorefspath == false {
err("need to define a destination directory for sshkey creation!")
}
$ssh_keys = ssh_keygen("${keystorefspath}/${key_dest_name}")
}
case $install_key {
true: {
......@@ -109,7 +125,7 @@ class backupninja::client::maildir inherits backupninja::client::defaults {
package { 'rsync':
ensure => $rsync_ensure_version,
}
}
}
}
class backupninja::client::rdiff_backup inherits backupninja::client::defaults {
......@@ -150,4 +166,4 @@ class backupninja::client::sys inherits backupninja::client::defaults {
}
default: {}
}
}
}
......@@ -79,7 +79,10 @@ define backupninja::duplicity( $order = 90,
$destuser = false,
# configs to backupninja client
$backupkeystore = false,
$backupkeystorefspath = '',
$backupkeytype = "rsa",
$backupkeydest = false,
$backupkeydestname = false,
# options to backupninja server sandbox
$ssh_dir_manage = true,
$ssh_dir = false,
......@@ -87,6 +90,7 @@ define backupninja::duplicity( $order = 90,
$installuser = true,
$backuptag = false,
# key options
$createkey = false,
$installkey = true ) {
# the client with configs for this machine
......@@ -95,7 +99,7 @@ define backupninja::duplicity( $order = 90,
case $desthost { false: { err("need to define a destination host for remote backups!") } }
case $destdir { false: { err("need to define a destination directory for remote backups!") } }
case $password { false: { err("a password is necessary either to unlock the GPG key, or for symmetric encryption!") } }
# guarantees there's a configured backup space for this backup
backupninja::server::sandbox { "${user}-${name}":
user => $destuser,
......@@ -109,14 +113,18 @@ define backupninja::duplicity( $order = 90,
backupkeys => $backupkeystore,
keytype => $backupkeytype,
}
# the client's ssh key
backupninja::client::key { "${destuser}-${name}":
user => $destuser,
host => $desthost,
installkey => $installkey,
keytype => $backupkeytype,
keystore => $backupkeystore,
user => $destuser,
host => $desthost,
createkey => $createkey,
installkey => $installkey,
keytype => $backupkeytype,
keystore => $backupkeystore,
keystorefspath => $backupkeystorefspath,
keydest => $backupkeydest,
keydestname => $backupkeydestname
}
# the backupninja rule for this duplicity backup
......@@ -129,4 +137,4 @@ define backupninja::duplicity( $order = 90,
require => File["${backupninja::client::defaults::configdir}"]
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment