guardianproject / lildebi

UNMAINTAINED please adopt! we can no longer maintain this
https://guardianproject.info/code
GNU General Public License v3.0
226 stars 55 forks source link

Open port #67

Closed Almazick closed 10 years ago

Almazick commented 10 years ago

Installed today a full blown LNMP server (nginx, mysql, php) and it works great using wheezy armhf stable. I'm using Tmobile Galaxy S3 and now I'd like to be able to access my web server thru 4G connection. Now I have no idea how to access webserver from 4G connection. So far I tried the following in android 4.1.2

iptables -I INPUT -s 11.22.33.44.55 -p tcp --dport 80 -j ACCEPT so I got an error "FIX ME! implement getprotobyname() bionic/libc/bionic/stubs.c:484"

Then I checked iptable by the following command iptables -L INPUT -nv and it looks like iptables got set, it's showing that port 80 is open. Now what m'I missing? What's the proper way to set iptables to be able to see web server from outside using 4G? Thank you in advance

eighthave commented 10 years ago

Looks like you're running iptables in the Android shell rather than the Debian shell. Android uses Bionic libc, which is a really minimal libc that is missing lots of things. That error message about getprotobyname() is saying that function is not implemented in Bionic libc. Luckily that function is not essential to working with iptables. That function just converts protocol names like tcp to a number (tcp == 6). Use the number instead:

iptables -I INPUT -s 11.22.33.44.55 -p 6 --dport 80 -j ACCEPT

For more info: http://stackoverflow.com/questions/10331699/getprotobyname-error-iptables

I should also mention, you can install iptables in Debian, then use that command in Debian, and it will use Debian's complete GNU libc. Then you can use p tcp in the command line.

Almazick commented 10 years ago

Thank you for your response but I did try that before posting a question. Unfortunately I'm unable to connect to my device using 3G/4G. I installed webmin as well which is using default port 10000. Any suggestions?

eighthave commented 10 years ago

there might be a separate Android permission for opening a port on the 3G/4G. Android permissions are implemented as Linux groups (e.g. you already added mysql to inet to get Internet permissions), so you'd need to find the right group to add the mysql/webmin/etc. user to.

Another possibility is that your provider does not allow you to host servers and they're blocking ports.

eighthave commented 10 years ago

This sounds like an interesting project you're working on, I hope you document it somewhere like a blog or whatever. I'd like to see what you are doing :)

Almazick commented 10 years ago

I had VPS server before and I was wondering if it's possible to run the same server on the phone. Searched for apps on Google Play and some of them work but missing a lot options which linux provide. For example simple curl option is not available. Some offer only basic http server and some offer php/mysql but missing a lot of needed modules to run a website. I tried Lil Debi just to see if it's even possible. So far everything is working great once you helped me out to resolve the issue with mysql. Now I can run anything on LNMP/LAMP server such as Joomla, WordPress. The only problem I don't know how to forward traffic, assuming Tmobile don't block port 80.