felixlu / jap

Automatically exported from code.google.com/p/jap
0 stars 0 forks source link

[Tutorial] Connect to Minecraft on Openshift via JAP #44

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Why?

1. I want to play minecraft with my family (<5 people, live in different 
places) on my own server. So to setup minecraft server on Openshift and have to 
setup ssh port-forwoding.
2. GFW block ssh to Openshift (in some areas?), or maybe make the connection 
worse like it fu*ks Google service. Have to connect via proxy.
3. Why can only JAP on Openshift help to do that? Because of certificate 
problem on GAE, ssh can not connect successfully via GAE based proxies. Or 
maybe I do not know the correct ssh configure. Hope someone can help.

Setup?

1. Full Data Chain
a) Directly
minecraft_client--ssh--minecraft_openshift_server
b) Via Some HTTP Proxy
minecraft_client--ssh--corkscrew--http_proxy--minecraft_openshift_server
c) Via JAP Socks Proxy
minecraft_client--ssh--corkscrew--privoxy--jap--minecraft_openshift_server

2. Environment
a) Client Deployment OS: Archlinux + LXDE
b) Client Deployment Tools: git + openssh + ruby (gem install rhc)

3. Server
Setup Free Minecraft Server Hosting on Openshift (good for family survival 
island mode)
Tutorial: https://www.openshift.com/blogs/paas-free-minecraft-server-hosting
Tips:
1) Follow exactly the steps.
2) DO NOT download the attachment. It's just the original files. Delete all the 
original content of "start" and "stop" and then copy the scripts into them and 
save. After that, better to run:
$ chmod -R +x .openshift/action_hooks  # notice the working path
3) If your 'tail minecraft.log' does not show the similar words, try to restart 
the app some times:
$ rhc app restart minecaft

4. Proxy
Deploy JAP on Openshfit (better with another account)
Wiki: https://code.google.com/p/jap/wiki/JAP_WS_REMOTE#JAP_WS_REMOTE_OPENSHIFT
Tips:
1) Depend packages (Archlinux): python2 + python2-pyopenssl + python2-crypto + 
twisted + python2-pip (pip2 install autobahn)
2) Follow EXACTLY the wiki

3. Tools
a) ssh
Openshift CLI needs ssh and need it to port-forward.
ssh can only use other tools to setup proxy (see 'man ssh_config'), so edit ssh 
config:
$ nano .ssh/config
Host *
ProxyCommand corkscrew 127.0.0.1 8118 %h %p
(it means ssh use corkscrew to proxy, and corkscrew tunnels data to the http 
proxy of privoxy 127.0.0.1:8118)

b) corkscrew
Corkscrew is a tool for tunneling SSH through HTTP proxies.
http://www.agroman.net/corkscrew/
Just install it, do not need to config. (Some tutorial says netcat can work 
too, but I can not setup successfully.)
But it turn out a problem: JAP is a socks proxy! so we need privoxy.

c) privoxy
Privoxy is a good tool to block ads and unify proxies setup.
http://www.privoxy.org/
Setup privoxy to forward JAP:
$ sudo nano /etc/privoxy/config
forward-socks5 / 127.0.0.1:1080 . # be aware of the '.'

Run?

1. Make sure your server is running properly.
ssh into your app machine to check 'tail diy-0.1/logs/minecraft.log'
2. Run JAP (see wiki above).
3. Run privoxy
$ sudo systemctl start privoxy # archlinux
4. Run rhc port-forward
$ rhc port-forward minecraft
Or run ssh directly such as
ssh -N -L 127.8.231.129:8080:127.8.231.129:8080 
a133b23e3f2644b8a2121eaf6801xxxx@minecraft-spminecraft.rhcloud.com
5. Run minecraft client
http://minecraft.net/

(If you and family do not want to or have not yet pay for minecraft, set 
minecraft server.properties 'online-mode' to false.)

Original issue reported on code.google.com by westmin...@gmail.com on 24 Apr 2013 at 5:34

GoogleCodeExporter commented 8 years ago
Wow, awesome :))
You write very good articles! Do you want to write articles for the JAP wiki?

Original comment by jeroen.v...@gmail.com on 24 Apr 2013 at 7:38

GoogleCodeExporter commented 8 years ago
Thanks. My written English is poor. I'm just an end-user can do some feedback 
job and share my usage.

Original comment by westmin...@gmail.com on 25 Apr 2013 at 2:44

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
TO west...
So do I. However, the questions as follows:
1. Do you have interests in JAP or APJP projects?
The answer is so obvious.
2. Do you want to help Jeroen make them a little better?
You cannot deny it. :P
3. Do you have some spare time on them?
It is your decision. Whereas, it is the key problem for me and Jeroen. :(

BTW, if you want, you can write them in Chinese, since Jeroen can not 
understand Chinese and English wiki may withdraw some potential Chinese users.

TO Jeroen
Could you add him as the contributors of both JAP and APJP project?

Last but not least, feel free to do what you want to do. :P

Original comment by goknmuse on 25 Apr 2013 at 5:13

GoogleCodeExporter commented 8 years ago
west.., your english is good :)
If you want I can add you to the project so you can add your articles to the 
wiki.
I think your experience can help a lot of people!

Original comment by jeroen.v...@gmail.com on 25 Apr 2013 at 7:32

GoogleCodeExporter commented 8 years ago
To goknmuse
1. Why I'm not suitable to write wiki
a) I'm not a programmer and just learn to use some commands in terminal since 
using Archlinux during my free time just like anyone else to play online games 
for entertainment.
b) My English is indeed poor, so
2. Why I'm always use English here
a) Practice my English
b) For private I DO NOT want more people to use APJP/JAP cause GFW will block 
it soon if widely used. So make it small group using.
To jeroen
If you don't mind, I can put my experience articles to wiki with the prefix 
[Westmin] to make users know it's not the official installations or deployments.

Original comment by westmin...@gmail.com on 27 Apr 2013 at 1:52

GoogleCodeExporter commented 8 years ago
TO west... :P
>>"I'm not a programmer"
Same here, and much worse for me.
1. My major is Chemistry related, and have little connection with computer. :)
2. Three years ago, I rarely accessed to use computer, not even to mention a 
computer with internet accessible.

>>"My English is indeed poor"
Hold the opposite view. English was my worst drawback. I had tried twice to 
pass College English Test 4, and passed it with a very low score. :(
However, I don't think I am poor in English any more. :P

>>" For private I DO NOT want more people to use APJP/JAP cause GFW will block 
it soon if widely used. So make it small group using."
It is understandable.

One more thing, because of personal reasons, I gotta to focus on my major 
studies.

Original comment by goknmuse on 27 Apr 2013 at 5:51

GoogleCodeExporter commented 8 years ago
west.., I have added you to the project, you now can create/update/delete wiki 
articles :)

I have tested JAP_PYTHON-2.0.0-SNAPSHOT-2 with proxy servers from 
http://spys.ru/en/https-ssl-proxy/. I have no problems.
Can you also test?

Original comment by jeroen.v...@gmail.com on 27 Apr 2013 at 2:31

GoogleCodeExporter commented 8 years ago
Nope. It turns out the same output no matter CN father proxies or other country.

Original comment by westmin...@gmail.com on 27 Apr 2013 at 3:19

Attachments:

GoogleCodeExporter commented 8 years ago
Can you test with JAP_PYTHON-2.0.0-SNAPSHOT-2 (released 25/04/2013)?
I updated the HTTP/SOCKS5 tunnel in JAP_PYTHON-2.0.0-SNAPSHOT-2.

Original comment by jeroen.v...@gmail.com on 27 Apr 2013 at 4:18

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Thanks.
Only a few proxies of http://spys.ru/en/socks-proxy-list/ can work.
No different effect between the new JAP_PYTHON and JAP_WS_LOCAL_PYTHON.
That is if the socks5 father proxy works in JAP_PYTHON, it can work in 
JAP_WS_LOCAL_PYTHON too.

Original comment by westmin...@gmail.com on 28 Apr 2013 at 1:48

GoogleCodeExporter commented 8 years ago
I have tested a few SOCKS5 proxy servers from 
http://spys.ru/en/socks-proxy-list/, without problems (but some are sloooow).
What SOCKS5 proxy servers do not work?
Maybe GFW blocks those SOCKS5 proxy servers? Have you tested those SOCKS5 proxy 
servers without JAP?

Original comment by jeroen.v...@gmail.com on 28 Apr 2013 at 9:25

GoogleCodeExporter commented 8 years ago
** For http & https
http://spys.ru/free-proxy-list/CN/
most of them work with directly setup in firefox configure 
and work as father proxy of APJP 
but none works for JAP (JAP_PYTHON & JAP_WS_LOCAL_PYTHON)
** For socks5
most of them work with directly setup in firefox confugure
and APJP does not support socks5
but none works for JAP_WS_LOCAL_PYTHON, only one or two work for JAP_PYTHON 
after trying many times

Original comment by westmin...@gmail.com on 29 Apr 2013 at 3:22

GoogleCodeExporter commented 8 years ago
I have created a test for the JAP tunnel protocol: 
https://github.com/jvansteirteghem/jap/tree/master/TEST_PYTHON

I have tested HTTP and SOCKS5 proxies. When I can not connect to a proxy, I 
retry a couple of times, and then I can connect. So I think not all proxies are 
stable?

REMARK:
in TEST.json, PROXY_SERVERS.TYPE can be HTTP or SOCKS5 (not HTTPS)

Original comment by jeroen.v...@gmail.com on 3 May 2013 at 6:49