Code Monkey home page Code Monkey logo

pypagekite's Introduction

pagekite.py

This is pagekite.py, a fast and reliable tool to make localhost servers visible to the public Internet.

For stable releases and quick-start instructions, please see: https://pagekite.net/downloads/

The full manual is in the docs/ folder, or visible on-line here: https://github.com/pagekite/PyPagekite/tree/main/doc

Note: This program is under active development and the contents of this repository may at times be somewhat unstable. Stable source releases are archived here: https://pagekite.net/pk/src/

pypagekite's People

Contributors

arnout avatar bjarnirunar avatar deshdeepak1 avatar erkan-yilmaz avatar gucci-on-fleek avatar lzap avatar pagekite avatar petterreinholdtsen avatar sunilmohanadapa avatar tanghus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pypagekite's Issues

Loggin to file in Windows doesn't work

setting
logfile=pagekite.log
in pagekite.rc on windows results in the pagekite.log file being created but nothing is written to it.

Using version 0.3.9 on WindowsXP with Python2.7 (compiled to exe with py2exe)

Pagekite FE 'unknown' fallback not available when using wildcard in --domain

I'd like to use the special 'unknown' hostname to catch unrecognised domains. It works as suggested in the README:
--domain=http,https:foo.bar.com:YOURSECRET --service_on=https:unknown:localhost:8090:
However, when using a wildcard, the local backend doesn't start and unrecognised domains aren't forwarded.
--domain=http,https:*.bar.com:YOURSECRET --service_on=https:unknown:localhost:8090:

Am I missing something in the Pagekite configuration to make this work? Thanks in advance!

pagekite.py should try more ports

Many firewalls block all outgoing ports except those used by standard services like http and https.
By default, pagekite.py as a bakend tries to connect to port 2222 on the frontend.
The default behaviour should be to try more ports if that fails like 443 and 80.

pagekite logs are cryptic

/var/log/pagekite/pagekite.log is very hard to read and as far as I understand mostly intended for developers. A sysadmin trying to figure out what's going on with the daemon will have a hard time making sense of the file.

Add QoS and bandwidth limits

It should be possible to limit how much bandwidth pagekite.py uses, and the tunnel streams should be managed in such a way that interactive (e.g. ssh) sessions are not throttled by long-running file transfers (QoS).

Wording on website

Hi.

Now that you have (or almost have) PageKite running on Android I think you should change the wording of the notification page when a service is not responding.

Currently it says:

The computer may have been turned off
The computer may be disconnected from the Internet
The PageKite program may not be running

Maybe it would be better to refer to services and/or devices?

Spelling error: tmporarily

In function HTTP_Unavailable
code, status = 302, 'Moved tmporarily'

Suggest: Temporarily

(and just testing this issue system)

Command-line args should override config file

I tried to specify a different port with --backend=http:NAME:localhost:10203:SECRET but port 80 was still used. Changing the port in the backend=... line in pagekite.rc worked. I expected the command-line argument to override the config file.

Bug in Debian 8 64bit with pyOpenSSL

Installed pagekite using aptitude with instructions for debian package (added to sources.list).

SSL passthrough would work for one or two requests, then disconnect (static assets failed to load with 503 error).

I manually edited /usr/share/pyshared/pagekite/compat.py and disabled support for pyOpenSSL by changing if socks.HAVE_PYOPENSSL: to if socks.HAVE_PYOPENSSL and False:. Now it works fine.

HTTPproxy over pagekite

Hi, how can i make an HTTPproxy server visible from internet using pagekite? thanks in advance

May I build my own PageKite service?

Hi there.
I have a server called A under firewall and another server that called B direct connect to Internet.
but server B cannot run my service.
so can I build my own PageKite service on server B?
Thanks.

pagekite.py should exit on errors

When running pagekite in daemon mode and letting it bind to ports that are already in use, it should exit with an error code instead of writing usage information to the logfile and keep running.

pagekite.py dies with Bus Error or Segmentation Fault when using openssl0.9.7

On some machines that have openssl0.9.7, pagekite causes python to segfault while initializing.

The problem happens in the (rather hackish) DisableSSLFunction. Somehow, CDLL does not properly load the openssl shared object, and python dies right at "openssl.sk_zero(openssl.SSL_COMP_get_compression_methods())"

Setting self.enable_sslzlib to True is a workaround on affected machines, albeit at the expense of an increase in memory consumption (since setting that variable to true effectively disables the hack).

A better solution would be to change the DisableSSLFunction so that it first tries to load an extension in C that disables ZLib compression, and only if this fails (i. e. if there is no such extension installed), then tries to do it via CDLL.

This bug has been discovered on a router running DD-WRT v24-sp2 with kernel 2.4.37 on a mipsel architecture processor (Broadcom BCM5354).

Incompatibility with Java v8

Situation:
Machine A (Running PageKite.py front-end-server) / We have created our own local network PageKite.py front-end-server exposed to internet. ( os - W7 professional).
Machine B (Running local web server)/ We have created our own local network PageKite.py back-end-client serving http/40000 and https/40443 to access local web server through PageKite.py reverse tunnel. (os –W7 embeded)

Procedure:
When we access Machine B/local web server through PageKite tunnel with Web browsers (Firefox/IExplorer/…) with HTTP or HTTPS protocol everything working fine.

When we access Machine B/local web server through PageKite tunnel with Web browsers (Firefox/IExplorer/…) with HHTP or HTTPS protocol and we are starting copy of java web application/ applet connected to local web server with "Java Web start /jp2launcher.exe" (Java version 7) - everything working fine.

When we access Machine B/local web server through PageKite tunnel with Web browsers (Firefox/IExplorer/…) with HTTP protocol and we are starting copy of java web application/ applet connected to local web server with “Java Web start /jp2launcher.exe” (Java version 8) - everything working fine.

When we access Machine B/local web server through PageKite tunnel with Web browsers (Firefox/IExplorer/…) with HTTPS protocol and we are starting copy of java web application/ applet connected to local web server with “Java Web start /jp2launcher.exe” (Java version 8) – Java resets connection - Java log says … TROW … it is not possible to download/start java applet/application. (Confirmed by WireShark capture.)

We tried to use Pagekite.me web service instead of our frond-end-server with exactly same results.
Do You have any evidence of incompatibility PageKite x Java v8?

Do you have any idea?
Can you solve this issue?
Many thanks for help.
Ivo Polasek

--daemonize fails to find certs

Pagekite works if I don't use --daemonize

./pagekite.py --optfile=./pagekite.rc --logfile=./log 

But if I call it with daemonize, I get errors about not able to find x X509 cert:

./pagekite.py --optfile=./pagekite.rc --logfile=./log --daemonize

Here is the error from the logfile:

ts=552e2968; t=2015-04-15T02:03:36; ll=43; err=Error in connect: Traceback (most recent call last):   File "<string>", line 464, in _BackEnd   File "<string>", line 324, in _Connect   File "<string>", line 1000, in connect   File "<string>", line 908, in __negotiatessl Error: [('system library', 'fopen', 'No such file or directory'), ('BIO routines', 'BIO_new_file', 'no such file'), ('x509 certificate routines', 'X509_load_cert_crl_file', 'system lib')]
ts=552e2968; t=2015-04-15T02:03:36; ll=44; err=Server response parsing failed: [('system library', 'fopen', 'No such file or directory'), ('BIO routines', 'BIO_new_file', 'no such file'), ('x509 certificate routines', 'X509_load_cert_crl_file', 'system lib')]; id=s0
ts=552e2968; t=2015-04-15T02:03:36; ll=45; eof=1; id=s0

In contrast, the log from the working run looks like:

started=./pagekite.py; ll=0; optfile_/home/joe/.pagekite.rc=ok; ts=552e29c7; argv=--optfile=./pagekite.rc --logfile=./log; optfile_./pagekite.rc=ok; platform=linux2; version=0.5.6d; t=2015-04-15T02:05:11; ca_certs=./pagekite.py
info=Collecting entropy for a secure secret.; ll=1; ts=552e29c7; t=2015-04-15T02:05:11
debug=Seeded signatures using /dev/urandom, hooray!; ll=2; ts=552e29c7; t=2015-04-15T02:05:11
debug=UiComm: Created; ll=3; ts=552e29c7; t=2015-04-15T02:05:11
ts=552e29c7; t=2015-04-15T02:05:11; ll=4; debug=Entering main epoll loop

hello there

I have posted this to ngrok , I repost it here..

My problem it how to improve user experience with web access. by more autonomous system.
I mean each time ngrok assign a subdomain to web server, there should be an option to execute a command to push that subdomain to some " static mail box" so that web client , in my case android webview, can auto connect to the correct sub domain. Something like DDNS but the trick is ngrok will post a special request to web server so that the server know its serving subdomain and server then place a message to the ''static mail box". (Of course this will involve SSL and CA for both ngrok and web server.....).
As of my infer, this kind of inform action seem "fairer" to the web server as until now, server is dumb with respect to its hosting and serving environment. Less but not least, another problem arise is when I am using Facebook SDK Oauth2. It require app to register the domain with Facebook. This is obvious off scope. It would be more simple with static DNS, but will it be, in the near future, a "meta data protocol" for Facebook to update app registering domain the same mechanism as the web server upon receiving this special request?
Can this expand to be an extension to Web standard, who know?
Sun

(P/s sorry I forget to mention about CGI. Now CGI feel outdated, the trend is JSON, REST, DDNS, OAuth like in-house vs out source....)

pagekite.py doesn't start if Python 3 is the default Python

Thanks for your tool guys!

On my Linux distro, the first line of pagekite.py

#!/usr/bin/python

resolves to Python 3 . I think we can change this generated line to

#!/usr/bin/env python2

This would also allow the use of virtualenv.

What do you guys think?

PageKite Connectivity Issue

Hello,

I am facing an issue wherein I am able to connect from some back-ends (using both domain name and ip address) but not able to connect from others (with domain name) but could connect using ip address of the front-end server. I am using my own front-end server. All this is setup internally within my corporate network. I have no clue what is causing this. I am not sure if this is to do with the front-end or back-end setup. Can anyone help me out?

Regards,
Bis

SyntaxError: Missing parentheses in call to 'exec' (sockschain)

Downloaded latest pagekite.py, tried with Python 3.4.3 and 2.7.x

./pagekite.py --signup
  File "./pagekite.py", line 254
    exec __FILES[".SELF/sockschain/__init__.py"] in m.__dict__
               ^
SyntaxError: Missing parentheses in call to 'exec'

Am I missing a library (or a use flag on Gentoo)?

Map non-standard ports to specific ports?

Is there a way to map multiple arbitrary ports to multiple arbitrary ports? For example, imagining I want to map my local ports 5432, 5433 and 5434 to 5000, 6000, 7000?

I'm using a program that exposes 4 non-standard ports (remote access surveillance system) and the client software looks exclusively for those 4 ports. Neither piece is configurable, unfortunately.

Offer an (optionnal) cache mechanism

I don't know if this should be in pagekite (or in a pagekite architecture) but it would be nice to switch to a cached version of the site when it is offline.

Again, making it optionnal.

Added cool things :

  • have a banner stating that it is the offline version
  • should information about when this cached version was made
  • disable interactions (safeguards for POST for example would be a start)

Support rapid network switching

Currently pagekite.py will probably not do the right thing if you switch from one network to another - if the back-end doesn't manage to close its tunnels before switching, the front-end may think the tunnels are alive and reject the new connections until something times out.

This can be fixed by assigning a random token to each tunnel - when reestablishing a tunnel, the same token would be sent and the front-end could know it is talking to the same back-end and that it is safe to tear down and replace the defunct tunnel.

We do not want to blindly replace established tunnels though, because running two back-end pagekites with the same config could lead to an infinite loop of tunnels being bounced from one to the other.

Support IRCv3 CAP LS as first command in IRC connection

From what I understand IRC connections currently fail if the client sends a CAP LS before PASS or NICK. However almost any client supporting IRC v3 will send CAP LS before anything else, meaning it will fail to connect. CAP LS is sent before anything else since it might affect the negotiation as capabilities are added (so any other CAP command may follow before NICK or PASS is sent).

See also http://ircv3.net/specs/core/capability-negotiation-3.1.html#the-cap-ls-subcommand

Unexpected EOF Loop

This suddenly started happening (and it's not the first time) - and it's not the first time:

ts=4ee28cda; debug=Pinged 69.164.211.158:443: 0.211176
ts=4ee28cda; info=TLS is provided by pyOpenSSL
ts=4ee28cda; debug=Cert OK: frontends.b5p.us/fa85539cf284d5fb20e14f0f5ea7b046bf2beb61
ts=4ee28cda; debug=TLS connection to 173.230.155.164:443 OK
ts=4ee28cda; info=TLS is provided by pyOpenSSL
ts=4ee28cda; debug=Cert OK: frontends.b5p.us/fa85539cf284d5fb20e14f0f5ea7b046bf2beb61
ts=4ee28cda; debug=TLS connection to 173.230.155.164:443 OK
ts=4ee28cda; FE=173.230.155.164:443; err=Rejected; proto=http; reason=None; domain=lectureleaks.pagekite.me; id=s31
ts=4ee28cda; connect=173.230.155.164:443
ts=4ee28cda; debug=Error reading socket (SSL): (-1, 'Unexpected EOF'); id=s31
ts=4ee28cda; wrote=674; wbps=993; read=1341; eof=1; id=s31

Over and over again..

?

Feature Request: Dynamic addition/deletion on pagekite servers

Can we please have dynamism on the pagekite server -- allow additions and deletions of frontends using a script instead of modifying the 20_frontends file and then restarting pagekite. That would save us a lot of trouble since our users are not valid all the time (and we have to restart our pagekite server).

Pagekite output disabled when directed to stdout (or listened to by another app)

Running pagekite.py from the command line (without any args) will start a nice output starting with

Hello! This is pagekite.py v0.5.6d...

CTRL-C will close pagekite.

Running pagekite.py > out.log starts pagekite and shows nothing on the screen; CTRL-C stops pagekite; then looking at out.log there is nothing there.

So, if stdout is redirected, pagekite has no output. There are a few places where the code checks if _sys.stdout.isatty()_ and, in one of those places, it forces --nullui. This is almost certainly where the problem is, although the other checks for isatty would need to be addressed as well.

Please provide some mechanism -- perhaps a flag like --tty or --stdout -- so that calling apps can watch pagekite output for success, failure, and status messages. For me, having different behavior when stdout is redirected feels broken. I expected that stdout output would be the same regardless of whether stdout is tty or not. However, I realize maybe there's a good reason for the current design and that changing the default behavior may break existing use cases. A flag that lets me force the normal stdout UI would address my use case.

FWIW, I did try "shell", but that opened an interactive prompt that needed further input

>>> The PageKite Shell                                        [CTRL+C = Cancel]

    Press ENTER to fly your kites or CTRL+C to quit.  Or, type some
    arguments to and try other things.  Type `help` for help.

  $ pagekite.py 

and didn't actually do what I needed. In fact, pagekite.py --shell > out.log produces the following error:

Traceback (most recent call last):
  File "/home/joe/pageKite/pagekite.py", line 2110, in <module>
    http_server=httpd.UiHttpServer)
  File "<string>", line 3299, in Main
  File "<string>", line 3328, in Shell
  File "<string>", line 108, in AskQuestion
  File "<string>", line 92, in DefaultOrFail
pagekite.common.ConfigError: Unanswerable question: pagekite.py

So... arguably that's the "correct" bug for this issue, depending on how you want to support the use case.

FWIW, I found this by watching stdout when invoking pagekite from node.js's child_process.spawn(). Pagekite runs as expected, but I never saw anything on child.stdout.

--host is ignored for IPv6 listeners

pagekite appears to be ignoing the address I specify in --host when it binds to the https port.

According to the logs pagekite thinks it's binding to the correct address, but in fact when you look at netstat it has actually bound to the global :::443.

This is a problem because it means that despite having 2 separate IPs so pagekite uses one and my actual webservers use the other, pagekite still conflicts with the https port my websites use.

Here's the relevant netstat output:

$ sudo netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 10.0.1.6:80             0.0.0.0:*               LISTEN      11558/python    
...
tcp6       0      0 :::443                  :::*                    LISTEN      11558/python    
...

As you can see 11558 is pagekite.

sudo systemctl status pagekite
● pagekite.service - LSB: PageKite system service
   Loaded: loaded (/etc/init.d/pagekite)
   Active: active (running) since Thu 2016-02-04 19:00:46 UTC; 7min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 11388 ExecStop=/etc/init.d/pagekite stop (code=exited, status=0/SUCCESS)
  Process: 11408 ExecStart=/etc/init.d/pagekite start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/pagekite.service
           ├─11418 /usr/bin/daemon --pidfile /var/run/pagekite.pid.wrapper --noconfig --unsafe --respawn --delay=60 --name=pagekite -- ...
           └─11558 /usr/bin/python /usr/bin/pagekite --pidfile /var/run/pagekite.pid --clean --runas=daemon:daemon --logfile=/var/log/p...

Here is my config (/etc/pagekite.d/20_frontends.rc):

#################################[ This file is placed in the Public Domain. ]#
# Front-end selection
#
# Front-ends accept incoming requests on your behalf and forward them to
# your PageKite, which in turn forwards them to the actual server.  You
# probably need at least one, the service defaults will choose one for you.

# Use the pagekite.net service defaults.
# defaults

# If you want to use your own, use something like:
#     frontend = hostname:port
# or:
#     frontends = COUNT:dnsname:port

isfrontend
runas=www-data:www-data
host=10.0.1.6
ports=80,443
protos=http,https
domain=http,https:...

And here's part of the pagekite log during startup:

started=/usr/bin/pagekite; ll=0; ts=56b3a092; argv=--pidfile /var/run/pagekite.pid --clean --runas=daemon:daemon --logfile=/var/log/pagekite/pagekite.log --optdir=/etc/pagekite.d --noloop; platform=linux2; version=0.5.8a; t=2016-02-04T19:03:46; ca_certs=/etc/ssl/certs/ca-certificates.crt; optfile_/etc/pagekite.d/20_frontends.rc=ok
info=Collecting entropy for a secure secret.; ll=1; ts=56b3a092; t=2016-02-04T19:03:46
debug=Seeded signatures using /dev/urandom, hooray!; ll=2; ts=56b3a092; t=2016-02-04T19:03:46
debug=UiComm: Created; ll=3; ts=56b3a092; t=2016-02-04T19:03:46
id=s0; ll=4; listen=10.0.1.6:80; ts=56b3a092; t=2016-02-04T19:03:46
id=s1; ll=5; listen=10.0.1.6:443; ts=56b3a092; t=2016-02-04T19:03:46
ts=56b3a092; t=2016-02-04T19:03:46; ll=6; uid=33; gid=33
ts=56b3a092; t=2016-02-04T19:03:46; ll=7; debug=TunnelManager: loop #1, interval=5

DynDNS and proxy errors

the http object used in pagekite honours the system wide proxy settings. If that proxy requires authentication the dyndns update will fail with an error. pagekite will repeatedly keep trying.

Should stop trying or fall back to a slower rate.

Pagekite deb repo cannot be installed on 16.04 LTS

Pagekite is no longer installable via the deb package anymore on Ubuntu 16.04 LTS.

It seems that the python-support package no longer exists. Ubuntu's python-socksipychain package does not depend on it, however the Pagekite repo overrides python-socksipychain with a version that does depend on python-support but does not provide a python-support package to go with it.

$ sudo apt-get install pagekite
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 pagekite : Depends: python-support (>= 0.90.0) but it is not installable
            Depends: python-socksipychain (>= 2.0.15) but it is not going to be installed

Misbehaving front-ends can lock up back-ends

Due to the fact that connecting to a new front-end is a blocking process which is done on the main loop, a misbehaving front-end can effectively block a back-end pagekite process. The connection and reconnection code needs to be moved to a different thread.

Unexpected files in pagekite-0.5.8a.tar.gz

pagekite-0.5.8a.tar.gz contains artifacts of a Debian build in /debian/pagekite/
/debian/ in general is not needed anymore as Pagekite has been included in Debian

Also, scripts/pagekite_gtk requires icons from the gui/ directory, which is missing.

Python 3 support

Python 3 is not supported. Would be great to support the new python version as python web site encourage people to download python 3 instead of python 2.7

Collect statistics about when the kit is flying to give information on "when to come back"

PageKite is awesome for "temporarily" available websites.

It would be great if the "Please try again later." could be more specific about when the web site is on. This would resemble "opening hours" like a physical place... Displaying the uptime of the website on a timeline could be a plus.

This could be optionnal (since it involves collecting data some users don't want to give away).

Spec file issue

I was rebuilding the latest srpm from pagekite on my pidora (Fedora for Raspberry PI) because the one in the pidora repos is quite old when I noticed the following:

Traceback (most recent call last):
File "setup.py", line 4, in
from setuptools import setup
ImportError: No module named setuptools
error: Bad exit status from /var/tmp/rpm-tmp.aYYWai (%build)

After some googling (not a python guy) I found out this is fixable by installing the python-setuptools package. Hence I suggest the following change to the spec file:

--- pagekite.spec.orig 2014-10-08 18:18:41.904090321 +0000
+++ pagekite.spec 2014-10-08 18:22:09.862125229 +0000
@@ -16,6 +16,7 @@
BuildArch: noarch
Vendor: PageKite Packaging Team [email protected]
Requires: python-SocksipyChain
+BuildRequires: python-setuptools
Url: http://pagekite.org/

%description

This just adds the python-setuptools package as a build time only dependancy making rpmbuild exit neatly and telling the user exactly what is wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.