liftoff / GateOne

Gate One is an HTML5-powered terminal emulator and SSH client
http://liftoffsoftware.com/Products/GateOne
Other
6.28k stars 924 forks source link

Not to Connect to GateOne Server through Javascript #279

Closed vsasikiran closed 11 years ago

vsasikiran commented 11 years ago

![Uploading GateOne.png . . .]() Hi,

I am not able to connect to the GateOne through Gateone.init(...) while using it in HTML. But i'm able to access it directly through the server URL with port Eg. https://:443/

Even while running the ./hello_embedded_world.py i am not able to connect to the GateOne server.

Below are the steps which i've followed.

My Html file:

```
```

Server console:

root@Chefhandson106:/opt/gateone# ./gateone.py [W 130730 05:39:47 appterminal:2068] dtach command not found. dtach support has been disabled. [I 130730 05:39:47 gateone:3319] Gate One 1.2.0 [I 130730 05:39:47 gateone:3320] Tornado version 3.1 [I 130730 05:39:47 gateone:3340] Connections to this server will be allowed from the following origins: '' [I 130730 05:39:47 gateone:2393] No authentication method configured. All users will be ANONYMOUS [I 130730 05:39:47 gateone:2509] Loaded plugins: help [I 130730 05:39:47 gateone:3456] Listening on https://_:443/ [I 130730 05:39:47 gateone:3465] Process running with pid 17198

Server.conf:

// This is Gate One's main settings file. { // "gateone" server-wide settings fall under "" "": { "gateone": { // These settings apply to all of Gate One "address": "", "ca_certs": null, "cache_dir": "/tmp/gateone_cache", "certificate": "certificate.pem", "combine_css": "", "combine_css_container": "#gateone", "combine_js": "", "cookie_secret": "YzI5NzVkMzgxOTZmNDY5NGI2ODI5ZWNiNTVkMDg2ODRjY", "debug": false, "disable_ssl": false, "embedded": false, "enable_unix_socket": false, "gid": "0", "https_redirect": false, "js_init": "", "keyfile": "keyfile.pem", "locale": "en_US", "log_file_max_size": 100000000, "log_file_num_backups": 10, "log_file_prefix": "/opt/gateone/logs/webserver.log", "log_to_stderr": null, "logging": "info", "origins": "*", "pid_file": "/tmp/gateone.pid", "port": 443, "session_dir": "/tmp/gateone", "session_timeout": "5d", "syslog_facility": "daemon", "syslog_host": null, "uid": "0", "unix_socket_path": "/tmp/gateone.sock", "url_prefix": "/", "user_dir": "/opt/gateone/users", "user_logs_max_age": "30d" } } }

Please help me regarding this.

Thanks, Sasikiran

vsasikiran commented 11 years ago

Please find the error on server console

On server console:

[I 130730 07:05:15 gateone:1162] WebSocket closed (ANONYMOUS 10.43.3.110). [I 130730 07:05:20 app_terminal:380] Active Terminal Plugins: bookmarks, convenience, example, html, logging, logging_plugin, mobile, notice, playback, ssh [E 130730 07:05:20 websocket:306] Uncaught exception in /ws Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/tornado/websocket.py", line 303, in wrapper return callback(_args, *_kwargs) File "./gateone.py", line 1047, in open origin = origin.split('://', 1)[1] IndexError: list index out of range [I 130730 07:05:20 gateone:1162] WebSocket closed (ANONYMOUS 10.43.3.110).

liftoff commented 11 years ago

Hmm... Probably a bug in the 1.1 code. I recommend grabbing the latest code from Github (it's pretty stable/non-buggy) and using that instead. The hello_world test/example app should work fine.

Also, there's something really bugging me about your script src:

<script src="C:\Users\sasikiran_vaddi\Desktop\Gateone\gateone.js"></script>

Are you running hello_embedded locally on a Windows host? As in, the URL in the browser begins with file://? I don't think browsers will allow you to open outbound WebSocket connections from inside file:// URLs for security reasons. Also, it may explain why you're getting that error about the origin--I bet your browser is sending an empty origin to the server if you're using file:// URLs.

vsasikiran commented 11 years ago

Yes you are correct, the problem is solved after running the code in server instead of running locally. Thanks for the help.

liftoff commented 11 years ago

No problem. Closing issue.

vsasikiran commented 11 years ago

Created folder GateOne and placed "html" and "js" file in that folder.

then i placed GateOne folder in /var/lib/tomcat7/webapps.

Then i tried to browse through the url http://:8080/GateOne/GateOne.html

Then i'm getting the error Authentication required.

So then I triedo to browse the GateOne Server directly then certificate getting loaded and then i'm able to browse following url in the new tab of that session. http://:8080/GateOne/GateOne.html

How can we avoid this . Please help me

Thanks, Sasikiran

liftoff commented 11 years ago

I'm not sure I understand... Are you referring to the fact that the self-signed SSL certificate generated by Gate One must be accepted by the user before embedding will work? There's two ways around that:

1) Purchase an SSL certificate for your Gate One server that is trusted by the user's browser. 2) Use your own CA to generate a certificate for the Gate One server and make sure that your CA is trusted in the user's browser.

Option #2 only works well if you have control over user workstations (e.g. inside an enterprise environment).

There's another option that might work which is a variant of #2: if you generate a wildcard certificate you can use the same certificate for both servers (Tomcat & Gate One). Then when the user accepts the certificate for Tomcat the browser won't need to ask the user to accept the certificate for the Gate One server.