Closed hspindel closed 1 year ago
Can you please check the pialert.conf if the line looks like
PIHOLE_DB = '/etc/pihole/pihole-FTL.db'
Can you see this error in the scan log as well?
Thank you.
There were no single quotes around the PIHOLE_DB path in my config file. I haven't touched that line, so it was installed that way. I added the quotes and I'll see how the next update goes.
I don't see any problems in the scan log.
Interestingly, after I edited the pialert.conf file, I attempted "Create Config Backup" and got "It is not possible to save the configuration.
This should be a permissions issue. During development this happens to me as well.
Check if you have set the following permission:
-rw-rw-r-- 1 YOURUSER www-data 3601 13 Sep 08:11 pialert.conf
or -rwxrwxr-x 1 YOURUSER www-data 3601 13 Sep 08:11 pialert.conf
I implemented a corresponding function also in the pialert-cli, but the config folder is not set correctly yet. The next update will fix this.
Yes, it is a permissions issue. I could not get it to work until I did chmod a+w on the config directory.
I don't know what user pialert runs as. The owner of my config files is root, which would explain why pialert can't write them if it's running as a less privileged user. pialert is run from root's crontab.
I may have screwed up all my permissions now because basically the files are world-writable. What are they supposed to be?
There is no pialert user. If you installed pialert with sudo, root is the user, who runs pialert. Im my case it is the user pi.
Okay, I don't understand what went wrong in my configuration. pialert was installed as root, so the config directory should have been writable by pialert running as root.
I guess it's not important since it's working now.
We get it back to work Can you show me the content of your pialert and config dir (ls -al)?
Okay, I don't understand what went wrong in my configuration. pialert was installed as root, so the config directory should have been writable by pialert running as root.
I guess it's not important since it's working now.
But the webinterface is running as www-data and needs write permissions too, in case you want to change something. www-data should be the group, also with write permissions. A future update resets the permissions anyway
/root/pialert:
drwxr-xr-x 9 501 staff 4096 Sep 12 12:17 . drwx--x--x 9 root root 4096 Sep 12 23:08 .. drwxr-xr-x 3 501 staff 4096 Sep 12 17:21 back -rwxr-xr-x 1 501 staff 220 Aug 20 00:30 ._config drwxrwxrwx 2 root staff 4096 Sep 12 23:02 config drwxrwxr-x 3 501 www-data 4096 Sep 12 23:30 db drwxr-xr-x 3 501 staff 4096 Sep 12 17:21 docs -rwxr-xr-x 1 501 staff 220 Aug 20 00:30 ._front drwxr-xr-x 10 501 staff 4096 Sep 12 12:17 front -rwxr-xr-x 1 501 staff 220 Aug 20 00:30 ._install drwxr-xr-x 2 501 staff 4096 Sep 12 17:21 install -rw-r--r-- 1 501 staff 35149 Sep 12 12:17 LICENSE.txt -rwxr-xr-x 1 501 staff 220 Aug 20 00:30 ._log drwxr-xr-x 2 501 staff 4096 Sep 12 17:21 log -rw-r--r-- 1 501 staff 176 Aug 20 00:30 ._README.md -rw-r--r-- 1 501 staff 9134 Sep 12 12:17 README.md
/root/pialert/config:
drwxrwxrwx 2 root staff 4096 Sep 12 23:02 . drwxr-xr-x 9 501 staff 4096 Sep 12 12:17 .. -rwxrwxr-x 1 501 www-data 176 Aug 20 00:30 ._pialert.conf -rwxrwxrwx 1 root www-data 3424 Sep 12 23:01 pialert.conf -rwxrwxrwx 1 root www-data 3689 Sep 12 17:21 pialert.conf.back -rwxrwxr-x 1 root www-data 3713 Jul 9 23:50 pialert.conf.original -rwxrwxrwx 1 root www-data 3424 Sep 12 23:30 pialert-prev.bak -rwxrwxr-x 1 501 www-data 176 Aug 20 00:30 ._version.conf -rwxrwxr-x 1 501 staff 83 Sep 12 12:17 version.conf
Note that all of the above are changed from what they were since I messed with them trying to get it to work.
Let's just wait until the next update and see if this gets sorted out.
Yeah, that looks a little messed up. I am on the road right now. I will have a closer look later. To reset the permissions as far as possible, you could also apply the update again.
I applied the update again.
Had a couple minor problems. The update process threw errors because it didn't like some lines in my pialert.conf:
SCAN_SUBNETS, DAYS_TO_KEEP_ONLINEHISTORY, and DAYS_TO_KEEP_EVENTS were all blank in my pialert.conf. I changed SCAN SUBNETS to '--localnet' and arbitrarily changed the other two to 14. That made the update process run without errors. Since I haven't changed those values in pialert.conf from previous versions something must have changed in the field validation.
Sadly, when I was done with that I was once unable to "Create Config Backup" from the GUI. I guess that that is due to your aforementioned forthcoming fix for permissions on the config directory, so I'll just wait for the next update.
Okay. And I'll try to figure out how it gets to the removed "'". The only component that I currently see being able to do this is the config editor in the web interface. But here I have built in checks that this should not happen. And if it does happen, it could really only happen with the Mac Ignore list and the Scan_Subnets option. I'll have to take a closer look at the process again.
This is the updated pialert-cli. It sets the permissions on ~/pialert/config and ~/pialert/db
https://github.com/leiweibau/Pi.Alert/blob/63ec4c3398dc7d8b5f01fdf15864f2ca36102aae/back/pialert-cli
Please check the original permissions first for comparison
Simply for the sake of completeness.
When installing on an Ubuntu server under the root user, the folder permissions in the /root/pialert/ folder are
Here also the wrong permission is set, a configuration backup consequently not possible.
Now execute sudo chgrp -R www-data /root/pialert/config
.
Afterwards the directories should look like this.
I will work on this in the next update.
Working well now, thank you.
Ran the update script and it reports errors. Despite the errors, piAlert seems to be working fine.
Starting Pi.Alert... Traceback (most recent call last): File "/root/pialert/back/pialert_reporting_test.py", line 51, in
exec(open(PIALERT_PATH + "/config/pialert.conf").read())
File "", line 102
PIHOLE_DB = /etc/pihole/pihole-FTL.db
^
SyntaxError: invalid syntax
Configured Pi.Alert scans are enabled
Testing Pi.Alert HW vendors database update process... *** PLEASE WAIT A COUPLE OF MINUTES... Traceback (most recent call last): File "/root/pialert/back/pialert.py", line 56, in
exec(open(PIALERT_PATH + "/config/pialert.conf").read())
File "", line 102
PIHOLE_DB = /etc/pihole/pihole-FTL.db
^
SyntaxError: invalid syntax
Testing Pi.Alert Internet IP Lookup... Traceback (most recent call last): File "/root/pialert/back/pialert.py", line 56, in
exec(open(PIALERT_PATH + "/config/pialert.conf").read())
File "", line 102
PIHOLE_DB = /etc/pihole/pihole-FTL.db
^
SyntaxError: invalid syntax
Testing Pi.Alert Network scan... *** PLEASE WAIT A COUPLE OF MINUTES... Traceback (most recent call last): File "/root/pialert/back/pialert.py", line 56, in
exec(open(PIALERT_PATH + "/config/pialert.conf").read())
File "", line 102
PIHOLE_DB = /etc/pihole/pihole-FTL.db
^
SyntaxError: invalid syntax
Update process finished