Created
August 19, 2019 08:22
-
-
Save listm/6df7df5b7eba414c8fd79aaa50f6653f to your computer and use it in GitHub Desktop.
Checks if tls request contains successful oscp response, needs sslyze installed. Can be used as a nagios plugin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
import sys | |
def check_ocsp(servername, port=443): | |
from sslyze.plugins.certificate_info_plugin import CertificateInfoScanCommand, OcspResponseStatusEnum | |
from sslyze.synchronous_scanner import SynchronousScanner | |
from sslyze.server_connectivity_tester import ServerConnectivityTester | |
server_tester = ServerConnectivityTester(hostname=servername, port=port) | |
server_info = server_tester.perform() | |
synchronous_scanner = SynchronousScanner() | |
command = CertificateInfoScanCommand() | |
scan_result = synchronous_scanner.run_scan_command(server_info, command) | |
print(scan_result.ocsp_response) | |
assert(scan_result.ocsp_response_status == OcspResponseStatusEnum.SUCCESSFUL) | |
exit(0) | |
if __name__ == '__main__': | |
assert(len(sys.argv) > 1) | |
check_ocsp(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment