Update server.py

This commit is contained in:
Nova Cat 2025-02-04 19:23:32 -08:00
parent 7754952d3c
commit fc88bc37f8

View file

@ -5,10 +5,6 @@ print("Welcome! /ᐠ ˵> ⩊ <˵マ")
import socket, time, ssl, threading, traceback, sys, subprocess, yaml, sqlite3, os, importlib, datetime import socket, time, ssl, threading, traceback, sys, subprocess, yaml, sqlite3, os, importlib, datetime
from OpenSSL import SSL from OpenSSL import SSL
from requests import get from requests import get
def verify_cb(conn, cert, errnum, depth, ok):
# This obviously has to be updated
print(f'Got certificate: {cert.get_subject()}')
return ok
if not len(sys.argv) == 2: if not len(sys.argv) == 2:
print("IRCat requires the following arguments: config.yml") print("IRCat requires the following arguments: config.yml")
sys.exit(1) sys.exit(1)
@ -849,8 +845,7 @@ def ssl_session(sock):
ip_to = restrict_ip ip_to = restrict_ip
ctx = SSL.Context(SSL.SSLv23_METHOD) ctx = SSL.Context(SSL.SSLv23_METHOD)
ctx.set_options(SSL.OP_NO_SSLv2) ctx.set_options(SSL.OP_NO_SSLv2)
ctx.set_verify(SSL.VERIFY_PEER, verify_cb) ctx.use_privatekey_file(ssl_pkey)
ctx.use_privatekey_file (ssl_pkey)
ctx.use_certificate_file(ssl_cert) ctx.use_certificate_file(ssl_cert)
conn = SSL.Connection(ctx, connection) conn = SSL.Connection(ctx, connection)
conn.set_accept_state() conn.set_accept_state()