Added TLS support for API and many other TLS related changes.

This commit is contained in:
XMRig 2020-03-18 20:09:11 +07:00
parent 92a258f142
commit 5b610e4dfe
No known key found for this signature in database
GPG key ID: 446A53638BE94409
38 changed files with 1601 additions and 178 deletions

View file

@ -211,7 +211,7 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
auto &allocator = doc.GetAllocator();
Value api(kObjectType);
api.AddMember(StringRef(kApiId), m_apiId.toJSON(), allocator);
api.AddMember(StringRef(kApiId), m_apiId.toJSON(), allocator);
api.AddMember(StringRef(kApiWorkerId), m_apiWorkerId.toJSON(), allocator);
doc.AddMember(StringRef(kApi), api, allocator);
@ -245,6 +245,11 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
doc.AddMember(StringRef(Pools::kRetries), m_pools.retries(), allocator);
doc.AddMember(StringRef(Pools::kRetryPause), m_pools.retryPause(), allocator);
doc.AddMember(StringRef(kSyslog), isSyslog(), allocator);
# ifdef XMRIG_FEATURE_TLS
doc.AddMember(StringRef(kTls), m_tls.toJSON(doc), allocator);
# endif
doc.AddMember(StringRef(kUserAgent), m_userAgent.toJSON(), allocator);
doc.AddMember(StringRef(kVerbose), Log::verbose(), allocator);
doc.AddMember(StringRef(kWatch), m_watch, allocator);

View file

@ -93,6 +93,13 @@ static const option options[] = {
# ifdef XMRIG_FEATURE_TLS
{ "tls", 0, nullptr, IConfig::TlsKey },
{ "tls-fingerprint", 1, nullptr, IConfig::FingerprintKey },
{ "tls-cert", 1, nullptr, IConfig::TlsCertKey },
{ "tls-cert-key", 1, nullptr, IConfig::TlsCertKeyKey },
{ "tls-dhparam", 1, nullptr, IConfig::TlsDHparamKey },
{ "tls-protocols", 1, nullptr, IConfig::TlsProtocolsKey },
{ "tls-ciphers", 1, nullptr, IConfig::TlsCiphersKey },
{ "tls-ciphersuites", 1, nullptr, IConfig::TlsCipherSuitesKey },
{ "tls-gen", 1, nullptr, IConfig::TlsGenKey },
# endif
# ifdef XMRIG_FEATURE_ASM
{ "asm", 1, nullptr, IConfig::AssemblyKey },

View file

@ -131,6 +131,17 @@ static inline const std::string &usage()
u += " --no-nvml disable NVML (NVIDIA Management Library) support\n";
# endif
# ifdef XMRIG_FEATURE_TLS
u += "\nTLS:\n";
u += " --tls-gen=HOSTNAME generate TLS certificate for specific hostname\n";
u += " --tls-cert=FILE load TLS certificate chain from a file in the PEM format\n";
u += " --tls-cert-key=FILE load TLS certificate private key from a file in the PEM format\n";
u += " --tls-dhparam=FILE load DH parameters for DHE ciphers from a file in the PEM format\n";
u += " --tls-protocols=N enable specified TLS protocols, example: \"TLSv1 TLSv1.1 TLSv1.2 TLSv1.3\"\n";
u += " --tls-ciphers=S set list of available ciphers (TLSv1.2 and below)\n";
u += " --tls-ciphersuites=S set list of available TLSv1.3 ciphersuites\n";
# endif
u += "\nLogging:\n";
# ifdef HAVE_SYSLOG_H