SYNEGRY-549 Create TLS certificate during upgrade (#6835)
* SYNEGRY-549 Create TLS certificate during upgrade * Update ChangeLog
This commit is contained in:
parent
aa3cb4fd33
commit
fd679589e5
8 changed files with 27 additions and 40 deletions
|
|
@ -22,6 +22,7 @@ Bug fixes:
|
||||||
- #6821 Blocker bugs found by sonar in synergy and in tests
|
- #6821 Blocker bugs found by sonar in synergy and in tests
|
||||||
- #6825 The system requires google test even when tests are disabled with BUILD_TESTS=OFF
|
- #6825 The system requires google test even when tests are disabled with BUILD_TESTS=OFF
|
||||||
- #6832 TLS certificate error on macOS system
|
- #6832 TLS certificate error on macOS system
|
||||||
|
- #6835 Create TLS certificate during upgrade
|
||||||
|
|
||||||
Enhancements:
|
Enhancements:
|
||||||
- #6750 Integrate SonarCloud for static analysis and test coverage
|
- #6750 Integrate SonarCloud for static analysis and test coverage
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,8 @@ void ActivationDialog::accept()
|
||||||
arg ((daysLeft == 1) ? "" : "s").
|
arg ((daysLeft == 1) ? "" : "s").
|
||||||
arg ((daysLeft == 1) ? "s" : "");
|
arg ((daysLeft == 1) ? "s" : "");
|
||||||
|
|
||||||
if (edition == kPro) {
|
if (edition == kPro || edition == kBusiness) {
|
||||||
|
m_appConfig->generateCertificate();
|
||||||
thanksMessage = thanksMessage.arg("If you're using SSL, "
|
thanksMessage = thanksMessage.arg("If you're using SSL, "
|
||||||
"remember to activate all of your devices.");
|
"remember to activate all of your devices.");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
#include "ConfigWriter.h"
|
#include "ConfigWriter.h"
|
||||||
|
#include "SslCertificate.h"
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
const char AppConfig::m_SynergysName[] = "synergys.exe";
|
const char AppConfig::m_SynergysName[] = "synergys.exe";
|
||||||
|
|
@ -414,8 +415,10 @@ ElevateMode AppConfig::elevateMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppConfig::setCryptoEnabled(bool newValue) {
|
void AppConfig::setCryptoEnabled(bool newValue) {
|
||||||
|
if (m_CryptoEnabled != newValue && newValue){
|
||||||
|
generateCertificate();
|
||||||
|
}
|
||||||
setSettingModified(m_CryptoEnabled, newValue);
|
setSettingModified(m_CryptoEnabled, newValue);
|
||||||
emit sslToggled(m_CryptoEnabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppConfig::isCryptoAvailable() const {
|
bool AppConfig::isCryptoAvailable() const {
|
||||||
|
|
@ -564,6 +567,16 @@ QString AppConfig::getTLSKeyLength() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppConfig::setTLSKeyLength(const QString& length) {
|
void AppConfig::setTLSKeyLength(const QString& length) {
|
||||||
m_TLSKeyLength = length;
|
if (m_TLSKeyLength != length) {
|
||||||
|
m_TLSKeyLength = length;
|
||||||
|
generateCertificate(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppConfig::generateCertificate(bool forceGeneration) const {
|
||||||
|
SslCertificate sslCertificate;
|
||||||
|
sslCertificate.generateCertificate(getTLSCertPath(), getTLSKeyLength(), forceGeneration);
|
||||||
|
emit sslToggled();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,9 @@ class AppConfig: public QObject, public GUI::Config::ConfigBase
|
||||||
void saveSettings() override;
|
void saveSettings() override;
|
||||||
void setLastVersion(const QString& version);
|
void setLastVersion(const QString& version);
|
||||||
|
|
||||||
|
/// @brief Generates TLS certificate
|
||||||
|
/// @param [in] bool forceGeneration Generate certificate even if it's exists.
|
||||||
|
void generateCertificate(bool forceGeneration=false) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// @brief The enumeration to easily access the names of the setting inside m_SynergySettingsName
|
/// @brief The enumeration to easily access the names of the setting inside m_SynergySettingsName
|
||||||
|
|
@ -288,7 +291,7 @@ protected:
|
||||||
void setSettingModified(T& variable,const T& newValue);
|
void setSettingModified(T& variable,const T& newValue);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sslToggled(bool enabled);
|
void sslToggled() const;
|
||||||
void zeroConfToggled();
|
void zeroConfToggled();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ MainWindow::MainWindow (AppConfig& appConfig,
|
||||||
// hide padlock icon
|
// hide padlock icon
|
||||||
secureSocket(false);
|
secureSocket(false);
|
||||||
|
|
||||||
sslToggled(appConfig.getCryptoEnabled());
|
updateLocalFingerprint();
|
||||||
|
|
||||||
connect (this, SIGNAL(windowShown()),
|
connect (this, SIGNAL(windowShown()),
|
||||||
this, SLOT(on_windowShown()), Qt::QueuedConnection);
|
this, SLOT(on_windowShown()), Qt::QueuedConnection);
|
||||||
|
|
@ -178,8 +178,8 @@ MainWindow::MainWindow (AppConfig& appConfig,
|
||||||
this, SLOT(InvalidLicense()), Qt::QueuedConnection);
|
this, SLOT(InvalidLicense()), Qt::QueuedConnection);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
connect (m_AppConfig, SIGNAL(sslToggled(bool)),
|
connect (m_AppConfig, SIGNAL(sslToggled()),
|
||||||
this, SLOT(sslToggled(bool)), Qt::QueuedConnection);
|
this, SLOT(updateLocalFingerprint()), Qt::QueuedConnection);
|
||||||
|
|
||||||
connect (m_AppConfig, SIGNAL(zeroConfToggled()),
|
connect (m_AppConfig, SIGNAL(zeroConfToggled()),
|
||||||
this, SLOT(zeroConfToggled()), Qt::QueuedConnection);
|
this, SLOT(zeroConfToggled()), Qt::QueuedConnection);
|
||||||
|
|
@ -744,12 +744,6 @@ void MainWindow::retryStart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
MainWindow::sslToggled (bool enabled)
|
|
||||||
{
|
|
||||||
updateLocalFingerprint();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MainWindow::clientArgs(QStringList& args, QString& app)
|
bool MainWindow::clientArgs(QStringList& args, QString& app)
|
||||||
{
|
{
|
||||||
app = appPath(appConfig().synergycName());
|
app = appPath(appConfig().synergycName());
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||||
void showConfigureServer() { showConfigureServer(""); }
|
void showConfigureServer() { showConfigureServer(""); }
|
||||||
void autoAddScreen(const QString name);
|
void autoAddScreen(const QString name);
|
||||||
void addZeroconfServer(const QString name);
|
void addZeroconfServer(const QString name);
|
||||||
void updateLocalFingerprint();
|
|
||||||
Zeroconf& zeroconf() { return *m_pZeroconf; }
|
Zeroconf& zeroconf() { return *m_pZeroconf; }
|
||||||
#ifndef SYNERGY_ENTERPRISE
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
LicenseManager& licenseManager() const;
|
LicenseManager& licenseManager() const;
|
||||||
|
|
@ -143,7 +142,7 @@ public slots:
|
||||||
void retryStart(); // If the connection failed this will retry a startSynergy
|
void retryStart(); // If the connection failed this will retry a startSynergy
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void sslToggled(bool enabled);
|
void updateLocalFingerprint();
|
||||||
void on_m_pGroupClient_toggled(bool on);
|
void on_m_pGroupClient_toggled(bool on);
|
||||||
void on_m_pGroupServer_toggled(bool on);
|
void on_m_pGroupServer_toggled(bool on);
|
||||||
bool on_m_pButtonBrowseConfigFile_clicked();
|
bool on_m_pButtonBrowseConfigFile_clicked();
|
||||||
|
|
|
||||||
|
|
@ -66,19 +66,10 @@ void SettingsDialog::accept()
|
||||||
appConfig().setAutoConfig(m_pCheckBoxAutoConfig->isChecked());
|
appConfig().setAutoConfig(m_pCheckBoxAutoConfig->isChecked());
|
||||||
appConfig().setMinimizeToTray(m_pCheckBoxMinimizeToTray->isChecked());
|
appConfig().setMinimizeToTray(m_pCheckBoxMinimizeToTray->isChecked());
|
||||||
appConfig().setTLSCertPath(m_pLineEditCertificatePath->text());
|
appConfig().setTLSCertPath(m_pLineEditCertificatePath->text());
|
||||||
|
|
||||||
bool keyLengthChanged = appConfig().getTLSKeyLength() != m_pComboBoxKeyLength->currentText();
|
|
||||||
appConfig().setTLSKeyLength(m_pComboBoxKeyLength->currentText());
|
appConfig().setTLSKeyLength(m_pComboBoxKeyLength->currentText());
|
||||||
|
|
||||||
//We only need to test the System scoped Radio as they are connected
|
//We only need to test the System scoped Radio as they are connected
|
||||||
appConfig().setLoadFromSystemScope(m_pRadioSystemScope->isChecked());
|
appConfig().setLoadFromSystemScope(m_pRadioSystemScope->isChecked());
|
||||||
|
|
||||||
if(m_pCheckBoxEnableCrypto->isChecked()) {
|
|
||||||
SslCertificate sslCertificate;
|
|
||||||
sslCertificate.generateCertificate(appConfig().getTLSCertPath(),
|
|
||||||
m_pComboBoxKeyLength->currentText(),
|
|
||||||
keyLengthChanged);
|
|
||||||
}
|
|
||||||
m_appConfig.setCryptoEnabled(m_pCheckBoxEnableCrypto->isChecked());
|
m_appConfig.setCryptoEnabled(m_pCheckBoxEnableCrypto->isChecked());
|
||||||
|
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
|
|
@ -224,9 +215,6 @@ void SettingsDialog::on_m_pCheckBoxEnableCrypto_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_appConfig.setCryptoEnabled(checked);
|
m_appConfig.setCryptoEnabled(checked);
|
||||||
if (checked) {
|
if (checked) {
|
||||||
SslCertificate sslCertificate;
|
|
||||||
sslCertificate.generateCertificate(m_pLineEditCertificatePath->text(), m_pComboBoxKeyLength->currentText());
|
|
||||||
m_pMainWindow->updateLocalFingerprint();
|
|
||||||
verticalSpacer_4->changeSize(10, 10, QSizePolicy::Minimum);
|
verticalSpacer_4->changeSize(10, 10, QSizePolicy::Minimum);
|
||||||
} else {
|
} else {
|
||||||
verticalSpacer_4->changeSize(10, 0, QSizePolicy::Ignored);
|
verticalSpacer_4->changeSize(10, 0, QSizePolicy::Ignored);
|
||||||
|
|
@ -265,15 +253,6 @@ void SettingsDialog::on_m_pPushButtonBrowseCert_clicked() {
|
||||||
updateRegenButton();
|
updateRegenButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::regenerateSSLCert() {
|
|
||||||
SslCertificate sslCertificate;
|
|
||||||
sslCertificate.generateCertificate(appConfig().getTLSCertPath(),
|
|
||||||
appConfig().getTLSKeyLength(),
|
|
||||||
true);
|
|
||||||
|
|
||||||
m_pMainWindow->updateLocalFingerprint();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsDialog::on_m_pComboBoxKeyLength_currentIndexChanged(int index) {
|
void SettingsDialog::on_m_pComboBoxKeyLength_currentIndexChanged(int index) {
|
||||||
updateRegenButton();
|
updateRegenButton();
|
||||||
}
|
}
|
||||||
|
|
@ -289,7 +268,7 @@ void SettingsDialog::updateRegenButton() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::on_m_pPushButtonRegenCert_clicked() {
|
void SettingsDialog::on_m_pPushButtonRegenCert_clicked() {
|
||||||
regenerateSSLCert();
|
appConfig().generateCertificate(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::updateKeyLengthOnFile(const QString &path) {
|
void SettingsDialog::updateKeyLengthOnFile(const QString &path) {
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,6 @@ class SettingsDialog : public QDialog, public Ui::SettingsDialogBase
|
||||||
/// @brief Causes the dialog to load all the settings from m_appConfig
|
/// @brief Causes the dialog to load all the settings from m_appConfig
|
||||||
void loadFromConfig();
|
void loadFromConfig();
|
||||||
|
|
||||||
/// @brief Forces the regeneration of the TLS cert from the saved settings
|
|
||||||
void regenerateSSLCert();
|
|
||||||
|
|
||||||
/// @brief Check if the regenerate button should be enabled or disabled and sets it
|
/// @brief Check if the regenerate button should be enabled or disabled and sets it
|
||||||
void updateRegenButton();
|
void updateRegenButton();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue