General

License Installation: Floating License

This section explains how to manage floating CodeSonar licenses.

Note that most CodeSonar licenses are not floating. If you do not have a floating license, see Hub Setup: Hub License for information on setting up a license.



Start Here

Do you already have a CodeSonar license?

Before You Obtain A License

  1. Make sure CodeSonar is installed. If not, install it now.
  2. Decide where you want to run the CodeSonar hub. The Setting Up The Hub section describes the factors that may affect this decision. We will refer to this machine as runhost in the remainder of these instructions.
  3. Determine whether or not you require a floating license. You need a floating license if, and only if, you want to run a hub on a machine other than the one the license is locked to. The Setting Up The Hub section describes the factors that may affect your choice of hub location.
  4. Decide where you want to run the CodeSonar license server. The floating license will be specific to this machine: it will not work with license servers running on other computers. We will refer to this machine as serverhost in the remainder of these instructions.
  5. If CodeSonar is not installed on serverhost, install it now.
  6. Update the setting of your PATH environment to include $CSONAR/gtr/bin (if it is not already present).
    On Windows systems this is typically c:\Program Files\CodeSecure\CodeSonar\gtr\bin

Obtain and Set Up The License

Once you have determined a serverhost for running the CodeSonar license server:

  1. Log into serverhost.
  2. Run
    codesonar generate-license
    This command collects a small set of information that will be used to construct your license.
  3. Copy the output from codesonar generate-license. It will look (something) like the following.
    {
        "ip addresses" : [ "198.51.100.0" ],
        "lock mutex" : "Global\codesonar_license",
        "mac addresses" : [ "02:00:5e:fe:c6:33:64:00" ],
        "machine" : "alexmachine",
        "name" : "CodeSonar",
        "user" : "alex",
        "version" : 309,
        "volumes" : [ "A438-C3F3" ]
    }
    
  4. Open CodeSecure's license request page.
  5. Paste the output from codesonar generate-license into the form field provided, and click Submit. CodeSecure will generate a license based on the information you collected and on your licensing terms, then mail the license text to you.

    The license text will resemble an extended version of the codesonar generate-license output you submitted to CodeSecure. In particular, it will include a signature attribute.

  6. When you have received the license text from CodeSecure, verify that it is a floating license: it should contain an attribute of the form "floating":true.
  7. Decide whether you want to use server-side or client-side management for the new license. Server-side licensing is generally more straightforward, but client-side licenses can be added or updated without restarting the license server.
    Either:

Server-Side Setup

  1. Save the license text you received from CodeSecure on serverhost, in a location where the license server will be able to read it. We will refer to this location as <path>/<to>/<licensefile>.
  2. On serverhost, start the license server. (See the IPv4 note if your system does not support IPv6 loopback addresses.)
  3. Inform CodeSonar of the license server location.
    1. Navigate to the hub's License Utilization page.
    2. Enter the following text into the Edit License(s) field, replacing any text that was previously present.
      { "server address":"<serverhost>:<serverport>",
        "server side" : true  }
      
      For example, if your license server is running at [2001:db8::abcd]:7350:
      { "server address":"[2001:db8::abcd]:7350",
        "server side" : true }
      
    3. Click Save. The hub will attempt to connect to the license server and obtain a license session.
      • On success, CodeSonar will display a "License successfully updated" message above the text field and update the utilization summary to reflect the current license terms.
      • Otherwise, CodeSonar will display a "License Error" message above the text field, with details of the problem experienced.

Client-Side Setup

As an alternative to specifying server-side licenses with -f licensefile at license server startup, it is sometimes more convenient to use a client-side license. Client-side licenses are still managed by the license server, but are stored on the client machine.

To set up a client-side license managed by the license server at <serverhost>:<serverport>:

  1. On serverhost, start the license server. (See the IPv4 note if your system does not support IPv6 loopback addresses.)
  2. Connect your hub to the license server.
    1. Navigate to the hub's License Utilization page.
    2. Paste the license text you received from CodeSecure into the Edit License(s) field, replacing any text that was previously present.
    3. If necessary, edit the file so that it conforms to client-side requirements:
      1. If attribute "server address":"<serverhost>:<serverport>" is not present, add it. Make sure there is a comma between this attribute and the one before it, and place a comma after the attribute if it is not the last one in the license.
      2. Delete any conflicting "server address":"..." attributes.
      (Note that changes to these attributes are allowed for in the CodeSonar licensing mechanism and will not affect license validation.)
    4. Click Save. The hub will attempt to connect to the license server and obtain a license session.
      • On success, CodeSonar will display a "License successfully updated" message above the text field and update the utilization summary to reflect the current license terms.
      • Otherwise, CodeSonar will display a "License Error" message above the text field, with details of the problem experienced.

Updating Floating Licenses

If you receive an updated license from CodeSecure, perhaps because you have purchased an amendment to allow additional licensed resources , you will need to apply the updates.

Updating Server-Side Licenses

To update a server-side license managed by a license server running on <serverhost>:<serverport>:

  1. Shut down the hub.
  2. Stop the license server on <serverhost>. (See the IPv4 note if your system does not support IPv6 loopback addresses.)
  3. Replace your old license file path/to/licensefile with the new license file.
    cp updatedlicense path/to/licensefile
  4. Restart the license server. Include any <other_flags> that your license server requires. In particular, use -f directives to specify any other server-side licenses to be managed by the server.
  5. Restart the hub.

Updating Client-Side Licenses

To update a client-side license:

  1. Prepare the updated license file as described above.
  2. Navigate to the hub's License Utilization page.
  3. Paste the contents of your edited file into the Edit License(s) field, replacing any text that was previously present.
  4. Click Save.

License Server Commands

This section contains detailed information about starting and stopping the license server.

Starting the License Server

Start the license server in the following situations:

To start a license server as a background process:

stifflm start [-a <host>:<port>] [-m <max_sockets>] [-f <license_file>] [-n]

where:

-a <host>:<port>: specifies the location at which the license server will run. Default is [::]:7350.
-m <max_sockets>: specifies the maximum number of connections ( hub to license server) permitted. Default is 62.
-f <license_file>: specifies a license file that should be managed by the server. The licenses specified in this way are referred to as server-side licenses.
The stifflm start command can specify multiple -f values. There is no default value.
-n: [Windows only] specifies that the license server should not be run as a service. This option is not recommended.

To start a license server in the foreground use stifflm server, which has the same set of options as stifflm start.

Stopping the License Server

Stop the license server in the following situations:

To stop a license server:

stifflm stop [-a <serverhost>:<serverport>]

where <serverhost>:<serverport> is the location at which the license server is running (default id localhost:7350).

Note that stopping the license server will usually cause any hubs licensed through that server to shut down.

Troubleshooting

If CodeSonar encounters problems in processing your license, it will display an error message.

The following are some common error message types.

[...]
Found network interface {...} with hardware address 02:00:5e:fe:c6:33:64:00. Not present in license.
None of the MAC addresses in the license were present on this computer.
None of the MAC (hardware) addresses of the NICs (network interface controllers) on the machine correspond to any of the addresses listed in the license.
Connecting to <serverhost>:<serverport> for license download.
Resolved to <IPaddress>:<serverport>.
Connection to <IPaddress>:<serverport> failed: Connection timed out.
First, check that the license server machine (serverhost) is running and is connected to your network.

If serverhost is available on the network and you are still seeing this problem, access to serverhost:serverport may be blocked by a firewall or other network security measure. Resolution will depend on your platform and on your network policies: you may need to consult your system administrator to determine the best approach, which in general will involve either:

License does not parse: CS_INVALID_DATA_FORMAT
Perhaps the license was not transcribed accurately.
The text you have provided does not have correct license syntax.
License verification failed.
Perhaps the license was not transcribed accurately.
Note that licenses are case sensitive.
Some attribute of the license is inconsistent with its signature.

Almost all of the license text is validated against the signature: "server address" is the only attribute that can be added, removed, or edited.

License verification failed.
The license is not signed.
The license does not contain a signature attribute.

You may have accidentally used the output from codesonar generate-license rather than the signed license you received from CodeSecure.

[...]
License already in use by another process (Global\codesonar_license is locked).
or
License already in use by process with PID pid (/tmp/codesonar_license.lock is locked).
The maximum number of CodeSonar hubs permitted by the license are already running, so the current hub cannot be licensed. This can occur with both server-side and client-side licenses.

Navigating to the License Utilization Page

For a hub located at <hostname>:<port>, navigate to the License Utilization page as follows.

  1. Set up and start the hub, if necessary.
  2. If the CodeSonar Web GUI is not already open, open it now.
    http://<hostname>:<port>/
  3. If you are not already signed in as Administrator, sign in now.
    1. Click the Sign In link (at the top right of the page).
      CodeSonar will open a page for you to enter credentials.
    2. Enter Administrator in the Username field.
    3. Enter the Administrator password in the Password field.
      (If you have just started a new hub, you will have set a password for Administrator as part of that process.)
    4. Click Sign In.
    If this is the first time the Administrator account has been used, you will be asked to specify an email address for the account.
  4. Click the see licensing details link in the GUI footer.
    The License Utilization page will open. Directly under the page heading will be a text field labeled Edit License(s).

If You Don't Use the GUI

If you don't use the CodeSonar GUI, you can specify a license server for your hub by saving the relevant license information in a file on the hub machine (runhost).

We do not recommend using this approach if you have the option of using the GUI.

  1. Decide whether you want to use server-side or client-side license management.
  2. Create a text file with contents as described above (server-side | client-side).
  3. Save the file in an appropriate location on runhost. There are two options.

IPv4 Note

If your system does not support IPv6 loopback addresses, use IPv4 to specify and identify addresses instead. For example:

If you have not yet configured the hub, go on to Hub Setup: Hub Configuration.
Otherwise, go on to Installation: Finishing Up.