Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailinabox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mailinabox
Commits
610be9cf
Commit
610be9cf
authored
May 20, 2015
by
Joshua Tauberer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
record current TLS settings from my box
parent
eb5e8fe3
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
518 additions
and
0 deletions
+518
-0
tls.py
tests/tls.py
+107
-0
tls_results.txt
tests/tls_results.txt
+411
-0
No files found.
tests/tls.py
0 → 100644
View file @
610be9cf
#!/usr/bin/python3
# Runs SSLyze on the TLS endpoints of a box and outputs
# the results so we can inspect the settings and compare
# against a known good version in tls_results.txt.
#
# Make sure you have SSLyze available:
# wget https://github.com/nabla-c0d3/sslyze/releases/download/release-0.11/sslyze-0_11-linux64.zip
# unzip sslyze-0_11-linux64.zip
#
# Then run:
#
# python3 tls.py yourservername
#
# If you are on a residential network that blocks outbound
# port 25 connections, then you can proxy the connections
# through some other host you can ssh into (maybe the box
# itself?):
#
# python3 --proxy user@ssh_host yourservername
#
# (This will launch "ssh -N -L10023:yourservername:testport user@ssh_host"
# to create a tunnel.)
import
sys
,
subprocess
,
re
,
time
######################################################################
# PARSE COMMAND LINE
proxy
=
None
args
=
list
(
sys
.
argv
[
1
:])
while
len
(
args
)
>
0
:
if
args
[
0
]
==
"--proxy"
:
args
.
pop
(
0
)
proxy
=
args
.
pop
(
0
)
break
if
len
(
args
)
==
0
:
print
(
"Usage: python3 tls.py [--proxy ssh_host] hostname"
)
sys
.
exit
(
0
)
host
=
args
[
0
]
######################################################################
SSLYZE
=
"sslyze-0_11-linux64/sslyze/sslyze.py"
common_opts
=
[
"--sslv2"
,
"--sslv3"
,
"--tlsv1"
,
"--tlsv1_1"
,
"--tlsv1_2"
,
"--reneg"
,
"--resum"
,
"--hide_rejected_ciphers"
,
"--compression"
,
"--heartbleed"
]
######################################################################
def
sslyze
(
opts
,
port
):
# Print header.
header
=
(
"PORT
%
d"
%
port
)
print
(
header
)
print
(
"-"
*
(
len
(
header
)))
connection_string
=
host
+
":"
+
str
(
port
)
# Proxy via SSH.
proxy_proc
=
None
if
proxy
:
connection_string
=
"localhost:10023"
proxy_proc
=
subprocess
.
Popen
([
"ssh"
,
"-N"
,
"-L10023:
%
s:
%
d"
%
(
host
,
port
),
proxy
])
time
.
sleep
(
3
)
try
:
# Execute SSLyze.
out
=
subprocess
.
check_output
([
SSLYZE
]
+
common_opts
+
opts
+
[
connection_string
])
out
=
out
.
decode
(
"utf8"
)
# Trim output to make better for storing in git.
if
"SCAN RESULTS FOR"
not
in
out
:
# Failed. Just output the error.
out
=
re
.
sub
(
"[
\
w
\
W]*CHECKING HOST
\
(S
\
) AVAILABILITY
\n
\
s*-+
\n
"
,
""
,
out
)
# chop off header that shows the host we queried
out
=
re
.
sub
(
"[
\
w
\
W]*SCAN RESULTS FOR.*
\n
\
s*-+
\n
"
,
""
,
out
)
# chop off header that shows the host we queried
out
=
re
.
sub
(
"SCAN COMPLETED IN .*"
,
""
,
out
)
out
=
out
.
rstrip
(
"
\n
-"
)
+
"
\n
"
# Print.
print
(
out
)
finally
:
if
proxy_proc
:
proxy_proc
.
terminate
()
try
:
proxy_proc
.
wait
(
5
)
except
TimeoutExpired
:
proxy_proc
.
kill
()
# Run SSLyze on various ports.
# SMTP
sslyze
([
"--starttls=smtp"
],
25
)
# SMTP Submission
sslyze
([
"--starttls=smtp"
],
587
)
# HTTPS
sslyze
([
"--http_get"
,
"--chrome_sha1"
,
"--hsts"
],
443
)
# IMAP
sslyze
([],
993
)
# POP3
sslyze
([],
995
)
tests/tls_results.txt
0 → 100644
View file @
610be9cf
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment