Help with permissions issue

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

johnstonjj77
Posts: 8
Joined: Thu Aug 17, 2023 8:40 am

Help with permissions issue

Post by johnstonjj77 »

I've just setup Cacti v1.2.23 and installed the Weathermap v1.1 plugin. Everything is working except when I go to the Management |Weathermap section, I receive an error message stating that the "Editor directory permissions are not correct!" and it further says, "The Web Service account must have access to the WeatherMap config directory which it does not have. Correct this issue, and then relaunch the Editor".

Using "ps -ef | egrep '(httpd|apache2|apache)' | grep -v `whoami` | grep -v root | head -n1 | awk '{print $1}'", I verified that the webservice account is "Apache" and I also verified that apache is the owner of the files in the '/usr/share/cacti/plugins/weathermap/configs' directory. After repeated failures, I chmod'ed all files to 777 and the error still persists. I looked at directories that were set to noexec using 'grep noexec /etc/fstab' and none of the cacti and/or weathermap directores were listed.

Here's the results from check.php:
PHP Warning: A non-numeric value encountered in /usr/share/cacti/plugins/weathermap/check.php on line 425

----------------------------------------------------
Weathermap Pre-Install Checker

This script checks for some common problems with your PHP and server
environment that may stop Weathermap or the Editor from working.

NOTE: You should run this script as both a web page AND from the
command-line, as the environment can be different in each.

This is the PHP version that is responsible for:

* creating maps from the Cacti poller
* the command-line weathermap tool

PHP Basics
----------
PHP Version: 8.0.27
Server OS: Linux si-vmnoccacti02.si.edu 5.14.0-284.25.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 20 09:11:28 EDT 2023 x86_64
memory_limit: 800M (Ok)

The php.ini file was /etc/php.ini

The following additional ini files were read:

/etc/php.d/10-opcache.ini,
/etc/php.d/20-bz2.ini,
/etc/php.d/20-calendar.ini,
/etc/php.d/20-ctype.ini,
/etc/php.d/20-curl.ini,
/etc/php.d/20-dom.ini,
/etc/php.d/20-exif.ini,
/etc/php.d/20-fileinfo.ini,
/etc/php.d/20-ftp.ini,
/etc/php.d/20-gd.ini,
/etc/php.d/20-gettext.ini,
/etc/php.d/20-gmp.ini,
/etc/php.d/20-iconv.ini,
/etc/php.d/20-intl.ini,
/etc/php.d/20-ldap.ini,
/etc/php.d/20-mbstring.ini,
/etc/php.d/20-mysqlnd.ini,
/etc/php.d/20-pdo.ini,
/etc/php.d/20-phar.ini,
/etc/php.d/20-posix.ini,
/etc/php.d/20-shmop.ini,
/etc/php.d/20-simplexml.ini,
/etc/php.d/20-snmp.ini,
/etc/php.d/20-sockets.ini,
/etc/php.d/20-sqlite3.ini,
/etc/php.d/20-sysvmsg.ini,
/etc/php.d/20-sysvsem.ini,
/etc/php.d/20-sysvshm.ini,
/etc/php.d/20-tokenizer.ini,
/etc/php.d/20-xml.ini,
/etc/php.d/20-xmlwriter.ini,
/etc/php.d/20-xsl.ini,
/etc/php.d/30-mysqli.ini,
/etc/php.d/30-pdo_mysql.ini,
/etc/php.d/30-pdo_sqlite.ini,
/etc/php.d/30-xmlreader.ini


PHP Functions
-------------
Some parts of Weathermap need special support in your PHP
installation to work.

This PHP uses the system GD library, which MIGHT have alpha-blending bugs.
Check that you have at least GD 2.0.34 installed, if you see problems with
weathermap segfaulting.

You can test for this specific fault by running check-gdbug.php

imagepng YES
imagecreatetruecolor YES
imagealphablending YES
imageSaveAlpha YES
preg_match YES
imagecreatefrompng YES
imagecreatefromjpeg YES
imagecreatefromgif YES
imagejpeg YES
imagegif YES
imagecopyresampled YES
imagettfbbox YES
memory_get_usage YES

---------------------------------------------------------------------
OK! Your PHP and server environment *seems* to have support for ALL of the
Weathermap features. Make sure you have run this script BOTH as a web page
and from the CLI to be sure, however.

Any insight and/or help that you can provide will be greatly appreciated.
User avatar
macan
Cacti Guru User
Posts: 1104
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: Help with permissions issue

Post by macan »

ls -al /usr/share/cacti/plugins/weathermap/configs

did you set permission only to directory configs? Try
cd /usr/share/cacti/plugins/weathermap/configs
chown -R apache *
find . -type f -exec chmod 664 {} \;
find . -type d -exec chmod 775 {} \;
Let the Cacti grow!
johnstonjj77
Posts: 8
Joined: Thu Aug 17, 2023 8:40 am

Re: Help with permissions issue

Post by johnstonjj77 »

macan wrote: Fri Aug 18, 2023 1:30 am ls -al /usr/share/cacti/plugins/weathermap/configs

did you set permission only to directory configs? Try
cd /usr/share/cacti/plugins/weathermap/configs
chown -R apache *
find . -type f -exec chmod 664 {} \;
find . -type d -exec chmod 775 {} \;
@Macman

Thanks for the reply... I had already set all of those perm setting on the directory and files but tried it again to see if I missed something. After trying what you suggested, the error message still persists. Any other ideas? Thanks!
User avatar
macan
Cacti Guru User
Posts: 1104
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: Help with permissions issue

Post by macan »

show ls -al /usr/share/cacti/plugins/weathermap/configs
and ls -al /usr/share/cacti/plugins/weathermap
Let the Cacti grow!
johnstonjj77
Posts: 8
Joined: Thu Aug 17, 2023 8:40 am

Re: Help with permissions issue

Post by johnstonjj77 »

macan wrote: Fri Aug 18, 2023 5:12 am show ls -al /usr/share/cacti/plugins/weathermap/configs
and ls -al /usr/share/cacti/plugins/weathermap
ls -al /usr/share/cacti/plugins/weathermap/configs
total 20
drwxrwxr-x+ 2 apache apache 76 Aug 16 14:06 .
drwxrwxr-x+ 12 apache apache 4096 Aug 17 10:24 ..
-rwxrwxr-x. 1 apache apache 75 Aug 16 14:06 .htaccess
-rwxrwxr-x. 1 apache apache 39 Aug 16 09:48 index.php
-rwxrwxr-x. 1 apache apache 1267 Aug 16 09:48 simple.conf
-rwxrwxr-x. 1 apache apache 1689 Aug 16 13:26 test.conf

ls -al /usr/share/cacti/plugins/weathermap
total 360
drwxrwxr-x+ 12 apache apache 4096 Aug 17 10:24 .
drwxrwxrwx+ 4 apache apache 56 Aug 17 11:41 ..
-rwxrwxr-x. 1 apache apache 42495 Aug 16 09:48 CHANGELOG.md
-rwxrwxr-x. 1 apache apache 14752 Aug 17 10:24 check.php
drwxrwxr-x+ 2 apache apache 4096 Aug 16 13:56 cli
drwxrwxr-x+ 2 apache apache 76 Aug 16 14:06 configs
-rwxrwxr-x. 1 apache apache 18011 Aug 16 09:48 COPYING
drwxrwxr-x+ 2 apache apache 46 Aug 16 09:48 css
drwxrwxr-x+ 7 apache apache 163 Aug 16 09:48 docs
drwxrwxr-x+ 8 apache apache 163 Aug 16 09:48 .git
drwxrwxr-x+ 5 apache apache 20480 Aug 16 10:18 images
-rwxrwxr-x. 1 apache apache 2972 Aug 16 09:48 index.php
-rwxrwxr-x. 1 apache apache 277 Aug 16 09:48 INFO
drwxrwxr-x+ 2 apache apache 146 Aug 16 09:48 js
drwxrwxr-x+ 5 apache apache 4096 Aug 16 13:56 lib
-rwxrwxr-x. 1 apache apache 1064 Aug 16 09:48 LICENSE
drwxrwxr-x+ 4 apache apache 76 Aug 16 09:48 locales
drwxrwxr-x+ 2 apache apache 4096 Aug 18 07:35 output
-rwxrwxr-x. 1 apache apache 4372 Aug 16 09:48 README.md
-rwxrwxr-x. 1 apache apache 41250 Aug 16 09:48 setup.php
-rwxrwxr-x. 1 apache apache 8767 Aug 16 09:48 weathermap
-rwxrwxr-x. 1 apache apache 35908 Aug 16 09:48 weathermap-cacti-plugin-editor.php
-rwxrwxr-x. 1 apache apache 78842 Aug 16 09:48 weathermap-cacti-plugin-mgmt.php
-rwxrwxr-x. 1 apache apache 29789 Aug 16 09:48 weathermap-cacti-plugin.php
-rwxrwxr-x. 1 apache apache 3246 Aug 16 09:48 weathermap-cacti-rebuild.php
User avatar
macan
Cacti Guru User
Posts: 1104
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: Help with permissions issue

Post by macan »

you have there + sign:
rwxrwxr-x+ ....


so show getfacl configs
Let the Cacti grow!
johnstonjj77
Posts: 8
Joined: Thu Aug 17, 2023 8:40 am

Re: Help with permissions issue

Post by johnstonjj77 »

macan wrote: Fri Aug 18, 2023 6:39 am you have there + sign:
rwxrwxr-x+ ....


so show getfacl configs
getfacl /usr/share/cacti/plugins/weathermap/configs
getfacl: Removing leading '/' from absolute path names
# file: usr/share/cacti/plugins/weathermap/configs
# owner: apache
# group: apache
user::rwx
group::rwx
other::r-x
default:user::rwx
default:user:apache:rwx
default:group::rwx
default:group:apache:rwx
default:mask::rwx
default:other::rw-
User avatar
macan
Cacti Guru User
Posts: 1104
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: Help with permissions issue

Post by macan »

Show result of:
ps aux | grep -i www
and
ps aux | grep -i apa
Let the Cacti grow!
johnstonjj77
Posts: 8
Joined: Thu Aug 17, 2023 8:40 am

Re: Help with permissions issue

Post by johnstonjj77 »

macan wrote: Fri Aug 18, 2023 6:52 am Show result of:
ps aux | grep -i www
and
ps aux | grep -i apa
ps aux | grep -i www
apache 1308 0.0 0.4 227996 39164 ? S 06:10 0:00 php-fpm: pool www
apache 1309 0.0 0.5 228000 40740 ? S 06:10 0:00 php-fpm: pool www
apache 1310 0.0 0.4 223816 33088 ? S 06:10 0:00 php-fpm: pool www
apache 1311 0.0 0.4 223816 33876 ? S 06:10 0:00 php-fpm: pool www
apache 1312 0.0 0.5 228004 39480 ? S 06:10 0:00 php-fpm: pool www
apache 2146 0.0 0.4 227916 39100 ? S 06:11 0:00 php-fpm: pool www
root 9423 0.0 0.0 6400 2296 pts/1 S+ 07:56 0:00 grep --color=auto -i www

ps aux | grep -i apa
apache 1070 0.0 0.1 23688 8232 ? S 06:10 0:00 /usr/sbin/httpd -DFOREGROUND
apache 1071 0.0 0.1 1540216 15204 ? Sl 06:10 0:00 /usr/sbin/httpd -DFOREGROUND
apache 1073 0.0 0.2 1671352 17180 ? Sl 06:10 0:00 /usr/sbin/httpd -DFOREGROUND
apache 1074 0.0 0.1 1540216 15324 ? Sl 06:10 0:00 /usr/sbin/httpd -DFOREGROUND
apache 1308 0.0 0.4 227996 39164 ? S 06:10 0:00 php-fpm: pool www
apache 1309 0.0 0.5 228000 40740 ? S 06:10 0:00 php-fpm: pool www
apache 1310 0.0 0.4 223816 33088 ? S 06:10 0:00 php-fpm: pool www
apache 1311 0.0 0.4 223816 33876 ? S 06:10 0:00 php-fpm: pool www
apache 1312 0.0 0.5 228004 39480 ? S 06:10 0:00 php-fpm: pool www
apache 2079 0.0 0.2 1540216 19300 ? Sl 06:11 0:00 /usr/sbin/httpd -DFOREGROUND
apache 2146 0.0 0.4 227916 39100 ? S 06:11 0:00 php-fpm: pool www
root 9425 0.0 0.0 6400 2296 pts/1 R+ 07:56 0:00 grep --color=auto -i apa
User avatar
macan
Cacti Guru User
Posts: 1104
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: Help with permissions issue

Post by macan »

last think - show mount
Let the Cacti grow!
johnstonjj77
Posts: 8
Joined: Thu Aug 17, 2023 8:40 am

Re: Help with permissions issue

Post by johnstonjj77 »

macan wrote: Fri Aug 18, 2023 7:07 am last think - show mount
cat /proc/mounts
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
sysfs /sys sysfs rw,seclabel,nosuid,nodev,noexec,relatime 0 0
devtmpfs /dev devtmpfs rw,seclabel,nosuid,size=4096k,nr_inodes=978923,mode=755,inode64 0 0
securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev/shm tmpfs rw,seclabel,nosuid,nodev,noexec,inode64 0 0
devpts /dev/pts devpts rw,seclabel,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,seclabel,nosuid,nodev,size=1574428k,nr_inodes=819200,mode=755,inode64 0 0
cgroup2 /sys/fs/cgroup cgroup2 rw,seclabel,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot 0 0
pstore /sys/fs/pstore pstore rw,seclabel,nosuid,nodev,noexec,relatime 0 0
efivarfs /sys/firmware/efi/efivars efivarfs rw,nosuid,nodev,noexec,relatime 0 0
bpf /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0
/dev/mapper/rootvg-root_lv / xfs rw,seclabel,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
selinuxfs /sys/fs/selinux selinuxfs rw,nosuid,noexec,relatime 0 0
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=18446 0 0
hugetlbfs /dev/hugepages hugetlbfs rw,seclabel,relatime,pagesize=2M 0 0
debugfs /sys/kernel/debug debugfs rw,seclabel,nosuid,nodev,noexec,relatime 0 0
mqueue /dev/mqueue mqueue rw,seclabel,nosuid,nodev,noexec,relatime 0 0
tracefs /sys/kernel/tracing tracefs rw,seclabel,nosuid,nodev,noexec,relatime 0 0
fusectl /sys/fs/fuse/connections fusectl rw,nosuid,nodev,noexec,relatime 0 0
configfs /sys/kernel/config configfs rw,nosuid,nodev,noexec,relatime 0 0
none /run/credentials/systemd-sysctl.service ramfs ro,seclabel,nosuid,nodev,noexec,relatime,mode=700 0 0
none /run/credentials/systemd-tmpfiles-setup-dev.service ramfs ro,seclabel,nosuid,nodev,noexec,relatime,mode=700 0 0
/dev/mapper/rootvg-home_lv /home xfs rw,seclabel,nosuid,nodev,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
/dev/mapper/rootvg-tmp_lv /tmp xfs rw,seclabel,nosuid,nodev,noexec,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
/dev/sda2 /boot xfs rw,seclabel,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
/dev/sda1 /boot/efi vfat rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro 0 0
/dev/mapper/rootvg-var_lv /var xfs rw,seclabel,nosuid,nodev,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
/dev/mapper/rootvg-vartmp_lv /var/tmp xfs rw,seclabel,nosuid,nodev,noexec,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
/dev/mapper/rootvg-varlog_lv /var/log xfs rw,seclabel,nosuid,nodev,noexec,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
/dev/mapper/rootvg-varlogaudit_lv /var/log/audit xfs rw,seclabel,nosuid,nodev,noexec,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
none /run/credentials/systemd-tmpfiles-setup.service ramfs ro,seclabel,nosuid,nodev,noexec,relatime,mode=700 0 0
tmpfs /run/user/1007 tmpfs rw,seclabel,nosuid,nodev,relatime,size=787212k,nr_inodes=196803,mode=700,uid=1007,gid=100,inode64 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0

df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 4096 0 4096 0% /dev
tmpfs 3936068 0 3936068 0% /dev/shm
tmpfs 1574428 760 1573668 1% /run
/dev/mapper/rootvg-root_lv 10475520 2109808 8365712 21% /
/dev/mapper/rootvg-home_lv 33538048 288976 33249072 1% /home
/dev/mapper/rootvg-tmp_lv 10475520 106200 10369320 2% /tmp
/dev/sda2 1562624 360956 1201668 24% /boot
/dev/sda1 204560 7136 197424 4% /boot/efi
/dev/mapper/rootvg-var_lv 10475520 1003884 9471636 10% /var
/dev/mapper/rootvg-vartmp_lv 4184064 62688 4121376 2% /var/tmp
/dev/mapper/rootvg-varlog_lv 10475520 144312 10331208 2% /var/log
/dev/mapper/rootvg-varlogaudit_lv 4184064 79408 4104656 2% /var/log/audit
tmpfs 787212 0 787212 0% /run/user/1007
User avatar
macan
Cacti Guru User
Posts: 1104
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: Help with permissions issue

Post by macan »

Try to disable selinux
Let the Cacti grow!
johnstonjj77
Posts: 8
Joined: Thu Aug 17, 2023 8:40 am

Re: Help with permissions issue

Post by johnstonjj77 »

macan wrote: Fri Aug 18, 2023 7:29 am Try to disable selinux
It looks like it's working after disabling SELinux. Is there a way to enable SELinux but still have the Weathermap editor work?
User avatar
macan
Cacti Guru User
Posts: 1104
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: Help with permissions issue

Post by macan »

I don't know selinux detaily. It isn't cacti issue. Try to create any selinux exception for apache or this directory
Let the Cacti grow!
johnstonjj77
Posts: 8
Joined: Thu Aug 17, 2023 8:40 am

Re: Help with permissions issue

Post by johnstonjj77 »

macan wrote: Fri Aug 18, 2023 8:58 am I don't know selinux detaily. It isn't cacti issue. Try to create any selinux exception for apache or this directory
Ok, thanks so much for your help with this. You have been a tremendous help! I'll work on chasing down the selinux exception seperately.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests