Skip to content

Commit

Permalink
Merge branch 'release/2021.12'
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed Oct 3, 2021
2 parents 84bb4da + c53d214 commit dbaec51
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 50 deletions.
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@

## develop

## 2021.12

- [UPDATE] `CLI11``2.1.1` に上げる
- @voluntas
- [UPDATE] libwebrtc のバージョンを `m94.4606.3.4` に上げる
- @voluntas
- [FIX] Let's Encrypt な証明書の SSL 接続が失敗する問題を修正する
- @melpon

## 2021.11

- [ADD] クラスター機能に対応
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WebRTC Load Testing Tool Zakuro

[![libwebrtc](https://img.shields.io/badge/libwebrtc-m93.4577-blue.svg)](https://chromium.googlesource.com/external/webrtc/+/branch-heads/4577)
[![libwebrtc](https://img.shields.io/badge/libwebrtc-m94.4606-blue.svg)](https://chromium.googlesource.com/external/webrtc/+/branch-heads/4606)
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/shiguredo/zakuro.svg)](https://github.com/shiguredo/zakuro)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Expand All @@ -20,10 +20,11 @@ WebRTC Load Testing Tool Zakuro は libwebrtc を利用した WebRTC SFU Sora

## 特徴

- WebRTC SFU Sora 最新版に対応
- WebRTC SFU Sora 開発版に対応
- YAML による設定ファイルへ対応
- 動的インスタンス作成へ対応
- データチャネルメッセージングへ対応
- クラスター機能への対応
- データチャネルメッセージング機能へ対応
- フェイクネットワークへ対応
- 最新の libwebrtc へ対応

Expand Down Expand Up @@ -66,7 +67,7 @@ Options:
--fake-audio-capture TEXT:FILE
Fake Audio from File
--sandstorm Fake Sandstorm Video
--video-device TEXT:FILE Use the video input device specified by a name (some device will be used if not specified)
--video-device TEXT Use the video device specified by an index or a name (use the first one if not specified)
--resolution TEXT Video resolution (one of QVGA, VGA, HD, FHD, 4K, or [WIDTH]x[HEIGHT])
--framerate INT:INT in [1 - 60]
Video framerate
Expand All @@ -78,7 +79,8 @@ Options:
--game TEXT:{kuzushi} Play game
--scenario TEXT:{reconnect} Scenario type
--use-dcsctp Use dcsctp instead of usrsctp
--sora-signaling-url TEXT Signaling URL
--sora-signaling-url TEXT ...
Signaling URLs
--sora-channel-id TEXT Channel ID
--sora-role TEXT:{sendonly,recvonly,sendrecv}
Role
Expand Down
6 changes: 3 additions & 3 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ZAKURO_VERSION=2021.11
WEBRTC_BUILD_VERSION=94.4606.3.3
ZAKURO_VERSION=2021.12
WEBRTC_BUILD_VERSION=94.4606.3.4
BOOST_VERSION=1.77.0
CLI11_VERSION=2.0.0
CLI11_VERSION=2.1.1
CMAKE_VERSION=3.21.3
BLEND2D_VERSION=3a0299c9126d19759a483ac3267a52b50ec77141
ASMJIT_VERSION=d0d14ac774977d0060a351f66e35cb57ba0bf59c
Expand Down
10 changes: 4 additions & 6 deletions src/rtc/rtc_ssl_verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ bool RTCSSLVerifier::Verify(const rtc::SSLCertificate& certificate) {
if (insecure_) {
return true;
}
CRYPTO_BUFFER* cert = static_cast<const rtc::BoringSSLCertificate&>(certificate).cert_buffer();
bssl::UniquePtr<X509> x509(X509_parse_from_buffer(cert));
if (!x509) {
return false;
}
return SSLVerifier::VerifyX509(x509.get());
SSL* ssl = static_cast<const rtc::BoringSSLCertificate&>(certificate).ssl();
X509* x509 = SSL_get_peer_certificate(ssl);
STACK_OF(X509)* chain = SSL_get_peer_cert_chain(ssl);
return SSLVerifier::VerifyX509(x509, chain);
}
91 changes: 58 additions & 33 deletions src/ssl_verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,33 +54,38 @@ emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
-----END CERTIFICATE-----
)";

const char dst_root[] = R"(
# Issuer: CN=DST Root CA X3 O=Digital Signature Trust Co.
# Subject: CN=DST Root CA X3 O=Digital Signature Trust Co.
# Label: "DST Root CA X3"
# Serial: 91299735575339953335919266965803778155
# MD5 Fingerprint: 41:03:52:dc:0f:f7:50:1b:16:f0:02:8e:ba:6f:45:c5
# SHA1 Fingerprint: da:c9:02:4f:54:d8:f6:df:94:93:5f:b1:73:26:38:ca:6a:d7:7c:13
# SHA256 Fingerprint: 06:87:26:03:31:a7:24:03:d9:09:f1:05:e6:9b:cf:0d:32:e1:bd:24:93:ff:c6:d9:20:6d:11:bc:d6:77:07:39
const char lets_encrypt_r3[] = R"(
# Subject: C = US, O = Let's Encrypt, CN = R3
# Issuer: C = US, O = Internet Security Research Group, CN = ISRG Root X1
-----BEGIN CERTIFICATE-----
MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/
MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow
PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD
Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O
rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq
OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b
xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLy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5da149p90Ids
hCExroL1+7mryIkXPeFM5TgO9r0rvZaBFOvV2z0gp35Z0+L4WPlbuEjN/lxPFin+
HlUjr8gRsI3qfJOQFy/9rKIJR0Y/8Omwt/8oTWgy1mdeHmmjk7j1nYsvC9JSQ6Zv
MldlTTKB3zhThV1+XWYp6rjd5JW1zbVWEkLNxE7GJThEUG3szgBVGP7pSWTUTsqX
nLRbwHOoq7hHwg==
-----END CERTIFICATE-----
)";

Expand Down Expand Up @@ -131,11 +136,26 @@ bool SSLVerifier::LoadBuiltinSSLRootCertificates(X509_STORE* store) {
return count_of_added_certs > 0;
}

bool SSLVerifier::VerifyX509(X509* x509) {
bool SSLVerifier::VerifyX509(X509* x509, STACK_OF(X509) * chain) {
{
char subject_name[256];
X509_NAME_oneline(X509_get_subject_name(x509), subject_name, 256);
RTC_LOG(LS_INFO) << "Verifying " << subject_name;
char data[256];
RTC_LOG(LS_INFO) << "cert:";
X509_NAME_oneline(X509_get_subject_name(x509), data, sizeof(data));
RTC_LOG(LS_INFO) << " subject = " << data;
X509_NAME_oneline(X509_get_issuer_name(x509), data, sizeof(data));
RTC_LOG(LS_INFO) << " issuer = " << data;

if (chain != nullptr) {
int n = sk_X509_num(chain);
for (int i = 0; i < n; i++) {
X509* x = sk_X509_value(chain, i);
RTC_LOG(LS_INFO) << "chain[" << i << "]:";
X509_NAME_oneline(X509_get_subject_name(x), data, sizeof(data));
RTC_LOG(LS_INFO) << " subject = " << data;
X509_NAME_oneline(X509_get_issuer_name(x), data, sizeof(data));
RTC_LOG(LS_INFO) << " issuer = " << data;
}
}
}

X509_STORE* store = nullptr;
Expand All @@ -157,12 +177,18 @@ bool SSLVerifier::VerifyX509(X509* x509) {
RTC_LOG(LS_ERROR) << "X509_STORE_new failed";
return false;
}
int r;
r = X509_STORE_set_flags(store, X509_V_FLAG_TRUSTED_FIRST);
if (r == 0) {
RTC_LOG(LS_ERROR) << "X509_STORE_set_flags failed";
return false;
}

// Let's Encrypt の証明書を追加
if (!AddCert(isrg_root, store)) {
return false;
}
if (!AddCert(dst_root, store)) {
if (!AddCert(lets_encrypt_r3, store)) {
return false;
}

Expand All @@ -177,8 +203,7 @@ bool SSLVerifier::VerifyX509(X509* x509) {
RTC_LOG(LS_ERROR) << "X509_STORE_CTX_new failed";
return false;
}
int r;
r = X509_STORE_CTX_init(ctx, store, x509, nullptr);
r = X509_STORE_CTX_init(ctx, store, x509, chain);
if (r == 0) {
RTC_LOG(LS_ERROR) << "X509_STORE_CTX_init failed";
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/ssl_verifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// 自前で SSL の証明書検証を行うためのクラス
class SSLVerifier {
public:
static bool VerifyX509(X509* x509);
static bool VerifyX509(X509* x509, STACK_OF(X509) * chain);

private:
// PEM 形式のルート証明書を追加する
Expand Down
5 changes: 3 additions & 2 deletions src/websocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ Websocket::Websocket(Websocket::ssl_tag,
if (insecure) {
return true;
}
X509* cert = X509_STORE_CTX_get_current_cert(ctx.native_handle());
return SSLVerifier::VerifyX509(cert);
X509* cert = X509_STORE_CTX_get0_cert(ctx.native_handle());
STACK_OF(X509)* chain = X509_STORE_CTX_get0_chain(ctx.native_handle());
return SSLVerifier::VerifyX509(cert, chain);
});
}
Websocket::Websocket(boost::asio::ip::tcp::socket socket)
Expand Down

0 comments on commit dbaec51

Please sign in to comment.