glpi-project / glpi

GLPI is a Free Asset and IT Management Software package, Data center management, ITIL Service Desk, licenses tracking and software auditing.
https://glpi-project.org
GNU General Public License v3.0
4.1k stars 1.27k forks source link

Mail Collector Issue #12018

Closed Edgar-GC-Junior closed 2 years ago

Edgar-GC-Junior commented 2 years ago

Code of Conduct

Is there an existing issue for this?

Version

9.5.7

Bug description

Hello!

I've got an error (below) when I send an email from (Microsoft Office 365). Gmail and others works fine.

[2022-06-27 12:55:56] glpiphplog.CRITICAL: *** Uncaught Exception Laminas\Mail\Header\Exception\InvalidArgumentException: Invalid header value detected in /home/administrator/public_html/glpi/vendor/laminas/laminas-mail/src/Header/GenericHeader.php at line 64 Backtrace : vendor/laminas/laminas-mail/src/Headers.php:544 Laminas\Mail\Header\GenericHeader::splitHeaderLine() vendor/laminas/laminas-mail/src/Headers.php:284 Laminas\Mail\Headers->loadHeader() vendor/laminas/laminas-mail/src/Headers.php:105 Laminas\Mail\Headers->addHeaderLine() ...r/laminas/laminas-mail/src/Storage/Part.php:113 Laminas\Mail\Headers::fromString() ...laminas/laminas-mail/src/Storage/Message.php:53 Laminas\Mail\Storage\Part->construct() ...or/laminas/laminas-mail/src/Storage/Pop3.php:64 Laminas\Mail\Storage\Message->construct() ...aminas-mail/src/Storage/AbstractStorage.php:268 Laminas\Mail\Storage\Pop3->getMessage() inc/mailcollector.class.php:721 Laminas\Mail\Storage\AbstractStorage->current() front/mailcollector.form.php:88 MailCollector->collect()

Relevant log output

Non-working email header:
Return-Path: <edgar.garcia@t-edge.tech>
Delivered-To: suporte@agante.com.br
Received: from srv01vps.agante.com.br
    by srv01vps.agante.com.br with LMTP
    id OB3yDWLTtWJpKQAAyW8eYA
    (envelope-from <edgar.garcia@t-edge.tech>)
    for <suporte@agante.com.br>; Fri, 24 Jun 2022 12:08:18 -0300
Return-path: <edgar.garcia@t-edge.tech>
Envelope-to: suporte@agante.com.br
Delivery-date: Fri, 24 Jun 2022 12:08:18 -0300
Received: from mail-roabra01on2067.outbound.protection.outlook.com ([40.107.111.67]:62689 helo=BRA01-ROA-obe.outbound.protection.outlook.com)
    by srv01vps.agante.com.br with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
    (Exim 4.95)
    (envelope-from <edgar.garcia@t-edge.tech>)
    id 1o4kuv-0002lX-Ia
    for suporte@agante.com.br;
    Fri, 24 Jun 2022 12:08:18 -0300
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
    b=g5Aq9Vezf9MjQwVe1+I4ubNd/E9MbM9d6O3QtbYluSYXR4bav5Dy8yxt9DH/yk4nJFjTP2/0PicGylX3Gbx+opUXj4ifKAkdVRtuoIwHhELNjbk+Q7WGm11vDmEYqKFlQyfBah8FeDqXzpnxTkK/ok4wfHkG9V0WdLgkhB+DQm+CuIkpiw8gi1QUqJ/Q2T+Ng/GwPb7c9UpRgO+T0QEBG+4prMrcwPJlKkhNY0SeLjBBwILUf4gco1AJ0DzuQsNfiJAgzlqaF64HfniGDD8ZKVKLqQ4ATfJ/4Y9l8D5OId6VAKAQQe3LPG/KtxRdapzyT34OaH7guN9eIv/O3y54Eg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
    s=arcselector9901;
    h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
    bh=WRAxHwvpsFKtRz4aASMmHpUGJGdEBxYxko2S2C6aRTA=;
    b=b0d2EZ4fVDx2ZOeCe3N3kNCqXhLP+8Mnh8VV3noo8vAZhvDRMJVWIyYRFtEMP9+nGpVrsFfgaNjIyFpjn7rmDtYAUfLDXswnWsuPPpSVCS8S0RNxCXURGiPZpGhzBXl+4wfZhiwfBwDtr6e0P1Fr96xJNyLKt6UTFZiSfaBKN6O5IVgHzN/KJbgTbnvHr08r70JuR/fwg93VcC/dZj6BYxQwHDP41HuZxbfHkhDHwXVvaIipT/vtG0ZsO0qkjfi0kuC2G8gVjggyeMto1G3hWng22VzdRtzIv27nwMSw3Y0p91pMBOP1Sfsv05ewCy+ETSNGL+FeqcCFFnOfyDIMTQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
    smtp.mailfrom=t-edge.tech; dmarc=pass action=none header.from=t-edge.tech;
    dkim=pass header.d=t-edge.tech; arc=none
Received: from CP4P284MB1713.BRAP284.PROD.OUTLOOK.COM (2603:10d6:103:d9::12)
    by CPYP284MB0821.BRAP284.PROD.OUTLOOK.COM (2603:10d6:103:9b::6) with
    Microsoft SMTP Server (version=TLS1_2,
    cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.17; Fri, 24 Jun
    2022 15:08:13 +0000
Received: from CP4P284MB1713.BRAP284.PROD.OUTLOOK.COM
    ([fe80::1db9:753e:fb67:3633]) by CP4P284MB1713.BRAP284.PROD.OUTLOOK.COM
    ([fe80::1db9:753e:fb67:3633%3]) with mapi id 15.20.5373.017; Fri, 24 Jun 2022
    15:08:13 +0000
From: Edgar Garcia | T-Edge <edgar.garcia@t-edge.tech>
To: Suporte Agante <suporte@agante.com.br>
Subject: Teste
Thread-Topic: Teste
Thread-Index: AdiH3Da57TZ7jYqDTTOoz4S1X1drUQ==
Date: Fri, 24 Jun 2022 15:08:13 +0000
Message-ID:
    <CP4P284MB1713F1937E29F16150C68C50D0B49@CP4P284MB1713.BRAP284.PROD.OUTLOOK.COM>
Accept-Language: pt-BR, en-US
Content-Language: pt-BR
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator:
authentication-results: dkim=none (message not signed)
    header.d=none;dmarc=none action=none header.from=t-edge.tech;
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: a71fa55c-2787-4859-e7a0-08da55f35bff
x-ms-traffictypediagnostic: CPYP284MB0821:EE_
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info:
    o8O9NoTM6Un90bMNq6YeS20oIcqe+/6+67Sp0tugNCvPRsEkssLgVwUSTQpU4ZFUewFNNgCIhr6Kg0Kn1de07M8/j/hVPV1INmC2NxlUhSttV/fFR04ZgbZmmxJgEKImskVmdMQBAYY6IuAkqiBcgz+NLolud51bBIYRXqMU2TgIhY4FRahHLLjQMtHm5dS+8OxmpndJbjnudL4P7iCwQIiHH2VCWcDHqNajw5FBywCFjpPynp0l1PmDC87aOz3JvPtcNqU2iAElQ7z7IiWjCHNoSrDVBkZflCE8EaXneEXUK3NsCCIeX4bKd35uSUAOcjOd4wFcSXqlsouHeH/tFlVcS9RwIMBw68jG1B9vlCMeCQ7yWKwHZc/ywrUScKz/xeGUoNwl2ElefwP3s7khiw/b40UMcTEd+70xSkdnZJu1NFFzZG8qOani1cUPGdYgB+/vSC7TWe0SihknlYCPf4+/ela4oY+skWcE8GC0e+UqBVFR0TWO3SRuTJ06Y3F36K8zOXrUJvrxg24otiiihHarWu/2tIXhMzKh1sDlClv0FPtFg3XftLEsJGFzJIpYAjMrgyp1arB6hLJTWCmyHkkF7XVjpa8xC4omYn75ZPjAnfYjImwC/cuWkgl0mpZgaXTmP+D+zf+gjQB+T8df7fDwkdnDqkP0kgCbcIXm2wWMvxIy2dl4Z91T+6YvsSOjTZpuw1xOo+ZRIz1A+vxGgU0S6LxDDfvNiH7oIM5xD3ooGR3ZthlfbaC9XhMkzZcK80psa9IL09dh3OlRb14rNfZp2bBRRaSSQk0uExoPXN4=
x-forefront-antispam-report:
    CIP:255.255.255.255;CTRY:;LANG:pt;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CP4P284MB1713.BRAP284.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230016)(376002)(34096005)(39830400003)(366004)(396003)(136003)(346002)(186003)(3480700007)(71200400001)(55016003)(6506007)(478600001)(6916009)(66476007)(76116006)(7116003)(64756008)(9686003)(41300700001)(7696005)(66446008)(66556008)(66946007)(8676002)(86362001)(38100700002)(2906002)(19627235002)(316002)(38070700005)(122000001)(558084003)(33656002)(99936003)(8936002)(5660300002)(52536014);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
    =?iso-8859-1?Q?lCfSwP9VEu6xqsjXiH8Rq+XNUq08OUByz+0KX18RMuCiS5r8sEc8kLtCog?=
    =?iso-8859-1?Q?gGA+9e6uLMRaquSxyiSmmmMTE/520vs1MV2bUVb/UXzXGUrsey3otvNSB3?=
    =?iso-8859-1?Q?YdDks6IEmHzYx5/VWt/9in21M1XPvFGdAxqt5/SyZF4GI+A3LvEHueTqmj?=
    =?iso-8859-1?Q?mUMXGkZX/SMAJpy+jw9e9YxoZTOQ1E3PUUWM82iwojL+3VSARzArcHkgxA?=
    =?iso-8859-1?Q?mKs6b10xm0VLaK4xQrEkziGQThm6hYrS6w371tKst+xyVIcJTj4SJmCpvN?=
    =?iso-8859-1?Q?8vDN6Q1pHsRsNlq5epPbArVSCoYsRnTEareL+SxKe6y1eRExdmAhj6kPxh?=
    =?iso-8859-1?Q?44Zg2uBbuwnhI5xBX34gsgLAr5OyzLKo+U+nki1R/m5AU4FS+/8ucXJhfa?=
    =?iso-8859-1?Q?PYZ8u6hCnSCotYbkfDQo3lTQ6kLtOckpq9lJc1UNV+8zDSOOTq2XyyYWkI?=
    =?iso-8859-1?Q?r5hrhwZJ0ldiAdn/At4lyGV/NUKj9TUGxgwuBFPWoSGNI3vJMkryHAlirM?=
    =?iso-8859-1?Q?FKBwB8JHEP9kEQRWC/1MROdbpPBU/ut2kqaTNtiUhytep4P7voE0eP/8Yx?=
    =?iso-8859-1?Q?3FaC2e4duxd12BaBc6INq8FYFy7n+XHgnY6r8uMgio6jCH8bm56SGhqqqR?=
    =?iso-8859-1?Q?SDke2SEaOhzvKBUoXnlDapQMaSctGWCrm/D96G4NbDhQt+j3m8YsLLK5nA?=
    =?iso-8859-1?Q?SVkiTA51O9o8zu5lMxSapOBnlXPXQ5PqHINIzBXUOTbCvHDzKd3FjCJ57u?=
    =?iso-8859-1?Q?lHd+kakA+l5DQhg2RbRASxrqe47erkkrYLdZTRSKCO1CVNpzKKC0ObySmN?=
    =?iso-8859-1?Q?PXlbgFOsrfCueGUy4pXUcyZLCWgq852M8i+J/eGozKYMp5udSanTwuBpeo?=
    =?iso-8859-1?Q?Gfxl83M8mg2Yxdzg6fiqUgut3i8EF0ApLnaM/MXN82+XjN8iDRSL20EukA?=
    =?iso-8859-1?Q?PCtidGoxfy3TGeoM6ZmaOvZamFf1kIs1+w2k/o4mwzHkgEBjHR8LppkcEb?=
    =?iso-8859-1?Q?Z5iAnQ8YoAbpYBTll5WsH02pdH/NkW9LO2jmZTjt/17d5JfjyZSXV83hoZ?=
    =?iso-8859-1?Q?ONZ/TUvkAI7Hvp+fZaE1M1u5HW0cIdVXKW/ZuhVMZ6f8G0yMngCpS/NuLD?=
    =?iso-8859-1?Q?tJAPC1l1l8MrewvBbgyMOoiLLRyj8oryS3JN7wKlflFkR6yU8UxalAXdS6?=
    =?iso-8859-1?Q?pBHyr50dkCV4w4mQxOtgaexwbFwahtuXSNfX6J4zNSHtixfhQSl+l+zRTj?=
    =?iso-8859-1?Q?Fwql6GccCgXnhjCm9YGYkuliZW+5Ld2nZGgVgK4ieA2Q0FBKiVeap+mTac?=
    =?iso-8859-1?Q?zRCmttdem/RONcCPYEhCNhfpEVSE04sLC/H1L++6wmwM7H4UXDw90yssdq?=
    =?iso-8859-1?Q?G0I2vywFP9dc4r+/jhgov2rfbwkuBP03V58RIrykI8CMtq/EAfpn936v63?=
    =?iso-8859-1?Q?5uUYuAUFQuHrEoI9vZhUIjkAMjQ6YNU4vEvU9SsAdnxN7SaTLHlbEZ0CSx?=
    =?iso-8859-1?Q?0QzP2XK6ygf8wbW8ybizwm5blZLEZQPj0IIV9G+2+B94J9lVODOYAf+Snu?=
    =?iso-8859-1?Q?tgojRKpW68QrR5h4HimUCmLdVxvKQTPhLdKU5JTMaFlDvqWxf/WryIHgdz?=
    =?iso-8859-1?Q?kmkKV9erPdvFa9ZgNn1pdFpmQK1WRX7bGrsvcMgIDdax0jq5xc+yP8y/V/?=
    =?iso-8859-1?Q?gYVyg65G7SurmwXSSrjeFs2EJvQJw5azZwY6qN2x?=
Content-Type: multipart/related;
    boundary="_005_CP4P284MB1713F1937E29F16150C68C50D0B49CP4P284MB1713BRAP_";
    type="multipart/alternative"
MIME-Version: 1.0
X-OriginatorOrg: t-edge.tech
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: CP4P284MB1713.BRAP284.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-Network-Message-Id: a71fa55c-2787-4859-e7a0-08da55f35bff
X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jun 2022 15:08:13.4945
    (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 5a8c9c11-d58e-49af-bb6b-c35022ec55f7
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: ckF0Zok9eOMm/9YjrmJz2sTVnDXPs+3GsTiPa5mLWu9mfivhnxhWKM2+/apsPD+0FwCfZABLdLiXSPr3vvtfUO6PoBllBhR2YArUwSW2BsA=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CPYP284MB0821
X-Spam-Status: No, score=0.8
X-Spam-Score: 8
X-Spam-Bar: /
X-Ham-Report: Spam detection software, running on the system "srv01vps.agante.com.br",
    has NOT identified this incoming email as spam. The original
    message has been attached to this so you can view it or label
    similar future email. If you have any questions, see
    root\@localhost for details.
    Content preview: Teste [cid:image002.jpg@01D887C3.1295A880] Edgar Garcia Solues
    em Tecnologia +55 11 98874-9129 edgar.garcia@t-edge.tech<mailto:edgar.garcia@t-edge.tech>
    Teste
    Content analysis details: (0.8 points, 5.0 required)
    pts rule name description
    ---- ---------------------- --------------------------------------------------
    0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60%
    [score: 0.4957]
    -0.0 SPF_PASS SPF: sender matches SPF record
    -0.0 SPF_HELO_PASS SPF: HELO matches SPF record
    0.0 HTML_IMAGE_RATIO_08 BODY: HTML has a low ratio of text to image
    area
    0.0 HTML_MESSAGE BODY: HTML included in message
    0.0 KAM_DMARC_STATUS Test Rule for DKIM or SPF Failure with Strict
    Alignment
    -0.0 T_SCC_BODY_TEXT_LINE No description available.
X-Spam-Flag: NO

Page URL

No response

Steps To reproduce

No response

Your GLPI setup information

[code]   GLPI 9.5.7 ( => /home/administrator/public_html/glpi) Installation mode: TARBALL Current language:pt_BR

Operating system: Linux srv01vps.agante.com.br 3.10.0-1160.53.1.el7.x86_64 #1 SMP Fri Jan 14 13:59:45 UTC 2022 x86_64 PHP 8.0.20 fpm-fcgi (Core, PDO, PDO_ODBC, Phar, Reflection, SPL, SimpleXML, Zend OPcache, bcmath, bz2, calendar, cgi-fcgi, ctype, curl, date, dba, dom, enchant, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imap, intl, json, ldap, libxml, mbstring, memcached, mysqli, mysqlnd, odbc, openssl, pcntl, pcre, pdo_mysql, pdo_sqlite, posix, pspell, session, shmop, soap, sockets, sodium, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, xml, xmlreader, xmlwriter, xsl, zip, zlib) Setup: max_execution_time="30" memory_limit="128M" post_max_size="8M" safe_mode="" session.save_handler="files" upload_max_filesize="2M" Software: Apache () Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36 Server Software: MariaDB Server Server Version: 10.3.35-MariaDB Server SQL Mode: Parameters: glpi@162.241.102.45/glpi Host info: 162.241.102.45 via TCP/IP PHP version is at least 7.2.0 - Perfect! Sessions support is available - Perfect! Allocated memory > 64 Mio - Perfect! mysqli extension is installed ctype extension is installed fileinfo extension is installed json extension is installed mbstring extension is installed iconv extension is installed zlib extension is installed curl extension is installed gd extension is installed simplexml extension is installed intl extension is installed ldap extension is installed apcu extension is not present Zend OPcache extension is installed xmlrpc extension is not present exif extension is installed zip extension is installed bz2 extension is installed sodium extension is installed Database version seems correct (10.3.35) - Perfect! Timezones seems loaded in database The log file has been created successfully. Write access to /home/administrator/public_html/glpi/files/_cache has been validated. Write access to /home/administrator/public_html/glpi/config has been validated. Write access to /home/administrator/public_html/glpi/files/_cron has been validated. Write access to /home/administrator/public_html/glpi/files has been validated. Write access to /home/administrator/public_html/glpi/files/_dumps has been validated. Write access to /home/administrator/public_html/glpi/files/_graphs has been validated. Write access to /home/administrator/public_html/glpi/files/_lock has been validated. Write access to /home/administrator/public_html/glpi/files/_pictures has been validated. Write access to /home/administrator/public_html/glpi/files/_plugins has been validated. Write access to /home/administrator/public_html/glpi/files/_rss has been validated. Write access to /home/administrator/public_html/glpi/files/_sessions has been validated. Write access to /home/administrator/public_html/glpi/files/_tmp has been validated. Write access to /home/administrator/public_html/glpi/files/_uploads has been validated. Write access to /home/administrator/public_html/glpi/marketplace has been validated. Web access to files directory is protected

Anything else?

No response

cedric-anne commented 2 years ago

Hi,

I copy/pasted your headers, changed to Content-Type: text/plain; charset=utf-8 and add some body lines, and succeed to create a ticket from the corresponding email. I made the test on GLPI 9.5.8, with both PHP 7.2.34 and 8.0.21.

Could you please provide a complete eml file that can be used to reproduce the issue ?

Edgar-GC-Junior commented 2 years ago

Erro no evento S2200, S2206 e S2230 (1).zip

Hi Cedric-anne.

Please find the attached file.

Thank you!!

cedric-anne commented 2 years ago

As far as I understand, e-mail headers should only contains US-ASCII chars (see https://datatracker.ietf.org/doc/html/rfc2822#section-2.2).

Problem here is that the X-Ham-Report header of your email contains special chars (in está pendente já há algum tempo – Está impactando string). We are using an external lib to fetch emails, and I doubt we would be able to change their policy to accept "invalid" chars (see https://github.com/laminas/laminas-mail/blob/2.16.x/src/Header/HeaderValue.php#L64 ). You may try to open an issue or a PR on their repository. If a fix is accepted, we would be able to include it in a future version of GLPI.

You may also try to report this issue to your antispam solution editor.

I am closing this issue as we cannot do anything for this on GLPI side.