Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.11.1 available

The official documentation can be found on http://wiki.ocsinventory-ng.org. Read it before asking your question.

[SOLVED] Error HTTP 401 while inventorying

Hi everybody,

I open this thread because i haven't found the answer to my issue on another FAQs...

So, after an upgrade of OCSServer in version 2.4, the agents can't send em inventory, they get an error HTTP 401 in ocsinventory.log:

AGENT => Sending Prolog
ERROR *** AGENT => Failed to send Prolog <HTTP Status Code #401>

and here is the .ini file;

[OCS Inventory Agent]
ComProvider=ComHTTP.dll
Debug=0
Local=
NoSoftware=0
HKCU=0
NoTAG=0
IpDisc=
[HTTP]
Server=http://myserver/ocsinventory
SSL=1
CaBundle=cacert.pem
AuthRequired=0
User=
Pwd=
ProxyType=0
Proxy=
ProxyPort=0
ProxyAuthRequired=0
ProxyUser=
ProxyPwd=
[OCS Inventory Service]
TTO_WAIT=300
PROLOG_FREQ=4
OLD_PROLOG_FREQ=4
OLD_PROLOG_FREQ
 

I heard that the problem is caused by the authentication on the server by the client, but we didn't need that before... do you know how to configure apache to allow the  unauthentified inventory?

Thank you in advance!!

Arnaud

in OCS Inventory NG server for Unix by (250 points)
edited by

4 Answers

0 votes
Hi everyone,

I couldn't find anything on the entire web about this error, i just don't understand what happens...

I've configured the credentials in every config file for OCS (zz-ocsinventory-restapi, z-ocsinventory-server.conf , config.db.php...) and it still doesn't work ...

If i do a curl http://helpdesk/ocsinventory on my linux server, i get that 401 error, "auth required..."

Here are the z-ocsinventory-server.conf parameters for the /ocsinventory location:

 <Location /ocsinventory>
    <IfModule mod_authz_core.c>
      # Apache 2.4
      Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
     # Apache 2.2
          order allow,deny
          allow from all
        </IfModule>
        # If you protect this area you have to deal with http_auth_* agent's parameters
        # AuthType Basic
        # AuthName "OCS Inventory agent area"
        # AuthUserFile "APACHE_AUTH_USER_FILE"
        # require valid-user
       SetHandler perl-script
       PerlHandler Apache::Ocsinventory
  </Location>

help will be much appreciated!

Arnaud
by (250 points)
+1 vote

Bonjour Arnaud,

2 choses :

1/ Pour utiliser le FQDN, il faut un enregistrement DNS fonctionel, c'est ok de ce coté là ? la station réponds bien au ping fqdn ?

2/ Dans ton fichier .ini, tu as :

Server=http://myserver/ocsinventory
SSL=1
CaBundle=cacert.pem

Si tu as SSL=1, ton URL devait être en https. Arrêtes  le service ocsinventory,, puis édites le fichier.ini comme cela :

Server=https://FQDN/ocsinventory

tu peux aussi diminuer le TimeToWait à 10 au passage

redémarres le service et forces un inventaire. Si il n'y a pas de remontée dans ton serveur au bout d'une minute (si tu as modifié le TimeToWait à 10), re arretes le service, re modifies le fichier comme cela

Server=http://FQDN/ocsinventory

SSL = 0

re démarres le service et force un inventaire, attends une minute...

Cordialement

by (5.7k points)
edited by
0 votes

Bonjour,

Merci pour ta réponse,

Pas de soucis le serveur est bien enregistré dans le DNS. En fait ça fonctionne comme ça depuis un moment, c'est la mise à jour de GLPI en 9.2.4 qui a posé problème.

J'ai essayé avec SSL=0 et http:// et idem...

ERROR *** AGENT => Failed to send Prolog <HTTP Status Code #401>

Dans le log access d'Apache:


10.x.x.x - - [01/Mar/2019:08:38:39 +0100] "POST /ocsinventory HTTP/1.1" 401 745 "-" "OCS-NG_WINDOWS_AGENT_v2.1.1.1"
 

Rien dans le log d'erreur...

Merci de ton aide :)

Arnaud

by (250 points)
0 votes

Problème résolu...

Il se trouve que lors de la MAJ de mon instance GLPI, j'avais désactivé le site par défaut d'apache, qui contenait des directives d'accès aux répertoires parents /var/www et / , notamment "order allow, deny" , "allow from all"...

C'est assez facile de reproduire le problème en faisant, depuis le serveur OCS, un

curl http://yourserver/ocsinventory

si on obtient 401: pas bon, si 400: ok

by (250 points)
 
Powered by Question2Answer
...