Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit 84bd0ba

Browse files
authored
Update openssl to 1.1.1 (#558)
1 parent 244cf68 commit 84bd0ba

18 files changed

+659
-24
lines changed

doc/servermd/Server.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ This section describes the dependencies and steps for installing the OWT server.
106106
**Table 2-3. OWT Server Dependencies**
107107
Name|Version|Remarks
108108
--------|--------|--------
109-
Node.js |8.15.0|Website: http://nodejs.org/
109+
Node.js |10.21.0|Website: http://nodejs.org/
110110
Node modules|Specified|N/A
111111
MongoDB| 2.6.10 |Website: http://mongodb.org
112112
System libraries|Latest|N/A
@@ -115,7 +115,7 @@ All dependencies, except system libraries, are provided or can be automatically
115115

116116
All essential system libraries are installed when you install the OWT server package using the Ubuntu or CentOS's package management system.
117117

118-
Regarding Node.js*, make sure it's installed in your system prior to installing the OWT server. We recommend version 8.15.0. Refer to http://nodejs.org/ for the details and installation.
118+
Regarding Node.js*, make sure it's installed in your system prior to installing the OWT server. We recommend version 10.21.0. Refer to http://nodejs.org/ for the details and installation.
119119

120120
Before installing the OWT server, make sure your login account has sys-admin privileges; i.e. the ability to execute `sudo`.
121121

@@ -789,10 +789,10 @@ Peer server | Ubuntu 18.04 LTS, CentOS* 7.6/7.4
789789
**Table 5-2. Peer Server Dependencies**
790790
Name | Version | Remarks
791791
-----|----|----
792-
Node.js | 8.15.0 | Website: http://nodejs.org/
792+
Node.js | 10.21.0 | Website: http://nodejs.org/
793793
Node modules | Specified | N/A
794794

795-
Regarding Node.js*, make sure it's installed in your system prior to installing the Peer Server. We recommend version 8.15.0. Refer to http://nodejs.org/ for installation details.
795+
Regarding Node.js*, make sure it's installed in your system prior to installing the Peer Server. We recommend version 10.21.0. Refer to http://nodejs.org/ for installation details.
796796
## 5.3 Installation {#Conferencesection5_3}
797797
On the server machine, unpack the peer server release package, and install node modules
798798

scripts/installCommonDeps.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,14 @@ install_openssl(){
150150
$INCR_INSTALL && [[ ! -z $LIST_LIBS ]] && echo "openssl already installed." && return 0
151151

152152
if [ -d $LIB_DIR ]; then
153-
local SSL_BASE_VERSION="1.0.2"
154-
local SSL_VERSION="1.0.2t"
153+
local SSL_BASE_VERSION="1.1.1"
154+
local SSL_VERSION="1.1.1g"
155155
cd $LIB_DIR
156156
rm -f ./build/lib/libssl.*
157157
rm -f ./build/lib/libcrypto.*
158158
rm -rf openssl-1*
159-
wget -c http://www.openssl.org/source/old/${SSL_BASE_VERSION}/openssl-${SSL_VERSION}.tar.gz
159+
160+
wget -c https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz
160161
tar xf openssl-${SSL_VERSION}.tar.gz
161162
cd openssl-${SSL_VERSION}
162163
./config no-ssl3 --prefix=$PREFIX_DIR -fPIC
@@ -326,6 +327,7 @@ install_libsrtp2(){
326327

327328
if [ -d $LIB_DIR ]; then
328329
cd $LIB_DIR
330+
rm -rf libsrtp-2.1.0
329331
curl -o libsrtp-2.1.0.tar.gz https://codeload.github.com/cisco/libsrtp/tar.gz/v2.1.0
330332
tar -zxvf libsrtp-2.1.0.tar.gz
331333
cd libsrtp-2.1.0
@@ -381,7 +383,7 @@ install_libre() {
381383
rm -rf re
382384
git clone https://github.com/creytiv/re.git
383385
pushd re >/dev/null
384-
git checkout v0.4.16
386+
git checkout v0.5.0
385387
make SYSROOT_ALT=${PREFIX_DIR} RELEASE=1
386388
make install SYSROOT_ALT=${PREFIX_DIR} RELEASE=1 PREFIX=${PREFIX_DIR}
387389
popd >/dev/null

scripts/pack.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,8 @@ function isLibAllowed(libSrc) {
420420

421421
const whiteList = [
422422
'rtcadapter',
423+
'libssl.so.1.1',
424+
'libcrypto',
423425
'libnice',
424426
'libSvtHevcEnc',
425427
'libusrsctp',
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
From 562465e10e805b4808f22386d219988634c4e781 Mon Sep 17 00:00:00 2001
2+
From: Pedro Rodriguez <[email protected]>
3+
Date: Tue, 30 Oct 2018 16:46:32 +0100
4+
Subject: [PATCH] Do SSL/DTLS init on addon start instead of in DtlsClient Init
5+
(#1324)
6+
7+
---
8+
erizo/src/erizo/dtls/DtlsClient.cpp | 1 -
9+
erizoAPI/addon.cc | 2 ++
10+
2 files changed, 2 insertions(+), 1 deletion(-)
11+
12+
diff --git a/erizo/src/erizo/dtls/DtlsClient.cpp b/erizo/src/erizo/dtls/DtlsClient.cpp
13+
index 48b22bd..e72df66 100644
14+
--- a/erizo/src/erizo/dtls/DtlsClient.cpp
15+
+++ b/erizo/src/erizo/dtls/DtlsClient.cpp
16+
@@ -214,7 +214,6 @@ int createCert(const std::string& pAor, int expireDays, int keyLen, X509*& outCe
17+
// is required
18+
DtlsSocketContext::DtlsSocketContext() {
19+
started = false;
20+
- DtlsSocketContext::Init();
21+
22+
ELOG_DEBUG("Creating Dtls factory, Openssl v %s", OPENSSL_VERSION_TEXT);
23+
24+
diff --git a/erizoAPI/addon.cc b/erizoAPI/addon.cc
25+
index d4966f3..2dfee72 100644
26+
--- a/erizoAPI/addon.cc
27+
+++ b/erizoAPI/addon.cc
28+
@@ -2,6 +2,7 @@
29+
#define BUILDING_NODE_EXTENSION
30+
#endif
31+
#include <nan.h>
32+
+#include <dtls/DtlsSocket.h>
33+
#include "WebRtcConnection.h"
34+
#include "MediaStream.h"
35+
#include "OneToManyProcessor.h"
36+
@@ -14,6 +15,7 @@
37+
#include "IOThreadPool.h"
38+
39+
NAN_MODULE_INIT(InitAll) {
40+
+ dtls::DtlsSocketContext::Init();
41+
WebRtcConnection::Init(target);
42+
MediaStream::Init(target);
43+
OneToManyProcessor::Init(target);
44+
--
45+
2.7.4
46+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 3609eb3f64976ea3a55ed9ed22f376ec450dc99a Mon Sep 17 00:00:00 2001
2+
From: Shining Dong <[email protected]>
3+
Date: Tue, 2 Apr 2019 15:41:20 +0800
4+
Subject: [PATCH] change DTLSv1_2_method to DTLS_method (#1386)
5+
6+
---
7+
erizo/src/erizo/dtls/DtlsClient.cpp | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/erizo/src/erizo/dtls/DtlsClient.cpp b/erizo/src/erizo/dtls/DtlsClient.cpp
11+
index e72df66..a2ff18f 100644
12+
--- a/erizo/src/erizo/dtls/DtlsClient.cpp
13+
+++ b/erizo/src/erizo/dtls/DtlsClient.cpp
14+
@@ -217,7 +217,7 @@ int createCert(const std::string& pAor, int expireDays, int keyLen, X509*& outCe
15+
16+
ELOG_DEBUG("Creating Dtls factory, Openssl v %s", OPENSSL_VERSION_TEXT);
17+
18+
- mContext = SSL_CTX_new(DTLSv1_2_method());
19+
+ mContext = SSL_CTX_new(DTLS_method());
20+
assert(mContext);
21+
22+
int r = SSL_CTX_use_certificate(mContext, mCert);
23+
--
24+
2.7.4
25+
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
From a476d713dc8edf4e25d9591f04d6829c0660a558 Mon Sep 17 00:00:00 2001
2+
From: yuanchao0310 <[email protected]>
3+
Date: Tue, 14 May 2019 23:56:39 +0800
4+
Subject: [PATCH] fix dtls multi-thread crash issue (#1409)
5+
6+
---
7+
erizo/src/erizo/dtls/DtlsClient.cpp | 53 ++++++++++++++++++++++++++++++++++---
8+
erizo/src/erizo/dtls/DtlsSocket.h | 1 +
9+
erizo/src/test/DtlsSocketTest.cpp | 42 +++++++++++++++++++++++++++++
10+
3 files changed, 92 insertions(+), 4 deletions(-)
11+
create mode 100644 erizo/src/test/DtlsSocketTest.cpp
12+
13+
diff --git a/erizo/src/erizo/dtls/DtlsClient.cpp b/erizo/src/erizo/dtls/DtlsClient.cpp
14+
index a2ff18f..ba6c3af 100644
15+
--- a/erizo/src/erizo/dtls/DtlsClient.cpp
16+
+++ b/erizo/src/erizo/dtls/DtlsClient.cpp
17+
@@ -3,6 +3,8 @@
18+
extern "C" {
19+
#include <srtp2/srtp.h>
20+
}
21+
+#include <mutex> // NOLINT
22+
+#include <thread> // NOLINT
23+
24+
#include <boost/thread.hpp>
25+
#include <boost/lexical_cast.hpp>
26+
@@ -31,14 +33,52 @@ using std::memcpy;
27+
28+
const char* DtlsSocketContext::DefaultSrtpProfile = "SRTP_AES128_CM_SHA1_80";
29+
30+
-X509 *DtlsSocketContext::mCert = NULL;
31+
-EVP_PKEY *DtlsSocketContext::privkey = NULL;
32+
+X509 *DtlsSocketContext::mCert = nullptr;
33+
+EVP_PKEY *DtlsSocketContext::privkey = nullptr;
34+
35+
static const int KEY_LENGTH = 1024;
36+
37+
+static std::mutex* array_mutex;
38+
+
39+
DEFINE_LOGGER(DtlsSocketContext, "dtls.DtlsSocketContext");
40+
log4cxx::LoggerPtr sslLogger(log4cxx::Logger::getLogger("dtls.SSL"));
41+
42+
+static void ssl_lock_callback(int mode, int type, const char* file, int line) {
43+
+ if (mode & CRYPTO_LOCK) {
44+
+ array_mutex[type].lock();
45+
+ } else {
46+
+ array_mutex[type].unlock();
47+
+ }
48+
+}
49+
+
50+
+static unsigned long ssl_thread_id() { // NOLINT
51+
+ return (unsigned long)std::hash<std::thread::id>()(std::this_thread::get_id()); // NOLINT
52+
+}
53+
+
54+
+static int ssl_thread_setup() {
55+
+ array_mutex = new std::mutex[CRYPTO_num_locks()];
56+
+
57+
+ if (!array_mutex) {
58+
+ return 0;
59+
+ } else {
60+
+ CRYPTO_set_id_callback(ssl_thread_id);
61+
+ CRYPTO_set_locking_callback(ssl_lock_callback);
62+
+ }
63+
+ return 1;
64+
+}
65+
+
66+
+static int ssl_thread_cleanup() {
67+
+ if (!array_mutex) {
68+
+ return 0;
69+
+ }
70+
+
71+
+ CRYPTO_set_id_callback(nullptr);
72+
+ CRYPTO_set_locking_callback(nullptr);
73+
+ delete[] array_mutex;
74+
+ array_mutex = nullptr;
75+
+ return 1;
76+
+}
77+
+
78+
void SSLInfoCallback(const SSL* s, int where, int ret) {
79+
const char* str = "undefined";
80+
int w = where & ~SSL_ST_MASK;
81+
@@ -249,7 +289,7 @@ int createCert(const std::string& pAor, int expireDays, int keyLen, X509*& outCe
82+
DtlsSocketContext::~DtlsSocketContext() {
83+
mSocket->close();
84+
delete mSocket;
85+
- mSocket = NULL;
86+
+ mSocket = nullptr;
87+
SSL_CTX_free(mContext);
88+
}
89+
90+
@@ -258,7 +298,8 @@ int createCert(const std::string& pAor, int expireDays, int keyLen, X509*& outCe
91+
}
92+
93+
void DtlsSocketContext::Init() {
94+
- if (DtlsSocketContext::mCert == NULL) {
95+
+ ssl_thread_setup();
96+
+ if (DtlsSocketContext::mCert == nullptr) {
97+
OpenSSL_add_all_algorithms();
98+
SSL_library_init();
99+
SSL_load_error_strings();
100+
@@ -267,6 +308,10 @@ int createCert(const std::string& pAor, int expireDays, int keyLen, X509*& outCe
101+
}
102+
}
103+
104+
+ void DtlsSocketContext::Destroy() {
105+
+ ssl_thread_cleanup();
106+
+ }
107+
+
108+
DtlsSocket* DtlsSocketContext::createClient() {
109+
return new DtlsSocket(this, DtlsSocket::Client);
110+
}
111+
diff --git a/erizo/src/erizo/dtls/DtlsSocket.h b/erizo/src/erizo/dtls/DtlsSocket.h
112+
index 2ea4795..e99cef8 100644
113+
--- a/erizo/src/erizo/dtls/DtlsSocket.h
114+
+++ b/erizo/src/erizo/dtls/DtlsSocket.h
115+
@@ -187,6 +187,7 @@ class DtlsSocketContext {
116+
static EVP_PKEY *privkey;
117+
118+
static void Init();
119+
+ static void Destroy();
120+
121+
protected:
122+
DtlsSocket *mSocket;
123+
diff --git a/erizo/src/test/DtlsSocketTest.cpp b/erizo/src/test/DtlsSocketTest.cpp
124+
new file mode 100644
125+
index 0000000..7708111
126+
--- /dev/null
127+
+++ b/erizo/src/test/DtlsSocketTest.cpp
128+
@@ -0,0 +1,42 @@
129+
+#include <gmock/gmock.h>
130+
+#include <gtest/gtest.h>
131+
+
132+
+#include <dtls/DtlsSocket.h>
133+
+#include <string>
134+
+#include <thread> // NOLINT
135+
+
136+
+using testing::_;
137+
+using testing::Return;
138+
+using testing::Eq;
139+
+
140+
+void createDtlsClient() {
141+
+ std::unique_ptr<dtls::DtlsSocketContext> dtls_rtp;
142+
+ dtls_rtp.reset(new dtls::DtlsSocketContext());
143+
+ dtls_rtp->createClient();
144+
+}
145+
+
146+
+class DtlsSocketTest : public ::testing::Test {
147+
+ protected:
148+
+ virtual void SetUp() {
149+
+ dtls::DtlsSocketContext::Init();
150+
+ }
151+
+
152+
+ virtual void TearDown() {
153+
+ dtls::DtlsSocketContext::Destroy();
154+
+ }
155+
+
156+
+ void runTest(int number_of_clients) {
157+
+ std::thread threads[number_of_clients]; // NOLINT
158+
+ for (int j = 0; j < number_of_clients; j++) {
159+
+ threads[j] = std::thread(createDtlsClient);
160+
+ }
161+
+ for (int j = 0; j < number_of_clients; j++) {
162+
+ threads[j].join();
163+
+ }
164+
+ }
165+
+};
166+
+
167+
+TEST_F(DtlsSocketTest, create_1000_DtlsClient) {
168+
+ runTest(1000);
169+
+ EXPECT_THAT(true, Eq(true));
170+
+}
171+
--
172+
2.7.4
173+

0 commit comments

Comments
 (0)