2.6.  Test Center as Backend Services

Table of Contents

2.6.1. Test Center as Windows service
2.6.2. Apache Reverse Proxy Example
2.6.3. Hitch TLS Proxy
2.6.4. Authentication Proxy Setup

This section shows examples of how to start Test Center as a Windows service as well as to how to integrate Test Center in an existing Web service setup and/or to enable HTTPS access to Test Center. The Test Center TCP listen port can be configured in the application.ini file located in config directory. The option is ListenPort. Its value may also be a unix domain socket, e.g. ListenPort=unix:/tmp/testcenter.

2.6.1.  Test Center as Windows service

The following steps describe the actions that need to be taken to start Test Center as a Windows service. First, install the service via the following commandline:

bin\testcenter service-install

Note that this might require elevated privileges to work without error. Now you can start it in the Services panel from Windows. In case the service fails to start then Test Center will output information in the Event log of Windows. Stopping Test Center service can be done in the same place where it was started, the Services panel. Finally it is also possible to uninstall the service by running the following commandline:

bin\testcenter service-uninstall

2.6.2.  Apache Reverse Proxy Example

Here is an example of Reverse Proxy using an Apache Web server. The modules mod_proxy and mod_proxy_http must be enabled

cd mods-enabled/
ln -s ../mods-available/proxy.load .
ln -s ../mods-available/proxy_http.load .
ln -s ../mods-available/proxy_wstunnel.load .
ln -s ../mods-available/rewrite.load .

The following VirtualHost configuration forwards requests to Testcenter's default port 8800 on the same host:

<VirtualHost _default_:443>
        ProxyPass        / http://localhost:8800/ connectiontimeout=600 timeout=600
        ProxyPassReverse / http://localhost:8800/
        ProxyPreserveHost On
        ProxyRequests Off
        RewriteEngine on
        RewriteCond %{HTTP:Upgrade} websocket [NC]
        RewriteCond %{HTTP:Connection} upgrade [NC]
        RewriteRule ^/?(.*) "ws://localhost:8800/$1" [P,L]
        SSLEngine on
        SSLCertificateFile    your-crt-file.crt
        SSLCertificateKeyFile your-key-file.key
</VirtualHost>

To serve Squish Test Center with a relative path, say under /jellyfish/, the URLs from the Web application needs to be adjusted. In application.ini the option UrlRootPath in group TestCenter needs to be set to /jellyfish/. The following VirtualHost configuration forwards requests to Testcenter's default port 8800 on the same host, by rewriting the path:

<VirtualHost *>
        ProxyPass /jellyfish/ http://localhost:8800/
        <Location /jellyfish/>
        ProxyPassReverse /
        </Location>
        ProxyRequests Off
        RewriteEngine on
        RewriteCond %{HTTP:Upgrade} websocket [NC]
        RewriteCond %{HTTP:Connection} upgrade [NC]
        RewriteRule ^/jellyfish/(.*) "ws://localhost:8800/$1" [P,L]
</VirtualHost>

2.6.3.  Hitch TLS Proxy

Below is a configuration of the Hitch proxy server, which can be used as an SSL frontend for Test Center.

frontend = {
    host = "*"
    port = "443"
}
backend = "[127.0.0.1]:8800"
pem-file = "your-pem-file.pem"

2.6.4.  Authentication Proxy Setup

Squish Test Center can be setup to relinquish authentication to an authentication proxy. Squish Test Center authentication support was developed for the OAuth2 Proxy Even when using an authentication proxy, users will still be required to create accounts on Squish Test Center, but they will not need to enter their Squish Test Center credentials.

[Warning]Warning

When you use an authentication proxy you need to make sure that the /login endpoint of your Squish Test Center instance can only be accessed via the authentication proxy.

To activate the authentication proxy support you need to edit the application.ini file located in /testcenter/config and set Enable.Proxy to true. Use the Header.Name setting to specify which HTTP Header send by the authentication proxy will contain the E-Mail address of the authenticated user (in the example below it is X-Forwarded-User).

[Note]Note

It is important that the authentication proxy forwards user E-Mail addresses and not account names or aliases, since Squish Test Center only knows about E-Mail addresses.

[ProxyAuth]
# When enabled login is limited to requests coming from the authentication proxy
Enable.Proxy=true

# HTTP header name set by the proxy that will contain the E-Mail of the
# authenticated user
Header.Name=X-Forwarded-User

# Use this to specify the logout URL of your authentication proxy. If the
# authentication proxy support is enabled and Logout.Url is not set, then
# the logout link in the user menu is hidden, as the default logout procedure
# is incompatible with authentication proxies
# Logout.Url=http://auth.company.com/oauth2/sign_out

When using an authentication proxy the default logout mechanism of Squish Test Center does not work. Therefore the logout option will be hidden from the user menu, unless you specify the Logout.Url setting, which should point to the logout endpoint of the authentication proxy you are using.