From fd3074d31cd5b6f2818eacdd3ff02adfe4f4d865 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Fri, 25 Jun 2021 10:35:55 +0200 Subject: [PATCH] Make pubkey unique --- manifests/init.pp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 37de707..a8d3e5b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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 " } } + + +