In this section we will walk you through the relatively simple tasks involved in configuring OneGate for use with your applications. There are twelve sections in all.
Before we begin, it should be stated that in the following sections, pathnames will contain certain parts in square brackets. These parts are:
It is a good idea to familiarise yourself with manual configuration. After doing so, you can either configure OneGate manually, or you can use the ogconfig configuration tool. The choice is yours, but you should understand the configuration at its basic level before using the tool.
Program sets are single word names that tell OneGate which application it is working with at any given time. A program set name may contain only alphanumeric characters, and the underscore symbol.
When called, OneGate will verify the program set name passed to it in the form field onegate_set. The file used to verify validity of program set names is [maindir]/valid.sets. This file should contain one program set name per line. Blank lines or lines starting with a pound sign (comments) are ignored. You can not put comments on the same line as a program set name. This file must be present.
Global environment variables that all your applications require may be set by using the [maindir]/main.environment file. The presence of this file is optional.
The format of this file is identical to Bourne shell syntax, with one VAR=value assignment per line. There are a few exceptions to the Bourne-like quality of the syntax. Exports are not needed. OneGate handles this for you, as the file is not processed by a shell. Comments may be on individual lines, and blank lines are ignored. You may not put comments after value contents. The other notable difference is that you do not need to quote your values. Any quotes included (be they single or double) will be literally interpreted as part of the value for your variable.The file [maindir]/main.config controls global behaviour for OneGate's handling of all applications. The presence of this file is optional, and if it is absent or empty, default values will be used.
There are 18 options in all, which are described in detail on the Configuration Options page. The format of this file is one option=value assignment per line. Comments may be on lines by themselves, and blank lines are ignored.The file [maindir]/error.page may be be used to create a "pretty" general error page in the event OneGate encounters an error during execution. This page should be in HTML format, and is intended in the same vein as httpd custom error pages.
Using this file, you can suppress OneGate's normal, terse error reporting and give your users an error page that is integrated closely with the look and feel of your site, and allows for graceful redirection at your discretion.
If the devel_debug option is enabled, custom error pages are disabled.
The file [maindir]/main.fields controls which fields OneGate will accept globally for all program sets, and their definitions. See the Program Set Field Definitions page for full details on syntax.
Any fields defined in program sets automatically overridethe fields defined in this file in the event of a redefinition conflict.
Global Cookie Definitions File
The file [maindir]/main.cookies controls which cookies OneGate will accept globally for all program sets, and their definitions. See the Program Set Cookie Definitions page for full details on syntax.
The file [maindir]/configs/[progset]/fields is used to describe the permitted and required fields for each program set. This file must be present, although it may be empty if your program requires no fields.
The format of this file is one entry per line, consisting of three fields separated by whitespace. The fields, in order, are:Please note that the main OneGate field onegate_set is always accepted, and does not need to be in the field definition file for any program set.
Additionally, the special fields for user authentication (if you enable it) are always accepted, and do not need to be in the field definition file for any program set. These fields are onegate_user and onegate_pass.
Any other field not listed in this file will cause the entire request to be denied with an error.
NOTE: A leading cause of "Extra fields given" errors (error 12) is forgetting to include the field for your SUBMIT or IMAGE buttons. This field should ideally be defined as optional, as it will not always be returned. If the browser allows a user to submit a form by hitting <ENTER> in a text field or elsewhere, the submit button value may not be returned. If the button is pressed, it should be returned. Hence, optional is the advised setting for these types of fields.
Program Set Cookie Definitions
The file [maindir]/configs/[progset]/cookies is used to describe the requested cookie names to be retrieved for each program set. The presence of this file is optional. The syntax allows for blank and separate comment lines. Each cookie name to be retrieved should be listed on a separate line.
The heart of your interaction with OneGate, the file [maindir]/configs/[progset]/program.set controls what commands are executed within your application. This file must be present, and configured with the list of your commands for the program set.
The syntax allows for blank and separate comment lines. You may not place comments on the same line as a command. Each command should be on a separate line, and each will be processed in order at execution.You may use any valid command on your system, and shell metacharacters (redirects, etc.) are allowed. Please note that OneGate clears the $PATH environment variable at the beginning of its execution, so you effectively have no path unless you set one in either the main or program set environment variable files. If you do not define a path, you will need to explicitly state full paths to your commands.
There are six "magic cookies" that allow you to give your commands access to the relevant files and data associated with a OneGate transaction. Wherever these tokens appear in your commands, they will be replaced with the appropriate pathname.
Should you be unable to utilise the command line to pass filenames or the internal lock number to your application, an alternate method is available in the form of environment variables. These do not go in the configuration file, but instead may be accessed from within your application:
NOTE: As of v04.00.00, the %t and ONEGATE_MIMEFILE methodology is not required. The new mime_type option in the configuration files will suffice. If the legacy functionality is used, it will override whatever may be set in the configuration file(s).
Commands may be run conditionally as of version 04.01.00. The syntax for doing so involves prefixing your commands with certain characters at the very beginning of the line. The following syntaxes have the following effects on your commands:
Additionally, any command may create a file equivalent to %u.STOP in the current working directory (that is, a file [maindir]/spool/[progset]/tmp/[ONEGATE_UNIQUE_ID].STOP where the unique ID is the value from that environment variable or taken from %u) in order to entirely halt execution of further commands. Before each command is executed, a check is made for the presence of this semaphore file. If it is present, no further commands will be executed. Thus, it is possible to have a file "fail" programmatically, write an output page, and use this semaphore to cause no further commands to run, in order to get that error page to the browser and proceed no further.
Similar to the main environment variable file, you may set environment variables for each specific application independantly by using the [maindir]/configs/[progset]/environment file. This file is optional, and if it is empty or absent, global and then default values will be used, in that order of precedence.
The format of this file is identical to that of the main environment variable file. Please note that any identical variable names in the application environment file will override global entries of the same name.Similar to the main configuration file, you may set the OneGate options at the application level with the file [maindir]/configs/[progset]/config. This file is optional, and if it is empty or absent, global and then default values will be used, in that order of precedence.
As with environment variables, any entry at the application level will override the global settings. The sole exception is the max_session_count option, which will be ignored in the application context and is only valid at the global level.Program Set General Error File
The file [maindir]/configs/[progset]/error.page may be be used to create a "pretty" general error page in the event OneGate encounters an error during execution. This page should be in HTML format, and is intended in the same vein as httpd custom error pages.
Using this file, you can suppress OneGate's normal, terse error reporting and give your users an error page that is integrated closely with the look and feel of your site, and allows for graceful redirection at your discretion.
Any program set general error file automatically overrides the global general error file, if the global file exists.
If the devel_debug option is enabled, custom error pages are disabled.
The file [maindir]/lock.error should contain a valid HTML page to be returned in the event that OneGate encounters its maximum number of instances as set by the max_session_count option, and exceeds all retry time. Place any message you want in this file, in HTML format. Bear in mind that this is a global file, and will be returned on all occurrances of this event. This file must be present.
The virtual firewall for an application is configured through the file [maindir]/configs/[progset]/host.access and is disabled if this file does not exist. Comments and blank lines are allowed in this file. The format of the file is one rule per line, consisting of the following fields in order, separated by whitespace:
The order in which the rules are listed is not important as of version 04.00.00.
Rules that are of the classes deny or alwaysdeny must have the third field which points to an HTML file that will be presented to the browser, explaining the ban. The file you choose to present is entirely at your discretion, but it will be presented with the text/html MIME type. The file listed must exist at the location indicated, or OneGate will generate an error noting that there is a missing subnet denial message file.
The virtual firewall stage is handled before the user authentication stage, if both are enabled.
Program Set User Authentication
The user authentication for an application is configured through the file [maindir]/configs/[progset]/allowed.users and is disabled if this file does not exist. Comments and blank lines are allowed in this file. The file denotes the users that are allowed to use the program set. The format of this file consists of two fields per line:
The use of a group entry automatically allows all users that fall within that group.
If you create and utilise the allowed.users file, you must also create the files ht.users and ht.groups. These may be symbolic links to already existing files elsewhere on your system on *nix platforms. The formats of these files follow the standard formats that the Apache web server recognises:
The ht.users file, should you not have one already created, may be created and maintained with the program htpasswd, which should be installed on any server with a web server present.
The ht.groups file, should you not have one already created, is created by hand. Please note that as with Apache, additional group lines with the same group name will append their users to the overall list of legal users for that group name, rather than replace the previous list. Thus, you can break up the list of users for large groups over multiple lines starting with the same group name, for increased legibility.
The user authentication may be utilised in two ways:
The allowed.users file is OneGate's equivalent to Apache's .htaccess file, if you care to think of it that way. The difference (besides being less complex) is that any users not accounted for in this file will not be permitted to use the program set. There is no need (or ability) to manually deny anyone access. All listed users (or users included in listed groups) will be authenticated. Anyone else is denied access.
In addition, if you activate user authentication, you must create the file [maindir]/configs/[progset]/invalid.user.message for display to the remote browser. This file will be presented with a MIME type of text/html when a user is denied access.
The user authentication stage is handled after the virtual firewall stage, if both are enabled.
OneGate may be told not to execute any applications (global) or a specific application (program set) by use of a nologin file. This file not only tells OneGate not to execute the usual functions, but the contents of the file are presented to the remote browser as an explanation of the refusal of service. The file will be presented with the MIME type text/html. The locations of the global and program set files are [maindir]/nologin and [maindir]/configs/[progset]/nologin, respectively. The global message will override any program set messages, should both be present simultaneously.