From d255adc7b447d44e4f5058973e6bf4208e780e45 Mon Sep 17 00:00:00 2001 From: digimer Date: Thu, 17 Aug 2023 22:14:40 -0400 Subject: [PATCH] * Updated anvil-daemon to set the mode of /mnt/shared/* to 0777 during creation and to check that that mode is set for existing sub-directories. This resolves issue #443. * Cleaned up anvil-manage-dr.8 hyphen escapes. Signed-off-by: digimer --- Anvil/Tools/Storage.pm | 2 +- man/anvil-manage-dr.8 | 6 +++--- tools/anvil-daemon | 23 ++++++++++++++++++++--- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Anvil/Tools/Storage.pm b/Anvil/Tools/Storage.pm index 1815f95e..69ee4fa0 100644 --- a/Anvil/Tools/Storage.pm +++ b/Anvil/Tools/Storage.pm @@ -416,7 +416,7 @@ sub change_mode return('!!error!!'); } - my $shell_call = $anvil->data->{path}{exe}{'chmod'}." $mode $path"; + my $shell_call = $anvil->data->{path}{exe}{'chmod'}." ".$mode." ".$path; $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0011", variables => { shell_call => $shell_call }}); if ($anvil->Network->is_local({host => $target})) { diff --git a/man/anvil-manage-dr.8 b/man/anvil-manage-dr.8 index 089da1d0..e45a4b9b 100644 --- a/man/anvil-manage-dr.8 +++ b/man/anvil-manage-dr.8 @@ -14,7 +14,7 @@ This tool is used to manage the protection of servers on DR hosts. \-?, \-h, \fB\-\-help\fR Show this man page. .TP -\fB\-\-log-secure\fR +\fB\-\-log\-secure\fR When logging, record sensitive data, like passwords. .TP \-v, \-vv, \-vvv @@ -27,10 +27,10 @@ Connect a server already on DR to it's DR copy, update the data there if needed \fB\-\-disconnect\fR Disconnect a server from the DR image. This will end streaming replication. .TP -\fB\-\-dr-host\fR +\fB\-\-dr\-host\fR This is the host name or host UUID for the DR to use. It is optional if only one DR host is connected to this Anvil! node, but required if two or more are defined. .TP -\fB\-\-license-file\fR +\fB\-\-license\-file\fR This is the path to the license file, needed when setting up "long-throw" DR for the first time. .TP \fB\-\-link\fR diff --git a/tools/anvil-daemon b/tools/anvil-daemon index 4ea2df9c..f8527cf8 100755 --- a/tools/anvil-daemon +++ b/tools/anvil-daemon @@ -1896,17 +1896,34 @@ sub check_files foreach my $target (sort {$a cmp $b} keys %{$anvil->data->{path}{directories}{shared}}) { my $directory = $anvil->data->{path}{directories}{shared}{$target}; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { target => $target, directory => $directory, }}); - if (not -e $anvil->data->{path}{directories}{shared}{$target}) + if (-e $directory) + { + # Make sure the permissions are correct. + $anvil->Storage->get_file_stats({file_path => $directory}); + + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + "file_stat::${directory}::unix_mode" => $anvil->data->{file_stat}{$directory}{unix_mode}, + }}); + if ($anvil->data->{file_stat}{$directory}{unix_mode} !~ /0777$/) + { + $anvil->Storage->change_mode({ + debug => 2, + path => $directory, + mode => "0777" + }); + } + } + elsif (not -e $anvil->data->{path}{directories}{shared}{$target}) { my $failed = $anvil->Storage->make_directory({ directory => $directory, group => "apache", user => "apache", - mode => "0775", + mode => "0777", }); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { failed => $failed }}); if ($failed)