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
|
||||
- #6825 The system requires google test even when tests are disabled with BUILD_TESTS=OFF
|
||||
- #6832 TLS certificate error on macOS system
|
||||
- #6835 Create TLS certificate during upgrade
|
||||
|
||||
Enhancements:
|
||||
- #6750 Integrate SonarCloud for static analysis and test coverage
|
||||
|
|
|
|||
|
|
@ -92,7 +92,8 @@ void ActivationDialog::accept()
|
|||
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, "
|
||||
"remember to activate all of your devices.");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include <QPushButton>
|
||||
|
||||
#include "ConfigWriter.h"
|
||||
#include "SslCertificate.h"
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
const char AppConfig::m_SynergysName[] = "synergys.exe";
|
||||
|
|
@ -414,8 +415,10 @@ ElevateMode AppConfig::elevateMode()
|
|||
}
|
||||
|
||||
void AppConfig::setCryptoEnabled(bool newValue) {
|
||||
if (m_CryptoEnabled != newValue && newValue){
|
||||
generateCertificate();
|
||||
}
|
||||
setSettingModified(m_CryptoEnabled, newValue);
|
||||
emit sslToggled(m_CryptoEnabled);
|
||||
}
|
||||
|
||||
bool AppConfig::isCryptoAvailable() const {
|
||||
|
|
@ -564,6 +567,16 @@ QString AppConfig::getTLSKeyLength() const {
|
|||
}
|
||||
|
||||
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 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:
|
||||
/// @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);
|
||||
|
||||
signals:
|
||||
void sslToggled(bool enabled);
|
||||
void sslToggled() const;
|
||||
void zeroConfToggled();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ MainWindow::MainWindow (AppConfig& appConfig,
|
|||
// hide padlock icon
|
||||
secureSocket(false);
|
||||
|
||||
sslToggled(appConfig.getCryptoEnabled());
|
||||
updateLocalFingerprint();
|
||||
|
||||
connect (this, SIGNAL(windowShown()),
|
||||
this, SLOT(on_windowShown()), Qt::QueuedConnection);
|
||||
|
|
@ -178,8 +178,8 @@ MainWindow::MainWindow (AppConfig& appConfig,
|
|||
this, SLOT(InvalidLicense()), Qt::QueuedConnection);
|
||||
#endif
|
||||
|
||||
connect (m_AppConfig, SIGNAL(sslToggled(bool)),
|
||||
this, SLOT(sslToggled(bool)), Qt::QueuedConnection);
|
||||
connect (m_AppConfig, SIGNAL(sslToggled()),
|
||||
this, SLOT(updateLocalFingerprint()), Qt::QueuedConnection);
|
||||
|
||||
connect (m_AppConfig, SIGNAL(zeroConfToggled()),
|
||||
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)
|
||||
{
|
||||
app = appPath(appConfig().synergycName());
|
||||
|
|
|
|||
|
|
@ -120,7 +120,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
|||
void showConfigureServer() { showConfigureServer(""); }
|
||||
void autoAddScreen(const QString name);
|
||||
void addZeroconfServer(const QString name);
|
||||
void updateLocalFingerprint();
|
||||
Zeroconf& zeroconf() { return *m_pZeroconf; }
|
||||
#ifndef SYNERGY_ENTERPRISE
|
||||
LicenseManager& licenseManager() const;
|
||||
|
|
@ -143,7 +142,7 @@ public slots:
|
|||
void retryStart(); // If the connection failed this will retry a startSynergy
|
||||
|
||||
protected slots:
|
||||
void sslToggled(bool enabled);
|
||||
void updateLocalFingerprint();
|
||||
void on_m_pGroupClient_toggled(bool on);
|
||||
void on_m_pGroupServer_toggled(bool on);
|
||||
bool on_m_pButtonBrowseConfigFile_clicked();
|
||||
|
|
|
|||
|
|
@ -66,19 +66,10 @@ void SettingsDialog::accept()
|
|||
appConfig().setAutoConfig(m_pCheckBoxAutoConfig->isChecked());
|
||||
appConfig().setMinimizeToTray(m_pCheckBoxMinimizeToTray->isChecked());
|
||||
appConfig().setTLSCertPath(m_pLineEditCertificatePath->text());
|
||||
|
||||
bool keyLengthChanged = appConfig().getTLSKeyLength() != m_pComboBoxKeyLength->currentText();
|
||||
appConfig().setTLSKeyLength(m_pComboBoxKeyLength->currentText());
|
||||
|
||||
//We only need to test the System scoped Radio as they are connected
|
||||
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());
|
||||
|
||||
QDialog::accept();
|
||||
|
|
@ -224,9 +215,6 @@ void SettingsDialog::on_m_pCheckBoxEnableCrypto_toggled(bool checked)
|
|||
{
|
||||
m_appConfig.setCryptoEnabled(checked);
|
||||
if (checked) {
|
||||
SslCertificate sslCertificate;
|
||||
sslCertificate.generateCertificate(m_pLineEditCertificatePath->text(), m_pComboBoxKeyLength->currentText());
|
||||
m_pMainWindow->updateLocalFingerprint();
|
||||
verticalSpacer_4->changeSize(10, 10, QSizePolicy::Minimum);
|
||||
} else {
|
||||
verticalSpacer_4->changeSize(10, 0, QSizePolicy::Ignored);
|
||||
|
|
@ -265,15 +253,6 @@ void SettingsDialog::on_m_pPushButtonBrowseCert_clicked() {
|
|||
updateRegenButton();
|
||||
}
|
||||
|
||||
void SettingsDialog::regenerateSSLCert() {
|
||||
SslCertificate sslCertificate;
|
||||
sslCertificate.generateCertificate(appConfig().getTLSCertPath(),
|
||||
appConfig().getTLSKeyLength(),
|
||||
true);
|
||||
|
||||
m_pMainWindow->updateLocalFingerprint();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_m_pComboBoxKeyLength_currentIndexChanged(int index) {
|
||||
updateRegenButton();
|
||||
}
|
||||
|
|
@ -289,7 +268,7 @@ void SettingsDialog::updateRegenButton() {
|
|||
}
|
||||
|
||||
void SettingsDialog::on_m_pPushButtonRegenCert_clicked() {
|
||||
regenerateSSLCert();
|
||||
appConfig().generateCertificate(true);
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
void updateRegenButton();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue