I work on a linux cluster that is behind a firewall. It does not have web access.
I had this idea I could try to run flask and direct it to a port I know is open (5901 for vnc), and then tunnel that port and view it in my browser.
It's not working so far. Is this possible at all?
Here is what I'm doing:
from flask import Flask
app = Flask(__name__)
return "Hello World!"
if __name__ == "__main__":
ssh -L 5901:<inner server>:5901 <outer server>
You can do this : Run your flask app or notebook on the remote server on any port. Say for example port 5000.
On your local machine run below command to establish the ssh tunnelling :
ssh -D 8123 -f -C -q -N username@remotesrrver
The port 8123 is arbitrary here it can be any allowed port on your local machine. Then setup one of your browser (Fire fox may be) to use socks proxy on port 8123 Make sure that the traffic is proxied for localhost also. By default Firefox disable proxying for localhost. Once these are established you should be able to go to http://localhost:5000 on your browser to hit the app /notebook running on the remote machine
And your hellowflask.py should be like something below for it to work
from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run(host='0.0.0.0', port=5901) #app.run()