Fixed the 777 permission bits in the 'imgs/' directory

Removed the default installation 777 permission bits mode for the '/imgs/
directory in 'docs/monitorix.spec' and 'Makefile'.

Forced to setup the owner, group and the permission bits (now to 755) to the
'imgs/' directory every time Monitorix is started.
This commit is contained in:
Jordi Sanfeliu 2018-10-04 12:51:33 +02:00
parent 5b9d6a5f89
commit 3fd7a094b4
3 changed files with 9 additions and 3 deletions

View File

@ -21,7 +21,7 @@ INSTALL = install -p
INSTALL_PROGRAM = $(INSTALL) -m755
INSTALL_DATA = $(INSTALL) -m644
INSTALL_DIR = $(INSTALL) -d
INSTALL_WORLDDIR = $(INSTALL) -dm777
INSTALL_WORLDDIR = $(INSTALL) -dm755
Q = @

View File

@ -85,7 +85,7 @@ rm -rf %{buildroot}
%{_localstatedir}/lib/monitorix/www/logo_bot.png
%{_localstatedir}/lib/monitorix/www/monitorixico.png
%{_localstatedir}/lib/monitorix/www/cgi/monitorix.cgi
%attr(777,root,root) %{_localstatedir}/lib/monitorix/www/imgs
%attr(755,root,root) %{_localstatedir}/lib/monitorix/www/imgs
%attr(755,root,root) %{_localstatedir}/lib/monitorix/usage
%{_localstatedir}/lib/monitorix/reports/*.html
%doc %{_mandir}/man5/monitorix.conf.5.gz

View File

@ -2,7 +2,7 @@
#
# Monitorix - A lightweight system monitoring tool.
#
# Copyright (C) 2005-2017 by Jordi Sanfeliu <jordi@fibranet.cat>
# Copyright (C) 2005-2018 by Jordi Sanfeliu <jordi@fibranet.cat>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -670,6 +670,12 @@ create_index();
# start the HTTP built-in (if enabled)
if(lc($config{httpd_builtin}->{enabled}) eq "y") {
logger("Setting owner/group and permission bits for the imgs/ directory.") if defined($options{d});
my (undef, undef, $uid) = getpwnam($config{httpd_builtin}->{user});
my (undef, undef, $gid) = getgrnam($config{httpd_builtin}->{group});
chown($uid, $gid, $config{base_dir} . "/" . $config{imgs_dir});
chmod(0755, $config{base_dir} . "/" . $config{imgs_dir});
require HTTPServer;
httpd_setup(\%config, $options{d});
logger("Started built-in HTTP server (pid $config{httpd_pid}).") if (defined($config{httpd_pid}));