use paths to the keys relative to the configuration path

This commit is contained in:
Sven Czarnian
2021-09-02 19:43:05 +02:00
parent d60d5cb716
commit b10fae513e

View File

@@ -50,11 +50,24 @@ class ReceiverThread(threading.Thread):
class Euroscope: class Euroscope:
# @brief Initializes the ZMQ socket # @brief Initializes the ZMQ socket
# @param[in] config The server configuration # @param[in] config The server configuration
def __init__(self, config : Server.Server): def __init__(self, configPath : str, config : Server.Server):
self.context = zmq.Context() self.context = zmq.Context()
# find the key directories
serverKeyPath = os.path.join(os.path.join(configPath, 'keys'), 'server')
if False == os.path.isdir(serverKeyPath):
sys.stderr.write('No directory for the server key found')
sys.exit(-1)
print('Path to the server key: ' + serverKeyPath)
clientKeyPath = os.path.join(os.path.join(configPath, 'keys'), 'clients')
if False == os.path.isdir(clientKeyPath):
sys.stderr.write('No directory for the client keys found')
sys.exit(-1)
print('Path to the client keys: ' + clientKeyPath)
# read the certificates # read the certificates
keyPairPath = glob.glob(os.path.join(config.ServerKeyPath, '*.key_secret')) keyPairPath = glob.glob(os.path.join(serverKeyPath, '*.key_secret'))
if 1 != len(keyPairPath): if 1 != len(keyPairPath):
sys.stderr.write('No public-private keypair found for the server certificate') sys.stderr.write('No public-private keypair found for the server certificate')
sys.exit(-1) sys.exit(-1)