chore: Change TLS dir to same as Qt config

This commit is contained in:
Nick Bolton
2024-10-14 16:06:05 +01:00
parent 3525b8a686
commit 9c4f6e6d0b
8 changed files with 21 additions and 20 deletions

View File

@ -440,7 +440,7 @@ void MainWindow::on_m_pLabelComputerName_linkActivated(const QString &) {
void MainWindow::on_m_pLabelFingerprint_linkActivated(const QString &) {
QMessageBox::information(
this, "SSL/TLS fingerprint", TlsFingerprint::local().readFirst());
this, "TLS fingerprint", TlsFingerprint::local().readFirst());
}
void MainWindow::on_m_pRadioGroupServer_clicked(bool) {

View File

@ -105,7 +105,7 @@ std::string ArchFileUnix::getProfileDirectory() {
dir = m_profileDirectory;
} else {
#if WINAPI_XWINDOWS
dir = getUserDirectory().append("/." DESKFLOW_APP_ID);
dir = getUserDirectory().append("/.config/" DESKFLOW_APP_NAME);
#else
dir = getUserDirectory().append("/Library/" DESKFLOW_APP_NAME);
#endif

View File

@ -23,8 +23,9 @@
#include <QStandardPaths>
#include <QString>
const auto kCertificateFilename = QString("%1.pem").arg(DESKFLOW_APP_NAME);
const auto kSslDir = "SSL";
// TODO: Reduce duplication of these strings between here and SecureSocket.cpp
const auto kCertificateFilename = QString("%1.pem").arg(DESKFLOW_APP_ID);
const auto kSslDir = "tls";
namespace deskflow::gui::paths {

View File

@ -22,10 +22,11 @@
#include <QDir>
#include <QTextStream>
static const char kDirName[] = "SSL/Fingerprints";
static const char kLocalFilename[] = "Local.txt";
static const char kTrustedServersFilename[] = "TrustedServers.txt";
static const char kTrustedClientsFilename[] = "TrustedClients.txt";
// TODO: Reduce duplication of these strings between here and SecureSocket.cpp
static const char kDirName[] = "tls";
static const char kLocalFilename[] = "local-fingerprint";
static const char kTrustedServersFilename[] = "trusted-servers";
static const char kTrustedClientsFilename[] = "trusted-clients";
TlsFingerprint::TlsFingerprint(const QString &filename)
: m_Filename(filename) {}

View File

@ -69,10 +69,10 @@ std::string SecureServerSocket::getCertificateFileName() const {
auto certificateFilename = ArgParser::argsBase().m_tlsCertFile;
if (certificateFilename.empty()) {
// default location of the TLS cert file in users dir
// TODO: Reduce duplication of these strings between here and
// SecureSocket.cpp
certificateFilename = deskflow::string::sprintf(
"%s/SSL/" DESKFLOW_APP_NAME ".pem",
ARCH->getProfileDirectory().c_str());
"%s/tls/" DESKFLOW_APP_ID ".pem", ARCH->getProfileDirectory().c_str());
}
return certificateFilename;

View File

@ -159,9 +159,9 @@ std::string SslApi::getFingerprint() const {
}
bool SslApi::isTrustedFingerprint(const std::string &fingerprint) const {
// TODO: Reduce duplication of these strings between here and SecureSocket.cpp
auto trustedServersFilename = deskflow::string::sprintf(
"%s/SSL/Fingerprints/TrustedServers.txt",
ARCH->getProfileDirectory().c_str());
"%s/tls/trusted-servers", ARCH->getProfileDirectory().c_str());
// check if this fingerprint exist
std::ifstream file;

View File

@ -25,8 +25,9 @@
#include "net/SocketMultiplexer.h"
#include "net/TSocketMultiplexerMethodJob.h"
static const char s_certificateDir[] = {"SSL"};
static const char s_certificateFilename[] = {DESKFLOW_APP_NAME ".pem"};
// TODO: Reduce duplication of these strings between here and SecureSocket.cpp
static const char s_certificateDir[] = {"tls"};
static const char s_certificateFilename[] = {DESKFLOW_APP_ID ".pem"};
//
// SecureListenSocket

View File

@ -45,11 +45,9 @@ static const float s_retryDelay = 0.01f;
enum { kMsgSize = 128 };
static const char kFingerprintDirName[] = "SSL/Fingerprints";
// static const char kFingerprintLocalFilename[] = "Local.txt";
static const char kFingerprintTrustedServersFilename[] = "TrustedServers.txt";
// static const char kFingerprintTrustedClientsFilename[] =
// "TrustedClients.txt";
// TODO: Reduce duplication of these strings between here and TlsFingerprint.cpp
static const char kFingerprintDirName[] = "tls";
static const char kFingerprintTrustedServersFilename[] = "trusted-servers";
struct Ssl {
SSL_CTX *m_context;