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

Add support for client authentication, some minor refactoring #179

Merged
merged 42 commits into from
Mar 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
e16dd24
Added test for required Client Authentication and whether the certs a…
echudow Oct 11, 2018
c9263c0
Merge remote-tracking branch 'dhs/develop' into develop
jsf9k Nov 13, 2018
1b6a00b
Merge remote-tracking branch 'dhs/develop' into develop
jsf9k Nov 23, 2018
716292c
Update test to match @echudow's new code
jsf9k Nov 23, 2018
48bbf90
Add missing commas
jsf9k Nov 23, 2018
5d293ae
Fix test to agree with latest code
jsf9k Nov 23, 2018
9a84999
This time the test is really fixed!
jsf9k Nov 23, 2018
63061cc
Get rid of some warnings about using the deprecated logging.warn()
jsf9k Nov 23, 2018
836fa98
Fix a bunch of warnings that flake8 complains about
jsf9k Nov 23, 2018
a2f994c
Fix test
jsf9k Nov 23, 2018
16e1aaa
Bump version from 0.5.2 to 0.6.0
jsf9k Nov 30, 2018
cb6aba4
Fixed bug that prevents following some http redirects
echudow Dec 18, 2018
2b9eaf6
Fixed http redirect bug, added IP and Server info
echudow Dec 18, 2018
2cfa294
Merge branch 'develop' of https://github.com/echudow/pshtt into develop
echudow Dec 18, 2018
d450666
Make flake8 happier
jsf9k Dec 18, 2018
a32a975
Fix "to CSV" test
jsf9k Dec 18, 2018
cf2421a
Trying to make flake8 happy
echudow Dec 18, 2018
0a2e47e
Remove trailing whitespace
jsf9k Dec 18, 2018
ebe6bf6
Fixed bug in domain_enforces_https for redirect domains
echudow Dec 28, 2018
20885bb
Merge branch 'develop' of https://github.com/echudow/pshtt into develop
echudow Dec 28, 2018
e30da22
Correct CLI test to match output changes from @echudow's latest commit
jsf9k Dec 28, 2018
a65544b
Fix bug in handling some TLS handshake errors
echudow Jan 21, 2019
e843ca2
Merge branch 'develop' of https://github.com/echudow/pshtt into develop
echudow Jan 21, 2019
587f431
Added recheck for sslyze if first request worked
echudow Jan 23, 2019
364cd50
Fixed HTTPS Valid to account for errors better
echudow Jan 24, 2019
ba780fa
Allow for Unknown in cert fields
echudow Jan 25, 2019
4e20c97
Fixed missing not
echudow Jan 25, 2019
88fd78e
Using canonical endpoint for cert checks
echudow Jan 27, 2019
bbbce65
Added missing intermediate CA checking for public trust
echudow Mar 7, 2019
f049bb5
Have custom trust as unknown if no custom trust store
echudow Mar 8, 2019
ffe02c4
Merge branch 'develop' into develop
jsf9k Mar 8, 2019
a0ffba9
Merge branch 'develop' into develop
jsf9k Mar 11, 2019
3ed17e9
Make flake8 happy
jsf9k Mar 11, 2019
4f8687c
Make flake8 happy
jsf9k Mar 11, 2019
2aaf61a
Make failing test pass
jsf9k Mar 11, 2019
1ef2170
Make failing test pass
jsf9k Mar 11, 2019
204c8a7
Remove code that was setting fields with value None to "Unknown"
jsf9k Mar 18, 2019
0938c7b
Change 'Unknown' to None in test
jsf9k Mar 18, 2019
52b9c7b
Modify list comprehension in test to handle None
jsf9k Mar 18, 2019
d32198a
Rework the removal of "Unknown" from the pshtt result
jsf9k Mar 18, 2019
fbc318a
Add a comment warning about the tricky continue logic
jsf9k Mar 18, 2019
f20eca4
Remove some unnecessary pass statements that LGTM reported
jsf9k Mar 18, 2019
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
2 changes: 1 addition & 1 deletion pshtt/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.5.4'
__version__ = '0.6.0'
10 changes: 6 additions & 4 deletions pshtt/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""pshtt ("pushed") is a tool to test domains for HTTPS best practices.

Usage:
pshtt (INPUT ...) [--output OUTFILE] [--sorted] [--json] [--markdown] [--debug] [--timeout TIMEOUT] [--user-agent AGENT] [--cache-third-parties DIR] [--ca-file PATH]
pshtt (INPUT ...) [--output OUTFILE] [--sorted] [--json] [--markdown] [--debug] [--timeout TIMEOUT] [--user-agent AGENT] [--cache-third-parties DIR] [--ca-file PATH] [--pt-int-ca-file PATH]
pshtt (-h | --help)

Options:
Expand All @@ -17,6 +17,7 @@
-t --timeout=TIMEOUT Override timeout (in seconds).
-c --cache-third-parties=DIR Cache third party data, and what directory to cache it in.
-f --ca-file=PATH Specify custom CA bundle (PEM format)
-p --pt-int-ca-file=PATH Specify public trust CA bundle with intermediates (PEM format)

Notes:
If the first INPUT ends with .csv, domains will be read from CSV.
Expand Down Expand Up @@ -49,7 +50,7 @@ def to_csv(results, out_filename):
row = [result[header] for header in pshtt.HEADERS]
writer.writerow(row)

logging.warn("Wrote results to %s.", out_filename)
logging.warning("Wrote results to %s.", out_filename)


def to_json(results, out_filename):
Expand All @@ -62,7 +63,7 @@ def to_json(results, out_filename):
out_file.write(json_content + '\n')

if out_file is not sys.stdout:
logging.warn("Wrote results to %s.", out_filename)
logging.warning("Wrote results to %s.", out_filename)


def to_markdown(results, out_filename):
Expand Down Expand Up @@ -106,7 +107,8 @@ def main():
'user_agent': args['--user-agent'],
'timeout': args['--timeout'],
'cache-third-parties': args['--cache-third-parties'],
'ca_file': args['--ca-file']
'ca_file': args['--ca-file'],
'pt_int_ca_file': args['--pt-int-ca-file']
}

# Do the domain inspections
Expand Down
20 changes: 20 additions & 0 deletions pshtt/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ def __init__(self, protocol, host, base_domain):
self.headers = {} # will be replaced with a requests.structures.CaseInsensitiveDict
self.status = None
self.live = None
self.ip = None
self.redirect = None
self.server_header = None
self.server_version = None
self.unknown_error = False
self.notes = ""

# If an endpoint redirects, characterize the redirect behavior
self.redirect_immediately_to = None
Expand All @@ -55,11 +59,17 @@ def __init__(self, protocol, host, base_domain):
# Only HTTPS endpoints have these.
# Initialize all of them to None, so that it's
# discernible if they don't get explicitly set.
self.https_full_connection = None
self.https_client_auth_required = False
self.https_valid = None
self.https_public_trusted = None
self.https_custom_trusted = None
self.https_bad_chain = None
self.https_bad_hostname = None
self.https_expired_cert = None
self.https_self_signed_cert = None
self.https_cert_chain_len = None
self.https_missing_intermediate_cert = None
self.hsts = None
self.hsts_header = None
self.hsts_max_age = None
Expand All @@ -81,6 +91,7 @@ def to_object(self):
'url': self.url,
'headers': dict(self.headers),
'status': self.status,
'ip': self.ip,
'live': self.live,
'redirect': self.redirect,
'redirect_eventually_to': self.redirect_eventually_to,
Expand All @@ -94,15 +105,24 @@ def to_object(self):
'redirect_eventually_to_http': self.redirect_eventually_to_http,
'redirect_eventually_to_external': self.redirect_eventually_to_external,
'redirect_eventually_to_subdomain': self.redirect_eventually_to_subdomain,
'server_header': self.server_header,
'server_version': self.server_version,
'notes': self.notes,
'unknown_error': self.unknown_error,
}

if self.protocol == "https":
obj['https_full_connection'] = self.https_full_connection
obj['https_client_auth_required'] = self.https_client_auth_required
obj['https_valid'] = self.https_valid
obj['https_public_trusted'] = self.https_public_trusted
obj['https_custom_trusted'] = self.https_custom_trusted
obj['https_bad_chain'] = self.https_bad_chain
obj['https_bad_hostname'] = self.https_bad_hostname
obj['https_expired_cert'] = self.https_expired_cert
obj['https_self_signed_cert'] = self.https_self_signed_cert
obj['https_cert_chain_len'] = self.https_cert_chain_len
obj['https_missing_intermediate_cert'] = self.https_missing_intermediate_cert
obj['hsts'] = self.hsts
obj['hsts_header'] = self.hsts_header
obj['hsts_max_age'] = self.hsts_max_age
Expand Down
Loading