-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathssl_check.py
More file actions
30 lines (24 loc) · 853 Bytes
/
ssl_check.py
File metadata and controls
30 lines (24 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import argparse
import ssl
from http.server import HTTPServer, BaseHTTPRequestHandler
DEFAULT_PORT = 443
HOST = '0.0.0.0'
def main():
parser = argparse.ArgumentParser(
description='Check ssl certificates validity'
)
parser.add_argument('keyfile', type=str,
help='Path to private key file')
parser.add_argument('certfile',
help='Path to certfile')
parser.add_argument('--port', type=int, default=DEFAULT_PORT,
help='Port that server should listen')
args = parser.parse_args()
httpd = HTTPServer((HOST, args.port), BaseHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(
httpd.socket,
keyfile=args.keyfile,
certfile=args.certfile, server_side=True)
httpd.serve_forever()
if __name__ == '__main__':
main()