Skip to content

Commit f193cef

Browse files
authored
Merge pull request #16 from steffenfritz/verifycheck
added VRFY check
2 parents e7da885 + 2ba29f7 commit f193cef

File tree

9 files changed

+35
-12
lines changed

9 files changed

+35
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
mxcheck
22
*.tar.gz
33
.DS_Store
4+
.idea

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
652652
If the program does terminal interaction, make it output a short
653653
notice like this when it starts in an interactive mode:
654654

655-
mxcheck Copyright (C) 2018 Steffen Fritz
655+
mxcheck Copyright (C) 2018-2023 Steffen Fritz
656656
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657657
This is free software, and you are welcome to redistribute it
658658
under certain conditions; type `show c' for details.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
22

33
BINARY=mxcheck
4-
VERSION=1.4.2
4+
VERSION=1.5.0
55

66
BUILD=`git rev-parse --short HEAD`
77
PLATFORMS=darwin linux windows

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ It checks
88
* the support of StartTLS and the certificate
99
* open ports: 25, 465, 587
1010
* if the service is listed by blacklists
11+
* if it leaks information by server string and VRFY command
1112
* and if the server is an open relay
1213

1314
You can set mailFrom, mailTo, the DNS server, DKIM selector and output a report in tsv format.
@@ -18,7 +19,7 @@ You can set mailFrom, mailTo, the DNS server, DKIM selector and output a report
1819
-f, --mailfrom string Set the mailFrom address (default "[email protected]")
1920
-t, --mailto string Set the mailTo address (default "[email protected]")
2021
-n, --no-prompt Answer yes to all questions
21-
-s, --service string The service host to check (default "localhost")
22+
-s, --service string The service host to check (mandatory flag)
2223
-S, --dkim-selector The DKIM selector. If set a dkim check is performed on the provided service domain
2324
-v, --version Version and license
2425
-w, --write-tsv Write tsv formated report to file
@@ -27,7 +28,7 @@ You can set mailFrom, mailTo, the DNS server, DKIM selector and output a report
2728

2829
# Version
2930

30-
v1.4.2
31+
v1.5.0
3132

3233
[![Go Report Card](https://goreportcard.com/badge/github.com/steffenfritz/mxcheck)](https://goreportcard.com/report/github.com/steffenfritz/mxcheck)
3334
[![Go Reference](https://pkg.go.dev/badge/github.com/steffenfritz/mxcheck.svg)](https://pkg.go.dev/github.com/steffenfritz/mxcheck)
@@ -47,9 +48,9 @@ or
4748

4849
./mxcheck -s 2600.com
4950
./mxcheck -s 2600.com -v
50-
./mxcheck -s 2600.com -v -d 8.8.8.8
51-
./mxcheck -s 2600.com -v -n -f [email protected] -t [email protected] -w -S default
52-
./mxcheck -s 2600.com -v -n -f [email protected] -t [email protected] -w -S default -b
51+
./mxcheck -s 2600.com -d 8.8.8.8
52+
./mxcheck -s 2600.com -n -f [email protected] -t [email protected] -w -S default
53+
./mxcheck -s 2600.com -n -f [email protected] -t [email protected] -w -S default -b
5354

5455
[![asciicast](https://asciinema.org/a/471229.svg)](https://asciinema.org/a/471229)
5556

main.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type mxresult struct {
4747
starttls bool
4848
tlscertvalid bool
4949
openrelay bool
50+
vrfysupport bool
5051
}
5152

5253
var (
@@ -274,11 +275,13 @@ func main() {
274275
WarningLogger.Println(err.Error())
275276
}
276277

278+
// Server string
277279
if len(orresult.serverstring) > 0 {
278280
InfoLogger.Printf("Server Banner: %s", orresult.serverstring)
279281
singlemx.serverstring = strings.ReplaceAll(orresult.serverstring, "\r\n", "")
280282
}
281283

284+
// TLS test
282285
singlemx.starttls = orresult.tlsbool
283286
if orresult.tlsbool {
284287
InfoLogger.Println(Green("StartTLS supported"))
@@ -295,19 +298,30 @@ func main() {
295298
InfoLogger.Println(Red("Certificate not valid"))
296299
}
297300

301+
// VRFY test
302+
singlemx.vrfysupport = orresult.vrfybool
303+
if orresult.vrfybool {
304+
InfoLogger.Println(Red("VRFY command supported."))
305+
} else {
306+
InfoLogger.Println(Green("VRFY command not supported."))
307+
}
308+
309+
// Sender accepted
298310
singlemx.fakesender = orresult.senderboolresult
299311
if orresult.senderboolresult {
300312
InfoLogger.Println("Fake sender accepted.")
301313
} else {
302314
InfoLogger.Println("Fake sender not accepted.")
303315
}
304316

317+
// Recipient accepted
305318
if orresult.rcptboolresult {
306319
InfoLogger.Println("Recipient accepted.")
307320
} else {
308321
InfoLogger.Println("Recipient not accepted. Skipped further open relay tests.")
309322
}
310323

324+
// Open Relay test
311325
if orresult.orboolresult {
312326
singlemx.openrelay = true
313327
InfoLogger.Println(Red("Server is probably an open relay"))

mxcheck.1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222
.\" %%%LICENSE_END
2323

2424

25-
.TH mxcheck 1 "November 2022" "version 1.4.2"
25+
.TH mxcheck 1 "February 2023" "version 1.5.0"
2626

2727
.SH NAME
2828
mxcheck
2929
.SH SYNOPSIS
3030
.B mxcheck [OPTION]
3131
.SH DESCRIPTION
3232
mxcheck is an info scanner for e-mail servers. It checks the following DNS records: A, MX, PTR, SPF, MTA-STS and DKIM.
33-
It also checks for StartTLS support and the validity of the certificate.
33+
It also checks for StartTLS support and the validity of the certificate and if the VRFY command is supported.
3434
After scanning the tcp ports 25, 465 and 587 mxcheck checks if the e-mail server is an open relay by trying to send a single message.
35-
It also checks whether the service is blacklisted.
35+
It also checks whether the service is blacklisted by querying public blacklist services.
3636

3737
.SH FLAGS
3838
mxcheck

openrelay.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type openResult struct {
2121
serverstring string
2222
tlsbool bool
2323
tlsvalid bool
24+
vrfybool bool
2425
}
2526

2627
// openRelay checks if a mail server sends email without
@@ -69,6 +70,12 @@ func openRelay(mailFrom string, mailTo string, targetHost string) (openResult, e
6970
}
7071
}
7172

73+
// Check if server supports VRFY command. The
74+
vrfyerr := c.Verify(mailFrom)
75+
if vrfyerr == nil {
76+
or.vrfybool = true
77+
}
78+
7279
// Set from value
7380
err = c.Mail(mailFrom)
7481
if err != nil {

output.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ func writeTSV(targetHostName string, runresult runresult, blacklist bool) error
5858
err = tsv.Write([]string{"MTA-STS Set", strconv.FormatBool(mxentry.stsset)})
5959
err = tsv.Write([]string{"STARTTLS Supported", strconv.FormatBool(mxentry.starttls)})
6060
err = tsv.Write([]string{"Certificate Valid", strconv.FormatBool(mxentry.tlscertvalid)})
61+
err = tsv.Write([]string{"VRFY Supported", strconv.FormatBool(mxentry.vrfysupport)})
6162
err = tsv.Write([]string{"Fake Sender Accepted", strconv.FormatBool(mxentry.fakesender)})
6263
err = tsv.Write([]string{"Fake Recipient Accepted", strconv.FormatBool(mxentry.fakercpt)})
6364
err = tsv.Write([]string{"Open Relay", strconv.FormatBool(mxentry.openrelay)})

versionmsg.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ package main
33
// Version is used by the Makefile to set the version
44
var Version string
55

6-
76
// Build is used by the Makefile to set the build, i.e. short git fingerprint
87
var Build string
98

10-
var info = "mxcheck -- Copyright (C) 2019-2022 Steffen Fritz -- "
9+
var info = "mxcheck -- Copyright (C) 2019-2023 Steffen Fritz -- "
1110

1211
var license = `This program comes with ABSOLUTELY NO WARRANTY.
1312
This is free software under GPL-3.0, and you are welcome to

0 commit comments

Comments
 (0)