Make pubkey unique

This commit is contained in:
Charlie Root 2021-06-25 10:35:55 +02:00
parent 36d3361397
commit fd3074d31c
1 changed files with 9 additions and 5 deletions

View File

@ -6,7 +6,7 @@ class wmdeit_backup(
$backup_dir = "/srv/backup",
$backup_key_file = "/root/.ssh/backup_key",
$backup_key,
$mnt_server = undef
$mnt_server = undef,
) {
@ -62,19 +62,19 @@ define wmdeit_backup::scpbackup (
$bname = $title
$backup_key_file = $wmdeit_backup::backup_key_file
$backup_pub_key_file = "/tmp/backup_pub.pem"
$backup_pub_key_file = "/tmp/backup_pub-$title.pem"
$privkey = "/root/${title}_privkey"
$backup_dir = $wmdeit_backup::backup_dir
$shellscript = "$backup_dir/backup-scp-$title.sh"
$tdir = "$backup_dir/$dir/daily.0"
exec {"pubkey":
exec {"pubkey$title":
command => "/usr/bin/openssl rsa -in $backup_key_file -pubout -out $backup_pub_key_file",
}
file {"$shellscript":
require => Exec["pubkey"],
require => Exec["pubkey$title"],
mode => "700",
ensure => file,
content => "#!/bin/sh
@ -140,6 +140,7 @@ define wmdeit_backup::backup(
$retain_monthly = 0,
$daily_hour = 3,
$daily_minute = 0,
$backupuser = 'root',
) {
$bname = $title
@ -208,7 +209,7 @@ define wmdeit_backup::backup(
$bdirs = join ($dirs.map | String $dir| {
"backup root@$server:$dir\t$local_dir\n"
"backup $backupuser@$server:$dir\t$local_dir\n"
},"")
file {"$backup_dir/$bname.conf":
@ -235,3 +236,6 @@ $bdirs
"
}
}