Gateway Configuration Steps

Instead of a configuration wizard GUI interface, the Keyfactor AnyCA Gateway DCOM uses PowerShell cmdlets, which take a few parameters, and upon execution, run scripts which automate the installation and configuration steps. Since the AnyCAGateway DCOM also utilizes a SQL database, the solution includes a database management console application, DatabaseManagementConsole.exe, which is a text-based, command-line application by which you manage your database functions.

Important:  If you are installing the AnyCAGateway DCOM in a clustered environment, please refer to the section on Configure the Keyfactor AnyCA Gateway DCOM with Clustering (Optional) before proceeding.
Note:  You may choose to configure Windows authentication or SQL authentication. The instructions for each are included.

The steps should be done in the following order:

    Create the Database
  1. Create the database using the DatabaseManagementConsole.exe create command or build the structure in a pre-created database using the populate command. ClosedShow database creation steps.

    To run the database creation script, you identify the SQL server host nameClosed The unique identifier that serves as name of a computer. It is sometimes presented as a fully qualified domain name (e.g. servername.keyexample.com) and sometimes just as a short name (e.g. servername). and the database name to be created by passing those required parameters with the DatabaseManagementConsole command (see Overview of the Database Management Console). If you're using SQL server authentication, you also pass in authentication credentials with the command.

    If you prefer, you may manually create a blank database in SQL ahead of time and then use the populate command to build the appropriate structure in the database.

    To create or populate the AnyCAGateway DCOM database, from the command line at the installation directory execute a command similar to:

    For example, to create a new database using the default instance and port (using appropriate values for the server name and database name):

    For example, to create a new database using the default instance and port and specify an Active Directory service account for the gateway service (using appropriate values for the server name, database name, Active Directory service account name, and password):

    For example, to populate a pre-created database using a custom instance and port (using appropriate values for the server name, database name, instance name, and port):

    For example, to create a new database using the default instance and port and SQL authentication (using appropriate values for the server name, database name, username, and password):

    A confirmation message will be returned: "Database successfully created." or "Database successfully populated." If desired, you can validate that the database was created or populated correctly (see Appendix - Verify the AnyCAGateway DCOM Database).

    See Overview of the Database Management Console for more information on the parameters available for creating the AnyCAGateway DCOM SQL database. For instance, the --service-default option can be used when SQL authentication is used to create the database (the --username and --password parameters), but you want to revert to using NETWORK SERVICE to operate the gateway rather than the SQL account specified to create the database.

  2. Import PowerShell cmdlets
  3. Import the gateway PowerShell configuration cmdlets. You will need to do this any time you return to run any of the PowerShell cmdlets. ClosedShow cmdlet import steps.

    To import the PowerShell cmdlets:

    1. If you do not already have a PowerShell window open as administrator, open a PowerShell window using the "Run as administrator" option.
    2. Navigate to the installation directory. By default, this directory is:

      C:\Program Files\Keyfactor\Keyfactor AnyGateway\
    3. Import the PowerShell configuration cmdlets module.

      Import-Module ".\ConfigurationCmdlets.dll"

      The Import-Module command is a standard PowerShell command. The configuration cmdlets DLLs were delivered to the installation directory during installation. This command imports them into the current PowerShell session.

    For more information about the PowerShell cmdlets, see PowerShell Cmdlets for Configuration.

  4. Set the Encryption Certificate
  5. Create a self-signed encryption certificate and set permissions on the certificate, using the Set-KeyfactorGatewayEncryptionCert cmdlet. ClosedShow encryption certificate steps.

    To set the encryption certificate, run the Set-KeyfactorGatewayEncryptionCert cmdlet as follows:

    For more information about the Set-KeyfactorGatewayEncryptionCert cmdlet, see Set-KeyfactorGatewayEncryptionCert.

  6. Load a Variable with SQL Credentials
  7. If you have opted to use SQL Server Authentication, create a prompt to enter a username and password for SQL and load those SQL credentials into a variable using the following PowerShell command:

    $account = Get-Credential

    You will use this variable in the next step, so don't close the PowerShell window.

    Skip this step if you are using Windows authentication.

  8. Set the Database Connection String
  9. Set the connection string the AnyCAGateway DCOM will use to communicate with your Gateway SQL database using the Set-KeyfactorGatewayDatabaseConnection cmdlet. ClosedShow database connection steps.

    • To set the connection strings using Windows Authentication, run the Set-KeyfactorGatewayDatabaseConnection cmdlet with a command similar to the following:

      Set-KeyfactorGatewayDatabaseConnection -Database <Database> -Server <Database-Server>\<SQL-Instance>,<Port>

      For example, using the default instance and port (using appropriate values for the server name and database name):

      Set-KeyfactorGatewayDatabaseConnection -Database CAGateway -Server sqlsrvr.keyexample.com

      For example, using a custom instance and port (using appropriate values for the server name, database name, instance name, and port):

      Set-KeyfactorGatewayDatabaseConnection -Database CAGateway -Server sqlsrvr.keyexample.com\MyInstance,1434
    • To set the connection strings using SQL Authentication, run the Set-KeyfactorGatewayDatabaseConnection cmdlet with a command similar to the following:

      Set-KeyfactorGatewayDatabaseConnection -Database <Database> -Server <Database-Server>\<SQL-Instance>,<Port> -Account $account

      For example, using the default instance and port (using appropriate values for the server name and database name and the $account variable you generate in the previous step):

      Set-KeyfactorGatewayDatabaseConnection -Database CAGateway -Server sqlsrvr.keyexample.com -Account $account

      The -Account parameterClosed A parameter or argument is a value that is passed into a function in an application. is required if you are using SQL authentication.

    For more information about the Set-KeyfactorGatewayDatabaseConnection cmdlet, see Set-KeyfactorGatewayDatabaseConnection.

    Important:  If you're upgrading from a AnyCAGateway DCOM version 20.x or earlier, stop after completing this step and return to the upgrade instructions (see Upgrading from AnyCAGateway DCOM Version 20.x or Earlier).
  10. Create a JSON Configuration File
  11. The AnyCAGateway DCOM uses a JSON configuration file in place of a GUI configuration wizard. For a new install, you generate a new, default configuration file, customize it as needed, and import the information in it to your SQL database. For a configuration change, you export the existing data from SQL to a JSON file, modify it as needed, and reimport it. This process replaces the configuration wizard GUI interface used in previous releases of the gateway.

    Generate a JSON Configuration File

    The JSON file is created with the Get-KeyfactorGatewayConfig cmdlet. This file is saved to the location and file name specified in the -FilePath parameter when you executed the command. The same cmdlet is used whether you are creating a new file or exporting existing configuration for modification on upgrade (using different parameters). ClosedShow get configuration steps.

    The Get-KeyfactorGatewayConfig cmdlet can be used to generate a new, default configuration file that you can customize and then import into your SQL database and it can be used to export the current configuration from an already configured SQL database. For a new install, you will use it to create a default configuration file.

    To generate a configuration file, run the Get-KeyfactorGatewayConfig cmdlet with a command similar to the following:

    For example, to create a new, default configuration file that you can customize for a new installation (using appropriate values for the gateway hostnameClosed The unique identifier that serves as name of a computer. It is sometimes presented as a fully qualified domain name (e.g. servername.keyexample.com) and sometimes just as a short name (e.g. servername). and the configuration file output path and filename):

    For example, to export the current configuration from the SQL database for review and possible modification and reimport (using appropriate values for the gateway hostname, the configuration file output path and filename, and the logical nameClosed The logical name of a CA is the common name given to the CA at the time it is created. For Microsoft CAs, this name can be seen at the top of the Certificate Authority MMC snap-in. It is part of the FQDN\Logical Name string that is used to refer to CAs when using command-line tools and in some Keyfactor Command configuration settings (e.g. ca2.keyexample.com\Corp Issuing CA Two). assigned to the gateway CA during configuration—see Edit the JSON Configuration File):

    You can also see the content of the configuration in the PowerShell window when you specify the -LogicalName parameter.

    For more information about the Get-KeyfactorGatewayConfig cmdlet, see Get-KeyfactorGatewayConfig.

    Edit the JSON Configuration File

    Once you have created either a fresh JSON configuration file for a new install or exported your existing configuration to a JSON configuration file in preparation for an upgrade (see Generate a JSON Configuration File), you are ready to edit the actual configuration. ClosedShow JSON file configuration steps.

    To configure your gateway, use a text editor to open the JSON file that is created with the Get-KeyfactorGatewayConfig cmdlet and modify each of the following sections:

    Once the JSON file configuration is complete, use the Set-KeyfactorGatewayConfig cmdlet to import the configuration (see Import the JSON Configuration File).

  12. Import the JSON Configuration File
  13. Once you have finished configuring the JSON file, import the configurations in it to the SQL database using the Set-KeyfactorGatewayConfig cmdlet. ClosedShow configuration file import steps.

    The Set-KeyfactorGatewayConfig cmdlet includes a number of parameters that can be specified when importing the configurations from your JSON file to SQL. Similarly to the Get-KeyfactorGatewayConfig cmdlet, you specify the hostname and logical name of the gateway CA and the location of the JSON configuration file for import. The Set-KeyfactorGatewayConfig cmdlet also includes options to publish the gateway CA to Active Directory to make it discoverable as a CA in the Active Directory environment or remove it from Active Directory.

    To import a configuration file, run the Set-KeyfactorGatewayConfig cmdlet with a command similar to the following:

    For example, to import a configured JSON file without publishing it to Active Directory (using appropriate values for the gateway hostname, the configuration file output path and filename, and the logical name):

    For example, to import a configured JSON file and publish it to Active Directory (using appropriate values for the gateway hostname, the configuration file output path and filename, and the logical name):

    For more information about the Set-KeyfactorGatewayConfig cmdlet, see Set-KeyfactorGatewayConfig.

  14. Go to the Keyfactor GitHub and navigate to the Install section for the gateway integration you are using to complete the configuration steps.

  15. Congratulations, you have installed a brand-new instance of the AnyCAGateway DCOM. You may now begin using this CA for all your activities in Keyfactor Command. See Optional Configuration.

Tip:  If you want to change the configuration for any reason, use the cmdlets as follows:
  1. Import the PowerShell configuration cmdlets module. The Import-Module command is a standard PowerShell command. The configuration cmdlets DLLs were delivered to the installation directory during installation. This command imports them into the current PowerShell session. You will need to do this anytime you return to the Database Management Console.

    Import-Module ".\ConfigurationCmdlets.dll"
  2. Run the Get-KeyfactorGatewayConfig using the -FilePath parameter value to output the configuration values to a file (see Get-KeyfactorGatewayConfig). For example (using appropriate values for the gateway hostname, the logical name, and the configuration file output path and filename):

    Get-KeyfactorGatewayConfig -CAHostname mygateway.keyexample.com -LogicalName MyGateway -FilePath C:\Temp\AnyGatewayConfigUpdate.json
  3. Edit the outputted values in the JSON file (see Edit the JSON Configuration File).
  4. Run the Set-KeyfactorGatewayConfig cmdlet using the -FilePath parameter value to import the updated configuration values from the JSON file (see Set-KeyfactorGatewayConfig). For example (using appropriate values for the gateway hostname, the logical name, and the configuration file output path and filename):

    Set-KeyfactorGatewayConfig -CAHostname mygateway.keyexample.com -LogicalName MyGateway -FilePath C:\Temp\AnyGatewayConfigUpdate.json

Note that after the first-time configuration, any future re-configurations check the security settings from the JSON file. The user would need to have administrator security for the AnyCAGateway DCOM server in order to make configuration changes (see Security Section).

The configuration can be changed, if necessary, at this point, or in the future.