-
Notifications
You must be signed in to change notification settings - Fork 99
Print Server
#Print Server Configuration
##Prerequisites
- QZ Tray 1.9.5 or higher
##Objective
- Run QZ Tray as a dedicated service, useful for machines that cannot have QZ Tray installed (such as a Terminal Services/Citrix environment and mobile devices).
##Steps The steps will be the same for each platform, however, the way you regenerate the certificate and install it on the client will vary.
- Install QZ Tray
- Re-run the certificate generation
- Move certificates/files to the client
- Install
qz-tray.crt
on the client - Edit
deployQZ();
- Verify secure connection
##Install QZ Tray Install QZ Tray 1.9.5 or higher onto the server via the desktop installer. Refer to this guide if unsure how to do this.
##Remove Localhost Bindings Optional Step: The steps provided in this section illustrate how to create a certificate for a secure (HTTPS) connection. A connection can be made over HTTP. If you do not generate a certificate for HTTPS, skip over Step 4 as well.
For secure websockets support (HTTPS), QZ Tray generates a certificate for localhost
traffic at install time called qz-tray.crt
. In order for QZ Tray to run on a separate machine, the hostname
(usually "localhost") must exist in the certificate. This is an override which is done by running a custom script.
- Re-run the certificate generation (
"foo.bar"
is the hostname or IP address that QZ Tray will run on)
Note: This will re-generate the
qz-tray.properties
,qz-tray.crt
andqz-tray.jks
Note: If you require Firefox HTTPS support, Firefox needs to be installed prior to this step.
- Restart QZ Tray. This must be done every time you regenerate a certificate.
###Windows Open a command prompt as an administrator and run the following commands:
REM Regenerate the certificate
cd "%PROGRAMFILES%\QZ Tray\"
cscript auth\windows-keygen.js . install "foo.bar"
###Linux
# Reinstall completely with specified hostname or IP address
sudo qz-tray-1.9.x.run -- -y "foo.bar"
###Apple
# Regenerate the certificate
sudo /Applications/QZ\ Tray.app/auth/apple-keygen.sh install "foo.bar"
# Optionally, regenerate the Firefox configuration files
sudo /Applications/QZ\ Tray.app/auth/firefox/firefox-cert.sh install "foo.bar"
##Copy Files to Client
-
Copy
qz-tray.crt
from the server's QZ Tray installation directory to the clientNote: Linux stores this in
/opt/qz-tray/
-
Copy the
demo
folder for testing (located inQZ Tray\demo
) from QZ Tray to the client. -
Optionally, if Firefox support is needed, copy the following files from the Firefox installation directory:
- These may be located in
C:\Program Files (x86)\Mozilla Firefox\
defaults/pref/firefox-prefs.js
firefox-config.cfg
Note: If unsure of the location of these files on your system install QZ Tray on a test system and search for them by name. They are both created by QZ Tray and can safely be overwritten.
- These may be located in
Now that the files have been moved to the client, the rest of the steps can be completed on the client.
##Certificate Installation The steps in this section of the tutorial are only necessary if you have regenerated a certificate Step 3 for HTTPS support.
Certificate installation varies between browsers and platforms. Distributing a certificate marked for a custom hostname is a manual process which much be done on all workstations requiring HTTPS + QZ Tray.
- Install
qz-tray.crt
into Trusted Root Certificates
###Windows
-
Double click
qz-tray.crt
-
Click Install Certificate
-
Local Machine, Next
-
Choose "Trust Root Certificate Authorities" and hit Next
-
Click Finish. If successful, the following screen will appear:
###Linux ###Mac
- Import Firefox certificates Firefox does not allow self-signed certificates to be imported directly, instead a manual import process is needed.
- Overlay the existing Firefox files:
defaults/pref/firefox-prefs.js
firefox-config.cfg
with the ones transferred over from the server
- Again, these may be located in
C:\Program Files (x86)\Mozilla Firefox\
##Deploy QZ
By default, the deployQZ
function is bound to localhost
. To override this, replace all calls to deployQZ
in your code with deployQZ("foo.bar");
, where "foo.bar" is the hostname or IP address which QZ Tray is running on.
- Edit
sample.html
changedeployQZ()
todeployQZ("foo.bar")
"foo.bar" is the hostname or IP address which is running QZ Tray.
/**
* Deploy tray version of QZ, or
* Optionally used to deploy multiple versions of the applet for mixed
* environments. Oracle uses document.write(), which puts the applet at the
* top of the page, bumping all HTML content down.
*/
//deployQZ();
deployQZ("192.168.1.2");
##Verify Secure Connection
- Open
sample.html
in Google Chrome - Right Click, Inspect Element on the sample page
- Click the Console tab
- Verify the secure websocket connection to 8181 succeeds.
If you did not do steps 2 or 4, a connection will happen on a different port.
Note: If HTTPS still fails, or you are experiencing long timeouts before a connection is made, a firewall may be blocking the connection. Try disabling the firewall, or allowing the port on the server.