Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions gorgone/packaging/scripts/centreon-gorgone-postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ startGorgoned() {
systemctl restart gorgoned.service ||:
}

# Change the gorgone default log file to be 640, it was 644 before.
# New gorgone version create it as 640 but do not change existing log file.
if [[ -e /var/log/centreon-gorgone/gorgoned.log ]] ; then
chmod 640 /var/log/centreon-gorgone/gorgoned.log
fi

action="$1"
if [ "$1" = "configure" ] && [ -z "$2" ]; then
# Alpine linux does not pass args, and deb passes $1=configure
Expand Down
4 changes: 4 additions & 0 deletions perl-libs/lib/centreon/common/logger.pm
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,16 @@ sub file_mode($$) {
if (defined($self->{filehandler})) {
$self->{filehandler}->close();
}
# Use umask to set the file permissions to 0640 and reset it right after to avoid changing other code area.
my $old_umask = umask(0027);
if (open($self->{filehandler}, ">>", $file)){
umask($old_umask);
$self->{log_mode} = 1;
$self->{filehandler}->autoflush(1);
$self->{file_name} = $file;
return 1;
}
umask($old_umask);
$self->{filehandler} = undef;
print STDERR "Cannot open file $file: $!\n";
return 0;
Expand Down
Loading