MTProxy icon indicating copy to clipboard operation
MTProxy copied to clipboard

Aws amazon

Open isdarktarget opened this issue 6 years ago • 6 comments

Why can not I connect to a proxy that runs on aws? proxy is running on server but i cant connect in client The problem is from Amazon or I have made a mistake ?

isdarktarget avatar Sep 09 '18 13:09 isdarktarget

Probably you did everyting right. Just check AWS firewall settings (Security Group) to allow connection to the port you have specified in -H (default is 443 tcp) and consider option --nat-info <local address>:<external address> to be added to startup script, as AWS tend to be behind NAT.

kurashovp avatar Sep 12 '18 10:09 kurashovp

It would be super nice to add a hint about --nat-info in readme file.

Rmaan avatar Jul 25 '19 14:07 Rmaan

@kurashovp can you please elaborate more on the solution. where and how did you add --nat-info PRIVATE_IP:STATIC_REMOTE_IP

muenze8 avatar May 21 '20 00:05 muenze8

@isdarktarget @muenze8, executing ./mtproto-proxy --help | grep --nat-info returns this:

--nat-info <arg>    <local-addr>:<global-addr>    network address translation for RPC protocol handshake

As AWS services are always in a private network, a.k.a. VPC, your instance, whether it is an EC2 or Lightsail instance, it must have a private IP associated to it (either automatically by AWS, or manually by your company or even yourself!). Here's how you can find it on different services:

Finding Public and Private IPs on Lightsail

  • Web Interface: Screenshot_2021-03-01 Ubuntu_new-dashboard – Connect Lightsail
  • SSH
    • Private IP: If you're connected to your instance through SSH, you can find its private IP by executing hostname command, which returns name of your instance which contains, by default, your instance private IP address in the form ip-A-B-C-D. Hence, its private IP will be A.B.C.D.
    • Public IP: You can find your public IP address by executing curl ifconfig.me/ip which returns your instance public IP address.

Finding Public and Private IPs on EC2

  • Web Interface: Screenshot_2021-03-01 Instance details EC2 Management Console

  • SSH

    • Private IP: execute ip addr | awk '/inet / {sub(/\/.*/, "", $2); print $2}' | head -n 2 | tail -n 1 should return your instance private IP address.
    • Public IP: execute curl ifconfig.me/ip should print your instance public IP address.

Okay, now you got both private and public IP addresses of your instance. Execute ./mtproto-proxy [...options] with --nat-info <private-ip>:<public-ip> with <private-ip> and <public-ip> you obtained from previous steps.

Hope it helps!

xeptore avatar Mar 01 '21 05:03 xeptore

[72447][2022-09-24 11:50:31.212422 local] Invoking engine mtproxy-0.01 compiled at Sep 24 2
022 11:36:26 by gcc 9.4.0 64-bit after commit dc0c7f3de40530053189c572936ae4fd1567269b
[72447][2022-09-24 11:50:31.213317 local] config_filename = 'proxy-multi.conf'
[72447][2022-09-24 11:50:31.216671 local] creating 1 workers
READ: Resource temporarily unavailable
mtproto-proxy: common/pid.c:42: init_common_PID: Assertion `!(p & 0xffff0000)' failed.
[pid 72447] [time 1664020231] 
------- Stack Backtrace -------
./mtproto-proxy(print_backtrace+0x31)[0x560ca690bcc1]
./mtproto-proxy(extended_debug_handler+0x14)[0x560ca690be44]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x14420)[0x7fa74e229420]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7fa74e06600b]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7fa74e045859]
/lib/x86_64-linux-gnu/libc.so.6(+0x22729)[0x7fa74e045729]
/lib/x86_64-linux-gnu/libc.so.6(+0x33fd6)[0x7fa74e056fd6]
./mtproto-proxy(+0x50c21)[0x560ca690fc21]
./mtproto-proxy(engine_init+0xf4)[0x560ca6905d74]
./mtproto-proxy(default_main+0x113)[0x560ca6906c43]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7fa74e047083]
./mtproto-proxy(_start+0x2e)[0x560ca68d183e]
[pid 72447] [time 1664020231] -------------------------------
[pid 72447] [time 1664020231] mtproxy-0.01 compiled at Sep 24 2022 11:36:26 by gcc 9.4.0 64
-bit after commit dc0c7f3de40530053189c572936ae4fd1567269b[pid 72447] [time 1664020231] 
ubuntu@ip-XXXXXX:~/MTProxy/objs/bin$ mtproto-proxy: common/pid.c:42: init_common_PID: 
Assertion `!(p & 0xffff0000)' failed.
[pid 72448] [time 1664020231] 
------- Stack Backtrace -------
./mtproto-proxy(print_backtrace+0x31)[0x560ca690bcc1]
./mtproto-proxy(extended_debug_handler+0x14)[0x560ca690be44]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x14420)[0x7fa74e229420]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7fa74e06600b]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7fa74e045859]
/lib/x86_64-linux-gnu/libc.so.6(+0x22729)[0x7fa74e045729]
/lib/x86_64-linux-gnu/libc.so.6(+0x33fd6)[0x7fa74e056fd6]
./mtproto-proxy(+0x50c21)[0x560ca690fc21]
./mtproto-proxy(engine_init+0xf4)[0x560ca6905d74]
./mtproto-proxy(default_main+0x113)[0x560ca6906c43]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7fa74e047083]
./mtproto-proxy(_start+0x2e)[0x560ca68d183e]
[pid 72448] [time 1664020231] -------------------------------
[pid 72448] [time 1664020231] mtproxy-0.01 compiled at Sep 24 2022 11:36:26 by gcc 9.4.0 64
-bit after commit dc0c7f3de40530053189c572936ae4fd1567269b[pid 72448] [time 1664020231] 

Drjacky avatar Sep 24 '22 11:09 Drjacky

I commented assert (!(p & 0xffff0000)); and it works now: https://github.com/GetPageSpeed/MTProxy/commit/1268005c72bb792701dc25011144fac4338fbb6b

Drjacky avatar Sep 24 '22 12:09 Drjacky