1 |
diff -ruN smeserver-affa-3.3.1.old/root/sbin/affa smeserver-affa-3.3.1/root/sbin/affa |
2 |
--- smeserver-affa-3.3.1.old/root/sbin/affa 2021-09-22 13:22:51.452688500 +0200 |
3 |
+++ smeserver-affa-3.3.1/root/sbin/affa 2021-09-22 13:57:57.027563211 +0200 |
4 |
@@ -129,7 +129,7 @@ |
5 |
sub logTail(); |
6 |
sub mailTest(); |
7 |
###### ligne suivante modifiée umount diskusage - bug 9147 |
8 |
-# sub mount($$$); |
9 |
+# sub mount($$$); # reetp - which mount? |
10 |
sub mount($$$%); |
11 |
sub moveArchive(); |
12 |
sub moveFileorDir($$); |
13 |
@@ -254,6 +254,14 @@ |
14 |
my $lockdir = '/var/lock/affa'; # Process lock |
15 |
File::Path::mkpath( $lockdir, 0, 0700 ) if not -d $lockdir; |
16 |
|
17 |
+# reetp this was not set anywhere at this point so added it right at the start |
18 |
+# otherwise when you initially run you get a dir not found |
19 |
+# it does get set in getDefaultConfig() |
20 |
+# 'RootDir' => '/var/affa', |
21 |
+# Maybe should be called earlier? |
22 |
+my $storagedir = '/var/affa'; # Storage directory |
23 |
+File::Path::mkpath( $storagedir, 0, 0700 ) if not -d $storagedir; |
24 |
+ |
25 |
|
26 |
if ( not $ARGV[0] ) { |
27 |
showHelp(1); |
28 |
@@ -343,7 +351,6 @@ |
29 |
exit 0; |
30 |
} |
31 |
if ( $opts{'warranty'} ) { |
32 |
- |
33 |
showTextfile("/usr/share/doc/smeserver-affa-$shortVersion/WARRANTY"); |
34 |
exit 0; |
35 |
} |
36 |
@@ -692,11 +699,11 @@ |
37 |
"$job{'RootDir'}/$jobname/scheduled.running/" |
38 |
); |
39 |
#################################################################################### |
40 |
-#### debut des modifs faites dans le bas de la commande @cmd prÃecedente |
41 |
- # |
42 |
- # |
43 |
- # $job{'remoteHostName'} eq 'localhost' ? "$SourceDirs" : $job{'remoteUser'}.'@'.$job{'remoteHostName'}.":'$SourceDirs'", |
44 |
- # |
45 |
+#### debut des modifs faites dans le bas de la commande @cmd precedente |
46 |
+# |
47 |
+# |
48 |
+# $job{'remoteHostName'} eq 'localhost' ? "$SourceDirs" : $job{'remoteUser'}.'@'.$job{'remoteHostName'}.":'$SourceDirs'", |
49 |
+# |
50 |
##### fin des modifs |
51 |
#################################################################################### |
52 |
|
53 |
@@ -875,7 +882,7 @@ |
54 |
'Watchdog' => 'no', |
55 |
); |
56 |
############################################################################################ |
57 |
-##### ajoute 'SMEServer'=>'no', 3 lignes plus haut |
58 |
+##### ajoute 'SMEServer'=>'no', 3 lignes plus haut |
59 |
##### ajoute 'RPMCheck'=>'no', 3 lignes plus haut |
60 |
##### ajoute 'Watchdog'=>'no', 3 lignes plus haut |
61 |
############################################################################################ |
62 |
@@ -999,8 +1006,9 @@ |
63 |
#################################################################################### |
64 |
# get Done Dates |
65 |
if ($jobname) { |
66 |
+ # reetp add -i id_rsa_affa here |
67 |
$job{'_sshOpts'} = |
68 |
- "-p $job{'sshPort'} -o CheckHostIP=no -o StrictHostKeyChecking=no -o HostKeyAlias=$jobname -o UserKnownHostsFile=/root/.ssh/knownhosts-$jobname" |
69 |
+ "-p $job{'sshPort'} -i '/root/.ssh/id_rsa_affa' -o CheckHostIP=no -o StrictHostKeyChecking=no -o HostKeyAlias=$jobname -o UserKnownHostsFile=/root/.ssh/knownhosts-$jobname" |
70 |
. ( $job{'Debug'} ne 'yes' ? ' -q' : '' ); |
71 |
$job{'_lockfile'} = "$lockdir/$jobname"; |
72 |
} |
73 |
@@ -1489,6 +1497,8 @@ |
74 |
|
75 |
if ( $job{'SMEServer'} ne 'no' ) { |
76 |
my @SourceDirs = (); |
77 |
+ # reetp for reference here we use the esmith standard backup routine |
78 |
+ # to get the standard dirs for backup |
79 |
my $b = new esmith::Backup or die "Error: Couldn't create Backup object\n"; |
80 |
foreach my $k ( $b->restore_list ) { |
81 |
$k = "/$k" if not $k =~ /^\//; |
82 |
@@ -3164,7 +3174,7 @@ |
83 |
foreach my $jobname (@ARGV) { |
84 |
$jobname =~ /([a-z0-9_\.-]*)/i; |
85 |
$jobname = $1; # untaint |
86 |
- my $kf = "/root/.ssh/id_dsa.pub"; |
87 |
+ my $kf = "/root/.ssh/id_rsa_affa.pub"; |
88 |
my $s; |
89 |
my @cmd; |
90 |
if ( not $cfg->SectionExists($jobname) ) { |
91 |
@@ -3174,13 +3184,13 @@ |
92 |
} |
93 |
my %job = getJobConfig($jobname); |
94 |
print "Job $jobname: " if ($jobname); |
95 |
- if ( not -f $kf or not -f "/root/.ssh/id_dsa" ) { |
96 |
- $s = "Generating DSA keys..."; |
97 |
+ if ( not -f $kf or not -f "/root/.ssh/id_rsa_affa" ) { |
98 |
+ $s = "Generating RSA affa keys..."; |
99 |
print "$s\n"; |
100 |
lg($s); |
101 |
- @cmd = ( "/usr/bin/ssh-keygen", "-t", "dsa", "-N ''", "-f", "/root/.ssh/id_dsa" ); |
102 |
- not ExecCmd( @cmd, 0 ) or affaErrorExit("Couldn't generate DSA keys"); |
103 |
- $s = "Successfully created DSA key pair."; |
104 |
+ @cmd = ( "/usr/bin/ssh-keygen", "-t", "rsa", "-N ''", "-b 4096", "-f", "/root/.ssh/id_rsa_affa" ); |
105 |
+ not ExecCmd( @cmd, 0 ) or affaErrorExit("Couldn't generate RSA keys"); |
106 |
+ $s = "Successfully created RSA key pair."; |
107 |
print "$s\n"; |
108 |
lg($s); |
109 |
} |
110 |
@@ -3206,7 +3216,7 @@ |
111 |
my $jobname = shift; |
112 |
$jobname =~ /([a-z0-9_\.-]*)/i; |
113 |
$jobname = $1; # untaint |
114 |
- my $kf = "/root/.ssh/id_dsa.pub"; |
115 |
+ my $kf = "/root/.ssh/id_rsa_affa.pub"; |
116 |
return if not -f $kf; |
117 |
my $s; |
118 |
my @cmd; |
119 |
@@ -3686,8 +3696,8 @@ |
120 |
rename( "$smbconf.$$", "$smbconf" ) |
121 |
or affaErrorExit("Moving $smbconf.$$ to $smbconf failed"); |
122 |
|
123 |
-#my @cmd = ( $servicecommand, 'smb', 'reload' ); # reetp changed to restart |
124 |
-#ExecCmd( @cmd, 0 ); # Reload Samba config |
125 |
+ #my @cmd = ( $servicecommand, 'smb', 'reload' ); # reetp changed to restart |
126 |
+ #ExecCmd( @cmd, 0 ); # Reload Samba config |
127 |
|
128 |
$systemD->{'serviceName'} = 'smbd'; |
129 |
|