diff -ruN smeserver-affa-3.3.1.old/root/sbin/affa smeserver-affa-3.3.1/root/sbin/affa --- smeserver-affa-3.3.1.old/root/sbin/affa 2021-09-22 13:22:51.452688500 +0200 +++ smeserver-affa-3.3.1/root/sbin/affa 2021-09-22 13:57:57.027563211 +0200 @@ -129,7 +129,7 @@ sub logTail(); sub mailTest(); ###### ligne suivante modifiée umount diskusage - bug 9147 -# sub mount($$$); +# sub mount($$$); # reetp - which mount? sub mount($$$%); sub moveArchive(); sub moveFileorDir($$); @@ -254,6 +254,14 @@ my $lockdir = '/var/lock/affa'; # Process lock File::Path::mkpath( $lockdir, 0, 0700 ) if not -d $lockdir; +# reetp this was not set anywhere at this point so added it right at the start +# otherwise when you initially run you get a dir not found +# it does get set in getDefaultConfig() +# 'RootDir' => '/var/affa', +# Maybe should be called earlier? +my $storagedir = '/var/affa'; # Storage directory +File::Path::mkpath( $storagedir, 0, 0700 ) if not -d $storagedir; + if ( not $ARGV[0] ) { showHelp(1); @@ -343,7 +351,6 @@ exit 0; } if ( $opts{'warranty'} ) { - showTextfile("/usr/share/doc/smeserver-affa-$shortVersion/WARRANTY"); exit 0; } @@ -692,11 +699,11 @@ "$job{'RootDir'}/$jobname/scheduled.running/" ); #################################################################################### -#### debut des modifs faites dans le bas de la commande @cmd prÃecedente - # - # - # $job{'remoteHostName'} eq 'localhost' ? "$SourceDirs" : $job{'remoteUser'}.'@'.$job{'remoteHostName'}.":'$SourceDirs'", - # +#### debut des modifs faites dans le bas de la commande @cmd precedente +# +# +# $job{'remoteHostName'} eq 'localhost' ? "$SourceDirs" : $job{'remoteUser'}.'@'.$job{'remoteHostName'}.":'$SourceDirs'", +# ##### fin des modifs #################################################################################### @@ -875,7 +882,7 @@ 'Watchdog' => 'no', ); ############################################################################################ -##### ajoute 'SMEServer'=>'no', 3 lignes plus haut +##### ajoute 'SMEServer'=>'no', 3 lignes plus haut ##### ajoute 'RPMCheck'=>'no', 3 lignes plus haut ##### ajoute 'Watchdog'=>'no', 3 lignes plus haut ############################################################################################ @@ -999,8 +1006,9 @@ #################################################################################### # get Done Dates if ($jobname) { + # reetp add -i id_rsa_affa here $job{'_sshOpts'} = - "-p $job{'sshPort'} -o CheckHostIP=no -o StrictHostKeyChecking=no -o HostKeyAlias=$jobname -o UserKnownHostsFile=/root/.ssh/knownhosts-$jobname" + "-p $job{'sshPort'} -i '/root/.ssh/id_rsa_affa' -o CheckHostIP=no -o StrictHostKeyChecking=no -o HostKeyAlias=$jobname -o UserKnownHostsFile=/root/.ssh/knownhosts-$jobname" . ( $job{'Debug'} ne 'yes' ? ' -q' : '' ); $job{'_lockfile'} = "$lockdir/$jobname"; } @@ -1489,6 +1497,8 @@ if ( $job{'SMEServer'} ne 'no' ) { my @SourceDirs = (); + # reetp for reference here we use the esmith standard backup routine + # to get the standard dirs for backup my $b = new esmith::Backup or die "Error: Couldn't create Backup object\n"; foreach my $k ( $b->restore_list ) { $k = "/$k" if not $k =~ /^\//; @@ -3164,7 +3174,7 @@ foreach my $jobname (@ARGV) { $jobname =~ /([a-z0-9_\.-]*)/i; $jobname = $1; # untaint - my $kf = "/root/.ssh/id_dsa.pub"; + my $kf = "/root/.ssh/id_rsa_affa.pub"; my $s; my @cmd; if ( not $cfg->SectionExists($jobname) ) { @@ -3174,13 +3184,13 @@ } my %job = getJobConfig($jobname); print "Job $jobname: " if ($jobname); - if ( not -f $kf or not -f "/root/.ssh/id_dsa" ) { - $s = "Generating DSA keys..."; + if ( not -f $kf or not -f "/root/.ssh/id_rsa_affa" ) { + $s = "Generating RSA affa keys..."; print "$s\n"; lg($s); - @cmd = ( "/usr/bin/ssh-keygen", "-t", "dsa", "-N ''", "-f", "/root/.ssh/id_dsa" ); - not ExecCmd( @cmd, 0 ) or affaErrorExit("Couldn't generate DSA keys"); - $s = "Successfully created DSA key pair."; + @cmd = ( "/usr/bin/ssh-keygen", "-t", "rsa", "-N ''", "-b 4096", "-f", "/root/.ssh/id_rsa_affa" ); + not ExecCmd( @cmd, 0 ) or affaErrorExit("Couldn't generate RSA keys"); + $s = "Successfully created RSA key pair."; print "$s\n"; lg($s); } @@ -3206,7 +3216,7 @@ my $jobname = shift; $jobname =~ /([a-z0-9_\.-]*)/i; $jobname = $1; # untaint - my $kf = "/root/.ssh/id_dsa.pub"; + my $kf = "/root/.ssh/id_rsa_affa.pub"; return if not -f $kf; my $s; my @cmd; @@ -3686,8 +3696,8 @@ rename( "$smbconf.$$", "$smbconf" ) or affaErrorExit("Moving $smbconf.$$ to $smbconf failed"); -#my @cmd = ( $servicecommand, 'smb', 'reload' ); # reetp changed to restart -#ExecCmd( @cmd, 0 ); # Reload Samba config + #my @cmd = ( $servicecommand, 'smb', 'reload' ); # reetp changed to restart + #ExecCmd( @cmd, 0 ); # Reload Samba config $systemD->{'serviceName'} = 'smbd';