|
|
|
@ -516,6 +516,28 @@ VOID TEST(AppSecurity, CheckSecurity)
|
|
|
|
|
}
|
|
|
|
|
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtmpConnPlay, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("deny", "play", "all");
|
|
|
|
|
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPlay, "", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("deny", "play", "12.13.14.15");
|
|
|
|
|
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPlay, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("deny", "play", "11.12.13.14");
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsConfDirective* d = new SrsConfDirective();
|
|
|
|
|
d->name = "deny";
|
|
|
|
|
d->args.push_back("play");
|
|
|
|
|
d->args.push_back("12.13.14.15");
|
|
|
|
|
rules.directives.push_back(d);
|
|
|
|
|
}
|
|
|
|
|
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPlay, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("deny", "publish", "12.13.14.15");
|
|
|
|
@ -536,6 +558,16 @@ VOID TEST(AppSecurity, CheckSecurity)
|
|
|
|
|
rules.get_or_create("deny", "publish", "12.13.14.15");
|
|
|
|
|
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtmpConnHaivisionPublish, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("deny", "publish", "12.13.14.15");
|
|
|
|
|
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPublish, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("deny", "publish", "all");
|
|
|
|
|
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPublish, "11.12.13.14", &rr));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Allowed if not denied.
|
|
|
|
|
if (true) {
|
|
|
|
@ -568,6 +600,26 @@ VOID TEST(AppSecurity, CheckSecurity)
|
|
|
|
|
rules.get_or_create("deny", "publish", "12.13.14.15");
|
|
|
|
|
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtmpConnFlashPublish, "11.12.13.14", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("deny", "play", "12.13.14.15");
|
|
|
|
|
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPlay, "11.12.13.14", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("deny", "publish", "12.13.14.15");
|
|
|
|
|
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPlay, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("deny", "play", "all");
|
|
|
|
|
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPublish, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("deny", "play", "12.13.14.15");
|
|
|
|
|
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPublish, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Allowed by rule.
|
|
|
|
|
if (true) {
|
|
|
|
@ -580,6 +632,26 @@ VOID TEST(AppSecurity, CheckSecurity)
|
|
|
|
|
rules.get_or_create("allow", "play", "all");
|
|
|
|
|
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtmpConnPlay, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("allow", "play", "12.13.14.15");
|
|
|
|
|
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPlay, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("allow", "play", "all");
|
|
|
|
|
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPlay, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("allow", "publish", "all");
|
|
|
|
|
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPublish, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("allow", "publish", "12.13.14.15");
|
|
|
|
|
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPublish, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("allow", "publish", "all");
|
|
|
|
@ -629,6 +701,16 @@ VOID TEST(AppSecurity, CheckSecurity)
|
|
|
|
|
rules.get_or_create("allow", "publish", "12.13.14.15");
|
|
|
|
|
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtmpConnPlay, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("allow", "play", "11.12.13.14");
|
|
|
|
|
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPlay, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("allow", "publish", "12.13.14.15");
|
|
|
|
|
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPlay, "12.13.14.15", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("allow", "publish", "11.12.13.14");
|
|
|
|
@ -647,6 +729,12 @@ VOID TEST(AppSecurity, CheckSecurity)
|
|
|
|
|
rules.get_or_create("deny", "play", "11.12.13.14");
|
|
|
|
|
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtmpConnPlay, "11.12.13.14", &rr));
|
|
|
|
|
}
|
|
|
|
|
if (true) {
|
|
|
|
|
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
|
|
|
|
rules.get_or_create("allow", "play", "11.12.13.14");
|
|
|
|
|
rules.get_or_create("deny", "play", "11.12.13.14");
|
|
|
|
|
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPlay, "11.12.13.14", &rr));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SRS apply the following simple strategies one by one:
|
|
|
|
|
// 1. allow all if security disabled.
|
|
|
|
|