Skip to content

Publish a Web Application

This guide publishes an internal web application on a portal of its own, step by step, and checks every step on the way. It takes about fifteen minutes, most of it waiting for DNS.

The example publishes a wiki that runs at http://192.168.1.20:8080 on the office network as wiki.example.com. Employees sign in at your identity provider from any browser; employees with the XTNA-agent get in without signing in again.

Before you start

Check each item. The portal's Setup checklist (see Verify) shows the same points once the portal exists.

  • A gateway asset: a Linux asset running the XTNA-agent, or the asset container image (Windows, macOS and OpenWrt assets cannot serve portals yet). It is online and runs a current agent version: an older agent refuses to serve a portal that uses a newer feature, and the checklist names the feature.
  • The application is reachable from the gateway asset, here 192.168.1.20:8080. Run curl -I http://192.168.1.20:8080 on the gateway asset to make sure. The application needs no public address and no agent.
  • Port 443 is free on the gateway asset. Nothing else may listen on it: if a web server or reverse proxy on the same host serves 443 today, for example the one the portal replaces, stop and disable it before the switch. The agent takes the port over within 30 seconds of it becoming free. Check with

    sudo ss -tlnp 'sport = :443'
    

    which should list nothing, or only xtna-service once the portal is saved.

  • Port 443 is reachable from the internet on the gateway asset's public IP address, which the Public IP column of the asset table shows. Visitors and the certificate authority both use it.

    • Behind a router, forward TCP port 443 of the public address to the gateway asset itself, not to another machine: the certificate authority checks the hostname on that port.
    • A firewall in front of the asset must let TCP 443 in. The agent opens the port in the host firewall it manages.
    • For the container image, publish port 443 of the container.
    • Port 80 is only needed if you turn on Redirect HTTP to HTTPS.
  • Access to your DNS provider, to create one record.
  • A user group of the people who may use the application, for the policy in step 4.

1. Create the DNS record

At your DNS provider, create an A record for the hostname pointing at the gateway asset's public IP address:

wiki.example.com.  300  IN  A  203.0.113.10

Check it with dig +short wiki.example.com; it should print the gateway asset's public address. A new record is usually visible within minutes; a changed one can take as long as the old record's TTL.

Clients with the XTNA-agent resolve the hostname to the tunnel address by themselves. The public record is for everyone else, and for the certificate.

2. Create the portal

On the Assets page, choose Create → Portal. The form has the tabs General, Applications and Access; every field is described in Portals.

General tab

Setting Example
Gateway Asset The asset from Before you start
Name Wiki
Hostname wiki.example.com
Port 443
Certificate Automatic

Applications tab: one web application that catches every path.

Setting Example
Name empty: an application at / goes by the portal's name
Path prefix /
Upstream http://192.168.1.20:8080
Trust level identity
Allowed user groups empty

identity asks visitors from a browser to sign in at your identity provider, and lets employees with the agent through without signing in. Choose tunnel instead to keep the application off the internet altogether: then only devices with the agent reach it. See Trust levels.

For an https:// upstream, the gateway asset verifies the application's certificate. The host name or IP address in the Upstream URL must be in that certificate, and an application with its own certificate authority needs the Upstream CA certificate field. There is no option to skip verification: use a certificate that names the address the gateway asset uses, or an http:// upstream on a network you trust.

Save. The portal appears under its gateway asset, and within a few seconds the gateway asset reports that it serves it.

3. Wait for the certificate

With an Automatic certificate, the gateway asset requests one from a public certificate authority as soon as it serves the portal. This usually takes less than a minute. The Certificate step of the checklist then turns to Valid.

If it reports Issuance failed, the reason says why: almost always the DNS record does not point at the gateway asset yet, or port 443 reaches something other than the agent. Fix it; the gateway asset tries again within 15 minutes, and at once when it takes over a port that was in use.

4. Grant the portal with a policy

Nobody gets in until a policy grants the portal. On the Policies page, create a policy, or extend an existing one, with

  • Source: the user group of the people who use the wiki, for example Employees, or All Users,
  • Destination: the portal Wiki.

The Access tab of the portal's form does the same from the other side: it adds the portal to existing policies.

A policy with a site, public IP or location condition grants a login only from a browser at a matching address, and a policy with an OS condition only grants through the agent, because a browser proves no device; see Policies. A policy on the gateway asset alone opens the port but grants no portal.

Verify

The detail page of every portal opens with a Setup checklist built from what the gateway asset last reported, the DNS lookup and the policies. It shows which steps are done, which are waiting on the gateway asset, DNS or the certificate authority, and what is missing:

  1. the gateway asset is online,
  2. it serves the portal's port,
  3. the hostname resolves to its public IP (left out for a portal with only tunnel applications),
  4. the certificate is valid,
  5. a policy grants the portal (left out when every application is public).

The list folds to Setup Complete once every step is done. A step that needs you, such as a missing policy while the portal has identity or tunnel applications, is marked with a warning: those applications are closed to everyone until a policy grants it.

Setup checklist of a portal with the DNS record missing Setup checklist of a portal with the DNS record missing

In the asset table, the Public IP column of a portal shows the gateway asset's public address and port. The console looks up the hostname in public DNS every minute and marks the cell with a warning when the hostname does not resolve, when it resolves to another address, or when the gateway asset does not serve the portal; the tooltip says which. DNS resolvers may keep the old answer for the record's TTL. A portal with only tunnel applications shows Tunnel only instead.

Then test the access:

  1. Open https://wiki.example.com in a private browser window on a device without the agent, or with the agent disconnected. You are sent to your identity provider; after signing in as a member of the policy's group you see the wiki.
  2. Open the same address on a device with the agent connected and signed in as such a user. The wiki opens without a login.
  3. Sign in as someone outside the policy's group. The login ends with Access denied, and the event log has a web_app_login_denied event with the reason no_policy.

If it doesn't work

What you see Where to look
Gateway status: Not served on the portal Another process holds port 443, or the agent is too old. See Troubleshooting.
Certificate status: Issuance failed DNS or port 443; see step 3 and Troubleshooting.
upstream unavailable in the browser The gateway asset cannot reach or verify the application; see Troubleshooting.
No policy grants you this portal, Access denied The policy of step 4; see Portal messages.

Next

  • Give parts of the wiki a different trust level with more applications: a public form under /request, a tunnel-only administration under /admin, or a Block application that hides it entirely. See the example.
  • Limit an application to some user groups with Allowed user groups, on top of the policy.
  • Open a remote desktop on a machine behind the gateway asset from the browser: Publish a remote desktop, or a terminal or screen: SSH terminal and VNC screen.
  • Have the application read who the visitor is from the identity headers instead of asking for its own login.

See also