Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New install returns 500 even with Synchronous feeder #197

Open
benjamindonnachie opened this issue May 13, 2024 · 1 comment
Open

New install returns 500 even with Synchronous feeder #197

benjamindonnachie opened this issue May 13, 2024 · 1 comment

Comments

@benjamindonnachie
Copy link

benjamindonnachie commented May 13, 2024

Thanks again for all the work that has gone into this project. Very much looking forward to using it across our systems.

New install of pakiti-server master branch (20240513 - web gui reports v3.1.0) on Rocky Linux 9.4 (also tried with Fedora 39) and pakiti-client (also 20240513) gives 500 errors despite feeder set to synchronous mode.

Firstly, gzip added to src/common/Utils.php as below:

           case "application/x-gzip" :
            case "application/gzip" :
                $contents = gzdecode($contents);
                if ($contents === False)
                    throw new Exception("Failed to decompress gzip data");

Config.php:

<?php
 
final class Config extends DefaultConfig
{
    public static $DB_HOST = "localhost";
    public static $DB_NAME = "pakiti";
    public static $DB_USER = "pakiti";
    public static $DB_PASSWORD = "xxx";

    # Pakiti operational mode
    #   1 - Synchronous mode - process clients reports immediately, useful for small deployments with < 1000 hosts
    #   2 - Asynchronous mode - process clients reports from the queue, needed in the deployments with > 1000 hosts
    public static $FEEDER_MODE = 1;

    public static $BACKUP = false;
    public static $BACKUP_DIR = "/var/lib/pakiti";

    public static $DEBUG = true;
}

Edited pakiti-client to make curl verbose:

# pakiti-client --disable-tls-checks --url http://127.0.0.1/pakiti/feed/
*   Trying ::1:80...
* Connected to localhost (::1) port 80 (#0)
> POST /pakiti/feed/?protocol=5 HTTP/1.1
> Host: localhost
> User-Agent: curl/7.76.1
> Accept: */*
> Content-Length: 43651
> Content-Type: application/x-www-form-urlencoded
> 
} [43651 bytes data]
* Mark bundle as not supporting multiuse
< HTTP/1.1 500 Internal Server Error
< Date: Mon, 13 May 2024 19:09:42 GMT
< Server: Apache/2.4.57 (Rocky Linux)
< X-Powered-By: PHP/8.2.13
< Content-Length: 0
< Connection: close
< Content-Type: text/html; charset=UTF-8
< 
* Closing connection 0
Error: 0 at /usr/bin/pakiti-client line 385.
[root@pakiti log]# 

SELinux is permissive:

# sudo getenforce
Permissive

Journald:

May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/common/Loader.php:76]: Class Pkg loaded
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/modules/feeder/FeederModule.php:664]: Parsing packages
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/modules/feeder/FeederModule.php:416]: Preparing the report
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/common/Loader.php:76]: Class StatsManager loaded
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/managers/DbManager.php:152]: Sql query: select id from Host where hostname='pakiti' and ip='' and re>
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/common/Loader.php:76]: Class HostDao loaded
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/managers/HostsManager.php:39]: Getting the host ID
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/common/Loader.php:76]: Class HostsManager loaded
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/common/Loader.php:76]: Class DefaultManager loaded
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/modules/feeder/FeederModule.php:108]: Report from [reporterHost=localhost, reporterIp=127.0.0.1, clientVersion=5]
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/modules/feeder/FeederModule.php:891]: Computing the hash of the list of the packages
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/modules/feeder/FeederModule.php:874]: Computing the hash of the report header
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/common/Utils.php:54]: Getting attribute [name=report] from the HTTP request
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/common/Utils.php:54]: Getting attribute [name=mode] from the HTTP request
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/common/Utils.php:54]: Getting attribute [name=protocol] from the HTTP request
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/common/Loader.php:76]: Class Report loaded
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/common/Loader.php:76]: Class Host loaded
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/managers/DbManager.php:152]: Sql query: select attrValue from PakitiAttributes where attrName='dbVersion'
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/managers/DbManager.php:144]: Successfully conected to the database [dbName=pakiti,dbHost=localhost,dbUser=pakiti]
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/common/Loader.php:76]: Class DbManager loaded
May 13 20:30:32 pakiti Pakiti[39571]: (127.0.0.1:57608) Mon, 13 May 24 19:30:32 +0000 [/var/www/pakiti-server/src/common/Pakiti.php:24]: Pakiti initialized

Apache access_log:
127.0.0.1 - - [13/May/2024:20:30:32 +0100] "POST /pakiti/feed/index.php?protocol=5 HTTP/1.1" 500 - "-" "curl/7.76.1"

Populated VDS and downloaded CVEs successfully. Website loads, reports 22,678 CVEs monitored.

Also tried on a CentOS v7.9.2009 box with pakiti-client-3.0.1-1.el7.noarch from epel:

pakiti-client --url='http://pakiti/pakiti/feed/'
HTTP/1.1 100 Continue

HTTP/1.1 500 Internal Server Error
Date: Mon, 13 May 2024 19:51:12 GMT
Server: Apache/2.4.57 (Rocky Linux)
X-Powered-By: PHP/8.2.13
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8

pakiti-client: failed to send data using /bin/curl

Similar messages in logs. In the middle of troubleshooting, will pick up again tomorrow.

Thanks.

@benjamindonnachie benjamindonnachie changed the title New install returns 500 even if with Synchronous feeder New install returns 500 even with Synchronous feeder May 13, 2024
@HavrilaJ
Copy link
Contributor

HavrilaJ commented Jan 8, 2025

Hi, I was trying to install pakiti-server on CentOS 9(I'm not using it regularly, but I wanted to find out if it works and tried to replicate the problem that you have).
I had the problem to load even the website and finally I found out that error logs are in php-fpm(/var/log/php-fpm/www-error.log).
And to run the website I had to fix "Permission denied" on /etc/pakiti/Config.php and mysql incompability(similarly in Debian) in /etc/my.cnf.d/mysql-server.cnf with " sql-mode='' "
But pakiti-client was still not working with same error as you had. But there was "PHP Fatal error: Uncaught Error: Call to undefined function sem_get() in /var/www/pakiti-server/src/modules/feeder/FeederModule.php:339" so I installed "yum install php-process" and everything started working.
If it helped you, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants