Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-5145

PostgreSQL auditlog insert error (value too long) when HTTP_X_FORWARDED_FOR contains many IPs

    Details

    • Type: Incident report
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.2rc1, 2.1.0
    • Component/s: Frontend (F)
    • Labels:
    • Environment:
      Debian Squeeze, Apache 2.2.17, PHP 5.3.3, PostgreSQL 9.1

      Description

      When HTTP header HTTP_X_FORWARDED_FOR contains multiple IPs (more than 39 chars long in total, inserting in auditlog SQL table fails.

      file : include/audit.inc.php, lines 81, 110, 134.

      Possible fixes :

      • truncate $ip variable to 39 chars
      • increase field 'ip' in SQL table auditlog.

      Example error messages :

      • while trying to change the "managed" status of a host on the host list page :

      Fatal error: Uncaught exception 'DBException' with message 'SQL statement execution has failed "UPDATE hosts SET status='0' WHERE (hostid IN ('10084')) ".' in /srv/web/zabbix/include/classes/db/DB.php:48 Stack trace: #0 /srv/web/zabbix/include/classes/db/DB.php(448): DB::exception(1, 'SQL statement e...') #1 /srv/web/zabbix/include/hosts.inc.php(572): DB::update('hosts', Array) #2 /srv/web/zabbix/hosts.php(547): updateHostStatus(Array, 0) #3

      {main}

      thrown in /srv/web/zabbix/include/classes/db/DB.php on line 48

      • while trying to update "monitored" status on the host configuration or addition page.

      pg_query(): Query failed: ERREUR: valeur trop longue pour le type character varying(39) [include/db.inc.php:500]
      Error in query [INSERT INTO auditlog (auditid,userid,clock,ip,action,resourcetype,resourceid,resourcename) VALUES (7,1,1339064203,'172.25.22.93, 172.20.27.250, 172.20.150.18',1,4,10084,'Zabbix server')] [ERREUR: valeur trop longue pour le type character varying(39)]
      Updated status of host "Zabbix server"
      pg_query(): Query failed: ERREUR: la transaction est annulée, les commandes sont ignorées jusqu'à la fin du bloc de la transaction [include/db.inc.php:500]
      Error in query [UPDATE hosts SET status='0' WHERE (hostid IN ('10084')) ] [ERREUR: la transaction est annulée, les commandes sont ignorées jusqu'à la fin du bloc de la transaction]
      SQL statement execution has failed "UPDATE hosts SET status='0' WHERE (hostid IN ('10084')) ".

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sleibo Sétphane Leibovitsch
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: