moved certificate content acquisition from ClientManagementLogic to ClientInfoLogic

This commit is contained in:
vladimir.kuznetsov 2023-01-17 21:04:15 +03:00
parent f6e8346841
commit d6d3bf6943
7 changed files with 41 additions and 23 deletions

View file

@ -87,19 +87,11 @@ ErrorCode ClientManagementLogic::getClientsList(const ServerCredentials &credent
for (auto &openvpnCertId : certsIds) {
openvpnCertId.replace(".crt", "");
if (!clientsTable.contains(openvpnCertId)) {
stdOut.clear();
const QString getOpenVpnCertData = QString("sudo docker exec -i $CONTAINER_NAME bash -c 'cat /opt/amnezia/openvpn/pki/issued/%1.crt'")
.arg(openvpnCertId);
script = m_serverController->replaceVars(getOpenVpnCertData, m_serverController->genVarsForScript(credentials, container));
error = m_serverController->runScript(credentials, script, cbReadStdOut);
if (error != ErrorCode::NoError) {
return error;
}
QJsonObject client;
client["openvpnCertId"] = openvpnCertId;
client["clientName"] = QString("Client %1").arg(count);
client["openvpnCertData"] = stdOut;
client["openvpnCertData"] = "";
clientsTable[openvpnCertId] = client;
count++;
}