mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-13 00:33:09 -07:00
[WebUI]: exclude insecure ciphers
This commit is contained in:
parent
84bc011df5
commit
f9c39e3dac
2 changed files with 29 additions and 0 deletions
|
@ -47,6 +47,9 @@ Server::Server(IRequestHandler *requestHandler, QObject *parent)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
setProxy(QNetworkProxy::NoProxy);
|
setProxy(QNetworkProxy::NoProxy);
|
||||||
|
#ifndef QT_NO_OPENSSL
|
||||||
|
QSslSocket::setDefaultCiphers(safeCipherList());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Server::~Server()
|
Server::~Server()
|
||||||
|
@ -103,3 +106,26 @@ void Server::incomingConnection(int socketDescriptor)
|
||||||
serverSocket->deleteLater();
|
serverSocket->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_OPENSSL
|
||||||
|
QList<QSslCipher> Server::safeCipherList() const
|
||||||
|
{
|
||||||
|
const QStringList badCiphers = {"idea", "rc4"};
|
||||||
|
const QList<QSslCipher> allCiphers = QSslSocket::supportedCiphers();
|
||||||
|
QList<QSslCipher> safeCiphers;
|
||||||
|
foreach (const QSslCipher &cipher, allCiphers) {
|
||||||
|
bool isSafe = true;
|
||||||
|
foreach (const QString &badCipher, badCiphers) {
|
||||||
|
if (cipher.name().contains(badCipher, Qt::CaseInsensitive)) {
|
||||||
|
isSafe = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSafe)
|
||||||
|
safeCiphers += cipher;
|
||||||
|
}
|
||||||
|
|
||||||
|
return safeCiphers;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <QTcpServer>
|
#include <QTcpServer>
|
||||||
#ifndef QT_NO_OPENSSL
|
#ifndef QT_NO_OPENSSL
|
||||||
#include <QSslCertificate>
|
#include <QSslCertificate>
|
||||||
|
#include <QSslCipher>
|
||||||
#include <QSslKey>
|
#include <QSslKey>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -68,6 +69,8 @@ namespace Http
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef QT_NO_OPENSSL
|
#ifndef QT_NO_OPENSSL
|
||||||
|
QList<QSslCipher> safeCipherList() const;
|
||||||
|
|
||||||
bool m_https;
|
bool m_https;
|
||||||
QList<QSslCertificate> m_certificates;
|
QList<QSslCertificate> m_certificates;
|
||||||
QSslKey m_key;
|
QSslKey m_key;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue