Skip to content

Commit 4bb81fb

Browse files
authored
Merge pull request #10 from userjack6880/dev
Dev to Main
2 parents a4b80cf + fe130fd commit 4bb81fb

File tree

11 files changed

+409
-166
lines changed

11 files changed

+409
-166
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ A clear and concise description of what you expected to happen.
2424
If applicable, add screenshots to help explain your problem.
2525

2626
**Software Version**
27+
[] Version 0 Alpha 3
2728
[] Version 0 Alpha 2
28-
[] Version 0 Alpha 1
2929

3030
**Server (please complete the following information):**
3131
- Server OS [e.g. CentOS 7.3]

.github/ISSUE_TEMPLATE/critical_report.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ A clear and concise description of what you expected to happen.
2424
If applicable, add screenshots to help explain your problem.
2525

2626
**Software Version**
27+
[] Version 0 Alpha 3
2728
[] Version 0 Alpha 2
28-
[] Version 0 Alpha 1
29+
[] Other
2930

3031
**Server (please complete the following information):**
3132
- Server OS [e.g. CentOS 7.3]

README.md

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A Perl based tool to parse DMARC reports, based on John Levine's [rddmarc](http:
88

99
Open Report Parser is a fork of [techsneeze's dmarcts-report-parser](https://github.com/techsneeze/dmarcts-report-parser), and was forked to more closely match the needs of [Open DMARC Analyzer](https://github.com/userjack6880/Open-DMARC-Analyzer).
1010

11-
Open Report Parser Version 0 Alpha 1 (0-α2) is an [Anomaly \<Codebase\>](https://systemanomaly.com/codebase) project by John Bradley ([email protected]).
11+
Open Report Parser Version 0 Alpha 3 (0-α3) is an [Anomaly \<Codebase\>](https://systemanomaly.com/codebase) project by John Bradley ([email protected]).
1212

1313
# Minimum Requirements
1414

@@ -23,7 +23,7 @@ Open Report Parser Version 0 Alpha 1 (0-α2) is an [Anomaly \<Codebase\>](https:
2323
```
2424
apt-get install libfile-mimeinfo-perl libmail-imapclient-perl libmime-tools-perl libxml-simple-perl \
2525
libio-socket-inet6-perl libio-socket-ip-perl libperlio-gzip-perl \
26-
libmail-mbox-messageparser-perl unzip
26+
libmail-mbox-messageparser-perl libwww-perl unzip
2727
```
2828

2929
- For MySQL: `libdbd-mysql-perl`
@@ -34,7 +34,7 @@ libmail-mbox-messageparser-perl unzip
3434

3535
```
3636
sudo dnf install perl-File-MimeInfo perl-Mail-IMAPClient perl-MIME-tools perl-XML-Simple perl-DBI \
37-
perl-Socket6 perl-PerlIO-gzip unzip
37+
perl-Socket6 perl-PerlIO-gzip perl-libwww-perl unzip
3838
```
3939

4040
- For MySQL: `perl-DBD-MySQL`
@@ -45,7 +45,7 @@ perl-Socket6 perl-PerlIO-gzip unzip
4545
```
4646
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
4747
yum install perl-File-MimeInfo perl-Mail-IMAPClient perl-MIME-tools perl-XML-Simple perl-DBI \
48-
perl-Socket6 perl-PerlIO-gzip unzip perl-Mail-Mbox-MessageParser
48+
perl-Socket6 perl-PerlIO-gzip perl-libwww-perl unzip perl-Mail-Mbox-MessageParser
4949
```
5050

5151
- For MySQL: `perl-DBD-MySQL`
@@ -54,7 +54,7 @@ perl-Socket6 perl-PerlIO-gzip unzip perl-Mail-Mbox-MessageParser
5454
## on FreeBSD (FreeBSD 11.4)
5555

5656
```
57-
sudo pkg install p5-File-MimeInfo p5-Mail-IMAPClient p5-MIME-tools p5-XML-Simple p5-DBI p5-Socket6 p5-PerlIO-gzip p5-Mail-Mbox-MessageParser unzip
57+
sudo pkg install p5-File-MimeInfo p5-Mail-IMAPClient p5-MIME-tools p5-XML-Simple p5-DBI p5-Socket6 p5-PerlIO-gzip p5-Mail-Mbox-MessageParser p5-libwww unzip
5858
```
5959

6060
- For MySQL: `p5-DBD-MySQL`
@@ -68,6 +68,7 @@ update-mime-database /usr/local/share/mime
6868
perl -MCPAN -e 'install Mail::IMAPClient'
6969
perl -MCPAN -e 'install Mail::Mbox::MessageParser'
7070
perl -MCPAN -e 'install File::MimeInfo'
71+
perl -MCPAN -e 'install LWP::UserAgent
7172
```
7273

7374
- For MySQL: `perl -MCPAN -e 'install DBD::mysql'`
@@ -127,6 +128,11 @@ $imapssl = '0'; # If set to 1, remember to change server port to 993 an
127128
$imaptls = '0';
128129
$tlsverify = '0';
129130
$imapignoreerror = '0'; # recommended if you use MS Exchange 2007, ...
131+
#$imapauth = 'simple'; # supported - simple, oauth2 - defaults to simple if unset
132+
133+
# see documentation for detailed setup
134+
#$oauthclientid = '';
135+
#$oauthuri = '';
130136

131137
$imapdmarcfolder = 'dmarc';
132138
$imaptlsfolder = 'tls';
@@ -142,7 +148,9 @@ $imaptlsfolder = 'tls';
142148
# $imaptlserr = 'tls.notProcessed';
143149
```
144150

145-
These settings are ignored when using the -m flag.
151+
These settings are ignored when using the -m flag. When using SSL, TLS needs to be disabled and the port used should be changed to 993. TLS Verify is ignored.
152+
153+
Setting `$imapauth` to 'oauth2' enables OAuth2 authentication, and requires an initial dance to verify the application with your provider. Once this is done, it should be able to renew the token automatically on subsequent runs. Currently, only OAuth2 with M365 has been tested.
146154

147155
**XML Storage Options**
148156

@@ -207,16 +215,15 @@ Currently, processing of both DMARC and TLS reports during the same run is only
207215

208216
# Latest Changes
209217

210-
## 0-α2
211-
- Fixed errors in previous release incorporating postgres support related to table creation.
212-
- Added MTA-TLS report support.
213-
- More useful debug output.
214-
- Code consolodation (eg, subroutine repetative code).
218+
## 0-α3
219+
- Postgres fixes (and validation). Fixes Issue #8.
220+
- Initial Oauth2 Support code (untested).
215221

216222
# Tested System Configurations
217-
| OS | Perl | SQL |
218-
| ----------- | --------- | --------------- |
219-
| Debian 11.6 | Perl 5.32 | MariaDB 10.5.18 |
223+
| OS | Perl | SQL | Source |
224+
| ----------- | --------- | --------------- | ------------------------------- |
225+
| Debian 11.6 | Perl 5.32 | MariaDB 10.5.18 | Postfix/Dovecot IMAP Basic Auth |
226+
| Debian 11.6 | Perl 5.32 | PostgreSQL 13.9 | Postfix/Dovecot IMAP Basic Auth |
220227

221228
# Release Cycle and Versioning
222229

@@ -228,8 +235,9 @@ Support will be provided as outlined in the following schedule. For more details
228235

229236
| Version | Support Level | Released | End of Support | End of Life |
230237
| ----------------------------------- | ---------------- | ---------------- | ---------------- | ---------------- |
231-
| Version 1 Alpha 2 | Full Support | 26 April 2023 | TBD | TBD |
232-
| Version 1 Alpha 1 | Critical Support | 19 April 2023 | 26 April 2023 | TBD |
238+
| Version 1 Alpha 3 | Full Support | 25 May 2023 | TBD | TBD |
239+
| Version 1 Alpha 2 | Critical Support | 26 April 2023 | 25 May 2023 | TBD |
240+
| Version 1 Alpha 1 | End of Life | 19 April 2023 | 26 April 2023 | 25 May 2023 |
233241

234242
# Contributing
235243

dbx_mysql.pl

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# -----------------------------------------------------------------------------
22
#
3-
# Open Report Parser - Open Source DMARC report parser
3+
# Open Report Parser - Open Source report parser
44
# Copyright (C) 2023 John Bradley (userjack6880)
55
# Copyright (C) 2016 TechSneeze.com
66
# Copyright (C) 2012 John Bieling
77
#
8-
# report-parser.pl
9-
# main script
8+
# dbx_mysql.pl
9+
# mysql db module
1010
#
1111
# Available at: https://github.com/userjack6880/Open-Report-Parser
1212
#
@@ -27,35 +27,6 @@
2727
# this program. If not, see <https://www.gnu.org/licenses/>.
2828
#
2929
# -----------------------------------------------------------------------------
30-
#
31-
# The subroutines storeXMLInDatabase() and getXMLFromMessage() are based on
32-
# John R. Levine's rddmarc (http://www.taugh.com/rddmarc/). The following
33-
# special conditions apply to those subroutines:
34-
#
35-
# Copyright 2012, Taughannock Networks. All rights reserved.
36-
#
37-
# Redistribution and use in source and binary forms, with or without
38-
# modification, are permitted provided that the following conditions are met:
39-
#
40-
# Redistributions of source code must retain the above copyright notice, this
41-
# list of conditions and the following disclaimer.
42-
#
43-
# Redistributions in binary form must reproduce the above copyright notice, this
44-
# list of conditions and the following disclaimer in the documentation and/or
45-
# other materials provided with the distribution.
46-
#
47-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
48-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
50-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
51-
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52-
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
53-
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
54-
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
55-
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
56-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57-
#
58-
# -----------------------------------------------------------------------------
5930

6031
%dbx = (
6132
epoch_to_timestamp_fn => 'FROM_UNIXTIME',
@@ -143,7 +114,19 @@
143114
additional_definitions => "KEY serial (serial, send_ip), KEY serial6 (serial, send_ip6)",
144115
table_options => "",
145116
indexes => [],
146-
}
117+
},
118+
"oauth" => {
119+
column_definitions => [
120+
"id" , "int" , "unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY",
121+
"access_token" , "varchar(4096)" , "",
122+
"refresh_token" , "varchar(1024)" , "",
123+
"expire" , "timestamp" , "NOT NULL",
124+
"valid" , "int" , "unsigned NOT NULL",
125+
],
126+
additional_definitions => "",
127+
table_options => "",
128+
indexes => [],
129+
}
147130
},
148131

149132
add_column => sub {

dbx_postgres.pl

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# Copyright (C) 2016 TechSneeze.com
66
# Copyright (C) 2012 John Bieling
77
#
8-
# report-parser.pl
9-
# main script
8+
# dbx_postgres.pl
9+
# postgres db module
1010
#
1111
# Available at: https://github.com/userjack6880/Open-Report-Parser
1212
#
@@ -27,35 +27,6 @@
2727
# this program. If not, see <https://www.gnu.org/licenses/>.
2828
#
2929
# -----------------------------------------------------------------------------
30-
#
31-
# The subroutines storeXMLInDatabase() and getXMLFromMessage() are based on
32-
# John R. Levine's rddmarc (http://www.taugh.com/rddmarc/). The following
33-
# special conditions apply to those subroutines:
34-
#
35-
# Copyright 2012, Taughannock Networks. All rights reserved.
36-
#
37-
# Redistribution and use in source and binary forms, with or without
38-
# modification, are permitted provided that the following conditions are met:
39-
#
40-
# Redistributions of source code must retain the above copyright notice, this
41-
# list of conditions and the following disclaimer.
42-
#
43-
# Redistributions in binary form must reproduce the above copyright notice, this
44-
# list of conditions and the following disclaimer in the documentation and/or
45-
# other materials provided with the distribution.
46-
#
47-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
48-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
50-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
51-
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52-
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
53-
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
54-
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
55-
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
56-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57-
#
58-
# -----------------------------------------------------------------------------
5930

6031
%dbx = (
6132
epoch_to_timestamp_fn => 'TO_TIMESTAMP',
@@ -150,8 +121,8 @@
150121
additional_definitions => "PRIMARY KEY (id)",
151122
table_options => "",
152123
indexes => [
153-
"CREATE INDEX tlsrecord_idx_serial ON tlsrecord (serial, ip);",
154-
"CREATE INDEX tlsrecord_idx_serial6 ON tlsrecord (serial, ip6);",
124+
"CREATE INDEX tlsrecord_idx_serial ON tlsrecord (serial, send_ip);",
125+
"CREATE INDEX tlsrecord_idx_serial6 ON tlsrecord (serial, send_ip6);",
155126
],
156127
}
157128
},

docs/CHANGELOG.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# Changelog
22

3-
## 0-α1
4-
- Fork renamed
5-
- Incorporate changes made to original repository after fork ([commit 51ba1de](https://github.com/userjack6880/Open-Report-Parser/commit/51ba1de8521559647ebe4b8a1db291c26b572de4))
3+
## 0-α3
4+
- Postgres fixes (and validation). Fixes Issue #8.
5+
- Initial Oauth2 Support code (untested).
66

77
## 0-α2
88
- Fixed errors in previous release incorporating postgres support related to table creation.
99
- Added MTA-TLS report support.
1010
- More useful debug output.
11-
- Code consolodation (eg, subroutine repetative code).
11+
- Code consolodation (eg, subroutine repetative code).
12+
13+
## 0-α1
14+
- Fork renamed
15+
- Incorporate changes made to original repository after fork ([commit 51ba1de](https://github.com/userjack6880/Open-Report-Parser/commit/51ba1de8521559647ebe4b8a1db291c26b572de4))

docs/SECURITY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ Open DMARC Analyzer Version Security Support
2020

2121
| Version | Supported | End of Life |
2222
| -------------------------- | --------- | ---------------- |
23+
| Version 0 Alpha 3 | YES | TBD |
2324
| Version 0 Alpha 2 | YES | TBD |
24-
| Version 0 Alpha 1 | YES | TBD |
25+
| Version 0 Alpha 1 | YES | 25 May 2023 |

docs/SUPPORT.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ Due to the limited time available to developrs to maintain support, dates must b
44

55
| Version | Support Level | Released | End of Support | End of Life |
66
| ----------------------------------- | ---------------- | ---------------- | ---------------- | ---------------- |
7-
| Version 1 Alpha 2 | Full Support | 26 April 2023 | TBD | TBD |
8-
| Version 1 Alpha 1 | Critical Support | 19 April 2023 | 26 April 2023 | TBD |
7+
| Version 1 Alpha 3 | Full Support | 25 May 2023 | TBD | TBD |
8+
| Version 1 Alpha 2 | Critical Support | 26 April 2023 | 25 May 2023 | TBD |
9+
| Version 1 Alpha 1 | End of Life | 19 April 2023 | 26 April 2023 | 25 May 2023 |
910

1011
# Support Cycle
1112

0 commit comments

Comments
 (0)