Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print connection SSL/TLS version #157

Merged
merged 7 commits into from
Aug 24, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,24 @@ func visit(url *url.URL) {
log.Fatalf("failed to read response: %v", err)
}

// Print SSL/TLS version which is used for connection
connectedVia := "plaintext (unsecure)"
if resp.TLS != nil {
switch resp.TLS.Version {
case tls.VersionSSL30:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try

case tls.VersionSSL30: //lint:ignore SA1019

It might require a comment after the ignore SA1019 but I cannot think of one. Honestly I'm more tempted to adjust the TLSConfig settings to never negotiate this setting so we don't have to check for it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Please retest

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dpanic if your last change doesn't work, maybe try the syntax shown here:

https://stackoverflow.com/a/66291436/903870

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thank you, waiting for you guys to check CI/CD

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed SSLv3.
Added TSLv1.0 as minimum version for connection.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davecheney probably you missed my commits. Please take look at it now

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atc0005 this is done. Please review

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dpanic I'm an observer of the project (actively learning/improving Go skills) and not directly associated with it. I thought I saw a potential opportunity to assist and spoke up. Apologies if I gave an impression otherwise.

connectedVia = "SSLv3"
case tls.VersionTLS10:
connectedVia = "TLSv1.0"
case tls.VersionTLS11:
connectedVia = "TLSv1.1"
case tls.VersionTLS12:
connectedVia = "TLSv1.2"
case tls.VersionTLS13:
connectedVia = "TLSv1.3"
}
}
printf("\n%s %s\n", color.GreenString("Connected via"), color.CyanString("%s", connectedVia))

bodyMsg := readResponseBody(req, resp)
resp.Body.Close()

Expand Down