userjack6880 / Open-Report-Parser

A Perl based tool to parse DMARC reports from an IMAP mailbox or from the filesystem, and insert the information into a database. Derived from Techsneeze's dmarcts-report-parser
GNU General Public License v3.0
33 stars 9 forks source link

[Question]: Postgres error when oauth2 is enabled + gmail #30

Open teopiso opened 6 months ago

teopiso commented 6 months ago

Hi,

I'm trying to connect to the imap server using oauth2 but i receive de following message, i'm using postgres 13.11:

  Open Report Parser
  Version 0 Alpha 5
-------------
Open Report Parser DEBUG ENABLED
-- Script Options --

Report Source:   0
(0: IMAP, 1: Message, 2: XML, 3: MBOX, 4: ZIP, 5: JSON)
Show Processed:   0
Delete Reports:   0
Delete Failed:    0
Replace Reports:  0
DMARC Only:       1
(0: DMARC\TLS, 1: DMARC Only, -1: TLS Only)

-- Database Options --

DB Type:          postgres
DB Name:          dmarc
DB User:          dmarc
DB Host/Port:     localhost:5432
DB TX Support:    1

Max XML Size:     50000
Max JSON Size:    50000
Compress XML:     0
Compress JSON:    0

-- IMAP Options --

IMAP Server:      imap.gmail.com
IMAP Port:        993
TLS:              0
SSL:              1
TLS Verify:       0
IMAP User:        xxx@xxxx.xxx
IMAP Ignore Err:  0
IMAP Auth:        oauth2
Oauth2 URI:       https://accounts.google.com/o/oauth2/v2/auth
OAuth2 Client ID: xxxxxxx
DMARC Folders:
   Reports:       inbox
TLS Folders:
   Reports:       tls
----

--- DEBUG ---
  using ssl without verify servercert.
-------------

--- DEBUG ---
  connection to imap.gmail.com with Ssl => 1, User => xxx@xxxx.xxx, Ignoresizeerrors => 0
-------------
Started at Wed Mar 13 14:49:35 2024
Using Mail::IMAPClient version 3.43 on perl 5.026003
Connecting with IO::Socket::SSL PeerAddr imap.gmail.com PeerPort 993 Proto tcp Timeout 600 Debug 1 SSL_verify_mode 0
Connected to imap.gmail.com
Read:   * OK Gimap ready for requests from xxx.xxx.xxx.xxx xxxxxxxxxx

--- DEBUG ---
  using oauth2
-------------
DBD::Pg::st execute failed: ERROR:  relation "oauth" does not exist
LINE 1: ...ken, UNIX_TIMESTAMP(expire) AS expire, valid FROM oauth WHER...
                                                             ^ at lib/OAuth.pm line 63.
DBD::Pg::st fetchrow_hashref failed: no statement executing at lib/OAuth.pm line 64.
no token found, requesting
Wide character in subroutine entry at lib/OAuth.pm line 172.

Any suggestion?