Services and Authkeys

The objective of this chapter is describing in detail two central elements of the ZofToken configuration (services and authkeys) and some recommendations about their use. Except for the specific cases listed below, everything in this document applies to both private ZofToken Server installations and ZofToken as a Service (ZaaS).

Services

Description

Every ZofToken instance can have any number of services configured.

Any token belonging to a service will have the same configuration and therefore services can be used to group users in any way that fits the business requirements. API access to the services (for example, being able to query the status of a token or enrolling a new token) is granular and can be configured through the authkeys introduced in the next section.

The minimal configuration has a single service to which every token belongs to, while a more complex one could include for example four services: one for regular internal users (used to secure their access to some of the organization’s systems), one for internal IT users (used to secure administrative access to critical assets), one for the majority of external users (used to secure access and/or transactions to a web application like a Home Banking system) and one for “premium” external users (also used to secure access and/or transactions but with a different configuration to allow the duress function).

Parameters

Every service has the following parameters:

Parameter Description
Name This is the internal name of the service as used in the API.
Token duration (or window) To make the tokens more user friendly, once the user opens their token, the ZofToken instance will consider it open for a number of seconds defined by this parameter. This allows the user to open their token before they login to a web application and not needing to interact further with it for an amount of time that is reasonable for a normal session (for example, 10 to 15 minutes). Setting this parameter to 0 removes this functionality and every interaction with the tokens will have to be handled through a webhook. As this configuration limits the simplicity of integrating ZofToken with your systems, it is recommended that this is done only for specific business reasons.
Webhook This optional parameter instructs the ZofToken server to call a specific webhook at several instances of the token lifecycle. There are three components of a webhook configuration:
  • Host name: this needs to be a host (and optionally a port, defaulting to 443) that accepts HTTPS connections – ZofToken will not call unencrypted webhooks.
  • A flag to indicate if the certificate presented by the HTTPS endpoint needs to be checked or not – in most cases this should be enabled, but for webhooks that are fired on internal networks with self-signed certificates or situations were a valid certificate is not available for some other reason, it needs to be disabled or ZofToken will not connect to the endpoint.
  • A string that works as a secret that the ZofToken server will send along with each webhook call – this allows whatever application is receiving the webhook to verify that the call came from the ZofToken server and therefore it is recommended to use a reasonably secure secret (for example, a 20+ length string made of random characters).
Once the webhook is configured, the ZofToken server will call it with the GET method and the following parameters:
  • secret: the secret described above.
  • id: username of the token.
  • service: name of the service the token is a member of.
  • event: a string indicating the token event selected from the following
    • "enrolled": the token has finished the enrollment process and is now active.
    • "blocked": the token has been blocked.
    • "open": the token has been opened.
    • "closed": the token has been closed (note: if a token duration is configured, the expiration of this duration will not call this webhook).
    • "duress": the last token operation (open or close) was done under duress.
Duress mode This flag indicates whether the duress function is enabled for this service. As this is an important decision with potentially significant implications (particularly for external users), it is recommended to read the general description and recommendations regarding this function in the documentation.
Details

Note: this parameter is used exclusively by ZofToken Universal App and is provided automatically by ZaaS so the following description applies only to private ZofToken Server installations that use the reference app.

This optional parameter is a URL that needs to return a JSON object that configures how the service will appear to the user in ZofToken Universal App. The format of the JSON object is as follows:
{
"logo": logo image,
"friendly_name": "This is an example service",
"service_description": "Este es un servicio de ejemplo",
"error_contact": "Please call 111-1111 to request help",
"offline_description": "Please call 222-2222 to use offline mode"
}
The first property is a BASE64 representation of a PNG image file that will be shown as the logo for the token in ZofToken Universal App, and the rest of the fields should be self-explanatory. As described in the installation documentation, creating a free ZaaS account for experimentation and testing can also help create this object as there is a simple user interface for it.
Endpoints

Note: this parameter is used exclusively by ZofToken Universal App and is provided automatically by ZaaS so the following description applies only to private ZofToken Server installations that use the reference app.

This parameter consists of a list of hostnames and UDP port numbers that will be passed to the ZofToken app when a token enrolls to this service. Each hostname and port combination needs to be a ZofToken server that is part of the same instance (that is, connected to the same database) and this provides load balancing to those servers for either performance or resilience purposes. It’s important to note that this load balancing is implemented entirely on the client side as each ZofToken app will pick a random endpoint to contact on each token operation and retry on different endpoints if needed. Each service needs to have a minimum of one endpoint and configuring additional ones is optional.

Configuration

For ZaaS, all the configuration is done through a simple user interface, just use the information in this document and the help reminders on each page to configure all needed services.

For private ZofToken Server installations there are two ways to configure services:

Static configuration

The config.yaml file described in the installation guide includes a section where you can configure all services and their parameters. As services most likely do not change a lot, this is the easiest and probably most common configuration.

Dynamic configuration

If the config.yaml file indicates that the configuration should be handled through the database, the ZofToken installation includes a command line tool to create, configure and edit services. Directly editing the database would be technically feasible (as the internal structure is fairly simple) but this is strongly unadvisable due both to the chance to introduce mistakes and the security objective of preventing all access to this database outside of normal operation.

Naming

Internally, ZofToken uses a hash of the combination of username and service as the actual token id, which means there are no real restrictions to service naming (including using UTF-8 characters as required by many languages). Nonetheless, it is recommended that service names are kept short and descriptive in order to simplify API interactions.

PFor ZaaS, to guarantee that each service name is unique, they will be prefixed with the name of the subscription. Therefore, for a subscription called “example” that has services named “alpha” and “bravo”, the actual names you will be using to interact with the API for these services are “example_alpha” and “example_bravo”.

Authkeys

Description

Every interaction with the ZofToken API requires the use of an authkey which is checked before allowing any queries or actions. An authkey with the administrative flag can perform all API operations, while one without is limited to just querying a token status.

For ZaaS, two authkeys (one with the admin flag and the other without) are randomly assigned when the service is originally created and cannot be changed. For private ZofToken installations, any number of authkeys with a high degree of granularity in their access can be configured.

This design allows for very different security scenarios, from a simple installation with one internal authkey with complete access to all tokens to very complex variants with multiple authkeys with different levels of access to different services and users. These specific authkeys could be assigned to particular assets in order to implement good security practices – for example, two backends that handle two different applications could easily use tokens assigned to different services and have authkeys that limit access to only their own service, in a way that even a compromise of one of the applications doesn’t affect the security of the other.

Parameters

Every authkey has the following parameters:

Parameter Description
Authkey The actual (character string) secret that is passed to the API to authorize an operation.
Admin A flag that indicates if the authkey will have unrestricted access to all API functions or just a read only access to the status of tokens.
Service mask This is a regular expression that indicates which services the authkey will be able to access. Notice that this works in tandem with the next parameter.
User Mask This is a regular expression that indicates which usernames the authkey will be able to access. Notice that this works in tandem with the previous parameter.

Configuration

As mentioned in the description, authkeys can’t be configured in ZaaS and are randomly provided for each service created.

For private ZofToken Server installations there are two ways to configure authkeys:

Static configuration

The config.yaml file described in the installation guide includes a section where you can configure all authkeys and their parameters. As authkeys most likely don’t change a lot (unless they become compromised), this is the easiest and probably most common configuration.

Dynamic configuration

If the config.yaml file indicates that the configuration should be handled through the database, the ZofToken installation includes a command line tool to create, configure and edit authkeys. Directly editing the database would be technically feasible (as the internal structure is fairly simple) but this is strongly unadvisable due both to the chance to introduce mistakes and the security objective of preventing all access to it outside of normal operation.

Be aware that both the service and user masks are validated before allowing access, so you could configure a specific service access limitation and an unlimited user name access and this would not allow access to tokens outside of the service (this is, in fact, the configuration of the ZaaS-provided authkeys).

Naming

While the secret used as the authkey can be any UTF-8 string (particularly when configured manually through the config.yaml file), it is strongly recommended not to think of authkeys as passwords and use secure strings.

A good approach is generating a random binary string and then converting this to an hexadecimal or BASE64 representation. The command line tool included in the ZofToken Server installation does this with a 256-bit random binary string.

Table of contents