Skip to content

Commit

Permalink
fixed serial number
Browse files Browse the repository at this point in the history
  • Loading branch information
pathtofile committed Sep 5, 2019
1 parent e71b9ab commit 94ec914
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ venv.bak/

# mypy
.mypy_cache/


.vscode/
4 changes: 3 additions & 1 deletion https/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import argparse
import socketserver
import tempfile
import random
from http.server import HTTPServer, SimpleHTTPRequestHandler
from functools import partial
from OpenSSL import crypto, SSL
Expand Down Expand Up @@ -70,7 +71,8 @@ def generate_cert():
cert.get_subject().ST = "Python SimpleHTTPSServer"
cert.get_subject().OU = "Python SimpleHTTPSServer"
cert.get_subject().CN = "Python SimpleHTTPSServer"
cert.set_serial_number(1000)
# Use a unique serial number
cert.set_serial_number(random.randint(1, 2147483647))
cert.gmtime_adj_notBefore(0)
# Expire cert after 1 year
cert.gmtime_adj_notAfter(365 * 24 * 60 * 60)
Expand Down

0 comments on commit 94ec914

Please sign in to comment.