anzeige des zertifikates in eigener funktion

This commit is contained in:
+++ 2023-10-21 21:04:29 +02:00
parent af78204005
commit 621c41dcd6

View file

@ -102,6 +102,15 @@ class SetStatus:
return False return False
return True return True
def display_cert(self, cert):
"""
param 1: cert object
"""
self.log.debug('--- Peer cert ---')
self.log.debug('Subject: {}'.format(cert['subject']))
self.log.debug('SerialNumber: {}'.format(cert['serialNumber']))
self.log.debug('-----------------')
def log_config(self): def log_config(self):
""" """
Logs the config if loglevel is debug. Logs the config if loglevel is debug.
@ -179,13 +188,9 @@ class SetStatus:
self.log.error('Connection failed: {}'.format(e)) self.log.error('Connection failed: {}'.format(e))
exit(5) exit(5)
self.log.debug('Conection established') self.log.debug('Conection established')
self.log.debug('Peer certificate commonName: {}'.format( self.display_cert(ssl_socket.getpeercert())
ssl_socket.getpeercert()['subject'][5][0][1]))
self.log.debug('Peer certificate serialNumber: {}'.format(
ssl_socket.getpeercert()['serialNumber']))
return ssl_socket return ssl_socket
def run(self, status): def run(self, status):
""" """
starts the engine. starts the engine.