This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
wiki:advanced:x2gohtmlclient [2021/12/30 23:06] gratuxri Suggested changes from "W. Michael Petullo" <mike@flyn.org> on x2go-dev ml |
wiki:advanced:x2gohtmlclient [2022/10/03 13:34] (current) gratuxri [proof of concept installation on Ubuntu GNU/Linux from Launchpad PPA] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
+ | X2Go's HTML client makes use of HTML5, JavaScript, and WebSockets to provide graphical access to a remote host with no client-side requirements other than a modern browser. The x2gohtmlclient package, served by a web server, provides the JavaScript front-end. X2gohtmlclient works with the x2gowebrpc and x2gowswrapper packages, which run on the server. Aside from the aforementioned X2Go packages, the server-side requirements include | ||
+ | * a web server, | ||
+ | * minify, | ||
+ | * Qt 5 and Qt 5 X11 Extras, | ||
+ | * the CGI, JSON, Encode, Expect, and File::Touch Perl modules, and | ||
+ | * python-websockify. | ||
+ | X2Go provides instructions for configuring the NGINX web server, but you can substitute another server if you prefer. Your operating system distribution likely provides packages containing the dependencies not provided by X2Go. | ||
- | ===== X2GoHTMLClient ===== | + | {{: |
- | ==== index.html | + | ====== |
- | Client HTML page. This page can be modified or embedded in existing webpage. It has two modes: native client and embedded client. User can use native client if recent version of X2Go client is installed on the system. In this case, the page will generate x2go session file, which will be automatically opened with x2go client. Second mode is to use embedded HTML Client (only supports X2GoKdrive). The HTML page provides user input for the next settings: | + | |
- | < | + | |
- | X2Go Server address | + | |
- | Username | + | |
- | Password | + | |
- | Command to execute (KDE, GNOME, ICEWM, etc) | + | |
- | SSH Proxy (if not specified no proxy will be used) | + | |
- | Proxy login | + | |
- | Proxy password | + | |
- | </ | + | |
- | The HTML page can be modified to predefine one or more of this settings. Important functions inside of this page should be defined: | + | |
- | < | + | |
- | function getUname() | + | |
- | function getPass() | + | |
- | function getCommand() | + | |
- | function getName() | + | |
- | function getProxy() | + | |
- | function getProxyUser() | + | |
- | function getProxyPass() | + | |
- | </ | + | |
- | ==== x2gokdriveclient.html ==== | + | |
- | The HTML Page to run X2Go client in separate window. By default the session' | + | |
- | ==== CSS/ | + | ===== x2gohtmlclient ===== |
- | WEB styles for HTML pages | + | |
- | ==== SRC/*png SRC/*svg ==== | + | Contains the JavaScript and other assets that are served to a browser. The main page is '' |
- | Image resources | + | |
+ | | ||
+ | * a password, | ||
+ | * the desktop environment to start, | ||
+ | * whether to use an SSH proxy, | ||
+ | * an optional proxy username, and | ||
+ | * an optional proxy password. | ||
- | ==== SRC/ | + | {{: |
- | Communication between HTML page and X2Go HTML Client | + | |
- | ==== SRC/ | + | |
- | Communication between X2Go RPC script and X2Go HTML Client | + | |
- | ==== SRC/ | + | |
- | X2GoKdrive JS client | + | |
- | ===== x2gorpc.cgi ===== | + | '' |
- | CGI script | + | The file '' |
- | ===== x2gowswrapper ===== | + | The x2gohtmlclient package also provides CSS, images, and three JavaScript classes: |
- | The application | + | - '' |
+ | - '' | ||
+ | - '' | ||
+ | ===== x2gowebrpc ===== | ||
- | ====== Building of the HTML Client components ====== | + | The x2gorpc.cgi CGI script connects to the X2Go server using SSH and starts sessions, resumes sessions, starts SSH tunnels and so on in response to requests from the browser. This involves using SSH to run '' |
- | ====== JS classes ====== | ||
- | JS classes should be compiled in one using script minify.sh. The resulting file x2goclient.js will be placed in subdir " | ||
- | |||
- | ====== x2gowswrapper ====== | ||
- | Build using qmake | ||
- | < | ||
- | $qmake-qt5 && make | ||
- | </ | ||
- | |||
- | ====== Dependencies ====== | ||
- | |||
- | ===== x2gohtmlclient ===== | ||
- | To compile JS scripts " | ||
- | ===== x2gowebrpc ===== | ||
- | PERL modules: CGI, JSON, Encode, Expect, File::Touch | ||
===== x2gowswrapper ===== | ===== x2gowswrapper ===== | ||
- | QT5-Core, python-websockify(later it's functionality will be included in x2gowswrapper) | ||
- | |||
- | ====== Installation ====== | ||
- | Prerequements: | + | The x2gowswrapper program connects the TCP sockets |
- | Example of nginx configuration (in this case with fcgiwrap https:// | + | ====== Configuring the Web Server ====== |
- | ''/ | + | We describe how to configure NGINX and fcgiwrap, but you can substitute any web server that provides the needed features. |
+ | Here is an example NGINX configuration: | ||
< | < | ||
server { | server { | ||
listen 443 ssl; | listen 443 ssl; | ||
server_name your_host; | server_name your_host; | ||
- | ssl_certificate | + | ssl_certificate |
- | ssl_certificate_key | + | ssl_certificate_key |
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256: | ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256: | ||
ssl_protocols TLSv1.2; | ssl_protocols TLSv1.2; | ||
Line 92: | Line 63: | ||
location /assets/ { | location /assets/ { | ||
add_header Strict-Transport-Security " | add_header Strict-Transport-Security " | ||
- | add_header Content-Security-Policy " | + | add_header Content-Security-Policy " |
add_header Feature-Policy " | add_header Feature-Policy " | ||
add_header Referrer-Policy " | add_header Referrer-Policy " | ||
Line 99: | Line 70: | ||
} | } | ||
- | location ~* \.(pl|cgi)$ { | + | |
- | gzip off; | + | gzip off; |
- | include / | + | include / |
- | fastcgi_pass | + | fastcgi_pass |
} | } | ||
- | location ~ ^/ | + | |
- | proxy_pass | + | proxy_pass |
- | proxy_set_header Upgrade $http_upgrade; | + | proxy_set_header Upgrade $http_upgrade; |
- | proxy_set_header Connection " | + | proxy_set_header Connection " |
- | proxy_http_version 1.1; | + | proxy_http_version 1.1; |
- | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | + | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
- | proxy_set_header Host $http_host; | + | proxy_set_header Host $http_host; |
- | proxy_intercept_errors on; | + | proxy_intercept_errors on; |
- | proxy_redirect off; | + | proxy_redirect off; |
- | proxy_cache_bypass $http_upgrade; | + | proxy_cache_bypass $http_upgrade; |
- | proxy_set_header X-Real-IP $remote_addr; | + | proxy_set_header X-Real-IP $remote_addr; |
- | proxy_set_header X-NginX-Proxy true; | + | proxy_set_header X-NginX-Proxy true; |
- | proxy_ssl_session_reuse off; | + | proxy_ssl_session_reuse off; |
} | } | ||
} | } | ||
</ | </ | ||
+ | Note that the location ''/ | ||
- | X2Go HTML client files: | + | ====== Building and Installing ====== |
- | < | + | |
- | <WEB ROOT>/ | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | </code> | + | ===== x2gohtmlclient ===== |
+ | |||
+ | Run '' | ||
+ | The output will be '' | ||
+ | |||
+ | The other assets should be installed as follows. Create the parent directories as required. | ||
+ | * Place '' | ||
+ | * Place '' | ||
+ | * Place '' | ||
+ | |||
+ | ===== x2gowebrpc ===== | ||
+ | |||
+ | Copy '' | ||
+ | |||
+ | ===== x2gowswrapper ===== | ||
- | This location can be changed, in this case the changes should be also done in the WEB Server configuration file and in index.html file: | + | Build x2gowswrapper using qmake: |
< | < | ||
- | var RPC_path="/ | + | $ qmake-qt5 && make |
- | var asset_path="/ | + | |
</ | </ | ||
- | x2gorpc.cgi should be executable | + | Install the resulting program named x2gowswrapper to ''/ |
- | install x2gowswrapper to /usr/bin | + | Create the directory '' |
- | x2gowswarpper configuration: | + | Create the file named '' |
- | + | <code> | |
- | / | + | |
- | <file> | + | |
ws_proto=wss | ws_proto=wss | ||
- | ssl_cert=<your SSL cert> | + | ssl_cert=/ |
- | ssl_key=<your SSL cert key> | + | ssl_key=/ |
ssl_only=true | ssl_only=true | ||
log_dir=/ | log_dir=/ | ||
- | </file> | + | </code> |
- | the SSL key should be same which used for WEB server. | + | Ensure |
+ | and ensure the user running NGINX can read the files at both paths as well as the configuration file itself. | ||
- | Because x2gowswrapper is started from CGI, be sure that config and SSL Certs are accessible for web server user (www-data in debian) | + | ===== proof of concept installation on Debian GNU/Linux ===== |
- | create log directory for x2gowswarpper: | ||
< | < | ||
- | #mkdir / | + | sudo apt install extrepo |
- | #chown www-data / | + | sudo extrepo enable x2go |
+ | sudo apt update | ||
+ | sudo apt install x2gohtmlclient | ||
</ | </ | ||
- | to use x2go HTML client open in web browser: | + | ===== proof of concept installation on Ubuntu GNU/Linux from Launchpad PPA ===== |
< | < | ||
- | https://<your host>/ | + | sudo add-apt-repository ppa:x2go/nightly |
+ | sudo add-apt-repository ppa:x2go/ppa | ||
+ | sudo apt update | ||
+ | sudo apt install x2gohtmlclient | ||
</ | </ | ||
- | |||
- | {{: | ||
- | {{: | ||
- |