Skip to content

Commit

Permalink
set TLS min/max versions with SSL
Browse files Browse the repository at this point in the history
  • Loading branch information
YellowRoseCx committed Dec 23, 2023
1 parent 76eb691 commit b85d59e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions koboldcpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,10 +995,13 @@ def run(self):

if args.ssl and sslvalid:
import ssl
tlscontext = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
tlscontext.minimum_version = ssl.TLSVersion.TLSv1_2
tlscontext.maximum_version = ssl.TLSVersion.TLSv1_3
certpath = os.path.abspath(args.ssl[0])
keypath = os.path.abspath(args.ssl[1])
self.httpd.socket = ssl.wrap_socket(self.httpd.socket, keyfile=keypath, certfile=certpath, server_side=True)

tlscontext.load_cert_chain(certfile=certpath, keyfile=keypath)
self.httpd.socket = tlscontext.wrap_socket(self.httpd.socket, server_side=True)
self.httpd.serve_forever()
except (KeyboardInterrupt,SystemExit):
exitcounter = 999
Expand Down

0 comments on commit b85d59e

Please sign in to comment.