Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mtproto_proxy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mtproto_proxy
Commits
fbe8cb59
Unverified
Commit
fbe8cb59
authored
Aug 13, 2019
by
Sergey Prokhorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow `any` in `tls_allowed_domains`.
parent
237f9f1d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
9 deletions
+21
-9
Makefile
Makefile
+4
-3
README.md
README.md
+1
-1
mtp_handler.erl
src/mtp_handler.erl
+8
-3
mtproto_proxy.app.src
src/mtproto_proxy.app.src
+3
-1
mtproto_proxy_app.erl
src/mtproto_proxy_app.erl
+5
-1
No files found.
Makefile
View file @
fbe8cb59
...
...
@@ -13,10 +13,11 @@ all: config/prod-sys.config config/prod-vm.args
.PHONY
:
test
test
:
$(REBAR3)
xref
$(REBAR3)
eunit
$(REBAR3)
ct
$(REBAR3)
proper
-n
50
$(REBAR3)
eunit
-c
$(REBAR3)
ct
-c
$(REBAR3)
proper
-
c
-
n
50
$(REBAR3)
dialyzer
$(REBAR3)
cover
-v
config/prod-sys.config
:
config/sys.config.example
[
-f
$@
]
&&
diff
$^
$@
||
true
...
...
README.md
View file @
fbe8cb59
...
...
@@ -258,7 +258,7 @@ You should disable all protocols other than `mtp_secure` by providing `allowed_p
Another censorship circumvention technique. MTPRoto proxy protocol pretends to be
HTTPS web traffic (technically speaking, TLSv1.3 + HTTP/2).
It's possible to only allow connections with this protocol by changing
`allowed_protocols`
to
be list with only
`mtp_fake_tls`
:
be list with only
`mtp_fake_tls`
. You may also want to check
`tls_allowed_domains`
option.
```
erlang
{
mtproto_proxy
,
...
...
src/mtp_handler.erl
View file @
fbe8cb59
...
...
@@ -359,9 +359,14 @@ maybe_check_replay(Packet) ->
check_tls_access
(_
Listener
,
_
Ip
,
#
{
sni_domain
:
=
Domain
})
->
%% TODO validate timestamp!
%% TODO some more scalable solution
AllowedDomains
=
application
:
get_env
(
?
APP
,
tls_allowed_domains
,
[]),
lists
:
member
(
Domain
,
AllowedDomains
)
orelse
error
({
protocol_error
,
tls_sni_domain_not_allowed
,
Domain
});
case
application
:
get_env
(
?
APP
,
tls_allowed_domains
,
any
)
of
any
->
%% No limits
true
;
AllowedDomains
->
lists
:
member
(
Domain
,
AllowedDomains
)
orelse
error
({
protocol_error
,
tls_sni_domain_not_allowed
,
Domain
})
end
;
check_tls_access
(_,
Ip
,
Meta
)
->
error
({
protocol_error
,
tls_no_sni
,
{
Ip
,
Meta
}}).
...
...
src/mtproto_proxy.app.src
View file @
fbe8cb59
...
...
@@ -60,7 +60,9 @@
%% Which domains to allow in TLS SNI
%% XXX: this option is experimental and will be removed later!
{tls_allowed_domains, [<<"en.wikipedia.org">>]},
%% Can be set to `any' to allow any domains.
%% {tls_allowed_domains, any},
{tls_allowed_domains, [<<"en.wikipedia.org">>, <<"s3.amazonaws.com">>]},
{init_dc_connections, 2},
{clients_per_dc_connection, 300},
...
...
src/mtproto_proxy_app.erl
View file @
fbe8cb59
...
...
@@ -173,7 +173,11 @@ build_urls(Host, Port, Secret, Protocols) ->
lists
:
map
(
fun
(
mtp_fake_tls
)
->
%% Print just for 1st domain as example
{
ok
,
[
Domain
|
_]}
=
application
:
get_env
(
?
APP
,
tls_allowed_domains
),
Domain
=
case
application
:
get_env
(
?
APP
,
tls_allowed_domains
)
of
{
ok
,
[
Domain0
|
_]}
->
Domain0
;
_
->
<<
"en.wikipedia.org"
>>
end
,
ProtoSecret
=
mtp_fake_tls
:
format_secret
(
Secret
,
Domain
),
MkUrl
(
ProtoSecret
);
(
mtp_secure
)
->
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment