OCSInventory-NG / OCSInventory-Server

Communication server of OCS Inventory
http://www.ocsinventory-ng.org/
GNU General Public License v2.0
344 stars 139 forks source link

[error] Cannot establish communication : 500 Internal Server Error - ONLY FOR UNIX AGENT AND INJECTOR FON DEBIAN #410

Closed c3ph3us closed 1 year ago

c3ph3us commented 1 year ago

SERVER:

SERVER_info.txt server-status.html.txt install.log install_wizard.log

Przechwycenie obrazu ekranu_2022-11-06_16-09-59

UNIX CLIENTS:

[error] Cannot establish communication : 500 Internal Server Error

1) using debian package 2:2.8-2 amd64
/usr/bin/ocsinventory-agent --debug --ssl=0 --nosoftware --force -s http://10.10.0.254:8081/ocsinventory 2) using github devlibs clone cd repo && ./ocsinventory-agent --devlib --debug --ssl=0 --nosoftware --force -s http://10.10.0.254:8081/ocsinventory

same result using agent on server and remote lan 2 clients

client_1.log client_2.log client_3_onserver.log

ANDROID CLIENT OK!!!

WINDOW CLIENT OK!!

INJECTOR same as client

./ocsinventory-injector.pl -f /root/UnixAgent/dl360g7-2022-11-05-18-55-32.ocs -u http://10.10.0.254:8081/ocsinventory -v --sslmode=0

Loading /root/UnixAgent/dl360g7-2022-11-05-18-55-32.ocs...ERROR: 500 Internal Server Error

127.0.0.1 - - [06/Nov/2022:16:31:42 +0100] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.4.54 (Debian) mpm-itk/2.4.7-04 mod_perl/2.0.12 Perl/v5.36.0 (internal dummy connection)" 10.10.0.254 - - [06/Nov/2022:16:50:32 +0100] "POST /ocsinventory HTTP/1.1" 500 803 "-" "OCS-NG_INJECTOR_PL_v3"

1. what is the difference(implementation) in upload between ANDROID, WINDOWS, LINUX AGENTS and INJECTOR ? 2. how DEBUG the communication between client and server? 3. which script handles http request on server side ?

ps.

LogLevel debug PerlWarn On

[Sun Nov 06 17:02:06.663366 2022] [authz_core:debug] [pid 98726] mod_authz_core.c(815): [client 10.10.0.254:51408] AH01626: authorization result of Require all granted: granted [Sun Nov 06 17:02:06.663441 2022] [authz_core:debug] [pid 98726] mod_authz_core.c(815): [client 10.10.0.254:51408] AH01626: authorization result of : granted Warning: 'ParserOpts' is deprecated, contact the author if you need it at /usr/local/share/perl/5.36.0/Apache/Ocsinventory.pm line 218. Use of uninitialized value in numeric eq (==) at /usr/local/share/perl/5.36.0/Apache/Ocsinventory/Server/Inventory.pm line 88. Use of uninitialized value in string eq at /usr/local/share/perl/5.36.0/Apache/Ocsinventory/Server/Inventory/Update/Hardware.pm line 101. Use of uninitialized value in string eq at /usr/local/share/perl/5.36.0/Apache/Ocsinventory/Server/Inventory/Update/Hardware.pm line 101. Use of uninitialized value in string eq at /usr/local/share/perl/5.36.0/Apache/Ocsinventory/Server/Inventory/Update/Hardware.pm line 101.

response via Data::Dumper() :

$ua

$VAR1 = bless( { 'send_te' => 1, 'max_size' => undef, 'handlers' => { 'response_header' => bless( [ { 'm_media_type' => 'html', 'line' => '/usr/share/perl5/LWP/UserAgent.pm:775', 'owner' => 'LWP::UserAgent::parse_head', 'callback' => sub { "DUMMY" } } ], 'HTTP::Config' ) }, 'use_eval' => 1, 'def_headers' => bless( { 'user-agent' => 'OCS-NG_INJECTOR_PL_v3' }, 'HTTP::Headers' ), 'requests_redirectable' => [ 'GET', 'HEAD' ], 'no_proxy' => [], 'show_progress' => undef, 'protocols_allowed' => [ 'http', 'https' ], 'proxy' => {}, 'local_address' => undef, 'timeout' => 10, 'protocols_forbidden' => undef, 'max_redirect' => 7, 'ssl_opts' => { 'SSL_ca_file' => 'cacert.pem', 'verify_hostname' => 0 } }, 'LWP::UserAgent' );

$res

'_headers' => bless( { 'user-agent' => 'OCS-NG_INJECTOR_PL_v3', 'content-type' => 'Application/x-compress', 'pragma' => 'no-cache' }, 'HTTP::Headers' ), '_uri_canonical' => $VAR1->{'_request'}{'_uri'} }, 'HTTP::Request' ), '_headers' => bless( { 'date' => 'Sun, 06 Nov 2022 16:24:36 GMT', 'client-date' => 'Sun, 06 Nov 2022 16:24:36 GMT', 'server' => 'Apache/2.4.54 (Debian)', 'content-length' => '611', 'connection' => 'close', 'client-peer' => '10.10.0.254:8081', 'content-type' => 'text/html; charset=iso-8859-1', '::std_case' => { 'client-response-num' => 'Client-Response-Num', 'title' => 'Title', 'client-date' => 'Client-Date', 'client-peer' => 'Client-Peer' }, 'title' => '500 Internal Server Error', 'client-response-num' => 1 }, 'HTTP::Headers' ), '_max_body_size' => undef }, 'HTTP::Response' );

TCPDUMP

WINDOWS HEADERS + PAYLOAD

POST /ocsinventory HTTP/1.1
Host: 10.10.0.254:8081
User-Agent: OCS-NG_WINDOWS_AGENT_v2.9.2.0
Accept: */*
Content-Type: application/x-compressed
Content-Length: 135
[binar payload]

INJECTOR + OCS

POST /ocsinventory HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE, close
Pragma: no-cache
Host: 10.10.0.254:8081
User-Agent: OCS-NG_INJECTOR_PL_v3
Content-Type: Application/x-compress
Content-Length: 641

[xml payload]

UNIX AGENT

POST /ocsinventory HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE
Pragma: no-cache
Host: 10.10.0.254:8081
User-Agent: OCS-NG_unified_unix_agent_v2.10.0
Content-Type: application/x-compress
Content-Length: 46523

[binary payload]
POST /ocsinventory HTTP/1.1
TE: deflate,gzip;q=0.3
Keep-Alive: 300
Connection: Keep-Alive, TE
Pragma: no-cache
Host: 10.10.0.254:8081
User-Agent: OCS-NG_unified_unix_agent_v2.10.0
Content-Type: application/x-compress
Content-Length: 7136

4. what is implication for use the Content-Type: application/x-compressed ? 5. where can i get comm protocol spec ??? 6. what is the TE header and the related connection value of TE ?

Connection | Control options for the current connection and list of hop-by-hop request fields. Must not be used with HTTP/2. example -> Connection: keep-alive Connection: Upgrade | Permanent RFC 2616, 7230''

TE - abbr from Transfer Encoding ?

gillesdubois commented 1 year ago

Hi,

In order to have more information, could you enable the DBI_PRINT_ERROR in the z-ocsinventory-server.conf file ? Then try to use the injector again, you'll have the SQL Query leading to empty dataset.

Regards, Gilles.

charleneauger commented 1 year ago

Hi,

Since there was no answer, I'll close this issue now.

Regards, Charlene