Install and configure Apigee SSO

To install and configure the Apigee SSO module with an external IDP, you must do the following:

  1. Create the TLS keys and certificates: The Apigee SSO module uses TLS to secure the transmission of information with external entities.
  2. Set up the base Apigee SSO configuration: The base file must include the properties that are common to all SSO configurations.
  3. Add IDP-specific configuration properties: Use one of the following IDP-specific blocks of configuration properties in your configuration file:
  4. Install Apigee SSO: Install the Apigee SSO module, and pass the configuration file to the installer.

Each of these steps is described in the sections that follow.

Create the TLS keys and certificates

This section describes how to create self-signed certificates which might be fine for your testing environment but you should use certificates signed by a Certificate Authority (CA) for a production environment.

To create the verification and signing key and self-signed cert:

  1. As a sudo user, create the following new directory:
    sudo mkdir -p /opt/apigee/customer/application/apigee-sso/jwt-keys
  2. Change to the new directory:
    cd /opt/apigee/customer/application/apigee-sso/jwt-keys/
  3. Generate the private key with the following command:
    sudo openssl genrsa -out privkey.pem 2048
  4. Generate the public key from the private key with the following command:
    sudo openssl rsa -pubout -in privkey.pem -out pubkey.pem
  5. Change the owner of the output PEM file to the "apigee" user:
    sudo chown apigee:apigee *.pem

To create the key and self-signed cert, with no passphrase, for communicating with the IDP:

  1. As a sudo user, make a new directory:
    sudo mkdir -p /opt/apigee/customer/application/apigee-sso/idp/
  2. Change to the new directory:
    cd /opt/apigee/customer/application/apigee-sso/idp/
  3. Generate your private key with a passphrase:
    sudo openssl genrsa -aes256 -out server.key 1024
  4. Remove the passphrase from the key:
    sudo openssl rsa -in server.key -out server.key
  5. Generate certificate signing request for CA:
    sudo openssl req -x509 -sha256 -new -key server.key -out server.csr
  6. Generate self-signed certificate with 365 days expiry-time:
    sudo openssl x509 -sha256 -days 365 -in server.csr -signkey server.key -out selfsigned.crt
  7. Change the owner of the key and crt file to the "apigee" owner:
    sudo chown apigee:apigee server.key
    sudo chown apigee:apigee selfsigned.crt

To enable TLS on the Apigee SSO module, by setting SSO_TOMCAT_PROFILE to SSL_TERMINATION or to SSL_PROXY, you cannot use a self-signed certificate. You must generate a cert from a CA. See Configure Apigee SSO for HTTPS access for more.

Apigee SSO configuration settings

Before you can install the Apigee SSO module, you must define a configuration file. You pass this configuration file to the installer when you install the Apigee SSO module.

The configuration file has the following form:

IP1=hostname_or_IP_of_management_server
IP2=hostname_or_IP_of_UI_and_apigge_SSO

## Management Server configuration.
# Management Server IP address and port
MSIP=$IP1
MGMT_PORT=8080
# Edge sys admin username and password as set when you installed Edge.
ADMIN_EMAIL=opdk@google.com
APIGEE_ADMINPW=Secret123
# Set the protocol for the Edge management API. Default is http.
# Set to https if you enabled TLS on the management API.
MS_SCHEME=http

## Postgres configuration.
# Postgres IP address and port
PG_HOST=$IP1
PG_PORT=5432
# Postgres username and password as set when you installed Edge.
PG_USER=apigee
PG_PWD=postgres

## Apigee SSO module configuration.
#Choose either "saml" or "ldap".
SSO_PROFILE="[saml|ldap]"
# Externally accessible IP or DNS name of apigee-sso.
SSO_PUBLIC_URL_HOSTNAME=$IP2
SSO_PG_DB_NAME=database_name_for_sso

# Default port is 9099. If changing, set both properties to the same value.
SSO_PUBLIC_URL_PORT=9099
SSO_TOMCAT_PORT=9099
# Set Tomcat TLS mode to DEFAULT to use HTTP access to apigee-sso.
SSO_TOMCAT_PROFILE=DEFAULT
SSO_PUBLIC_URL_SCHEME=http

# SSO admin user name. The default is ssoadmin.
SSO_ADMIN_NAME=ssoadmin
# SSO admin password using uppercase, lowercase, number, and special chars.
SSO_ADMIN_SECRET=Secret123

# Path to signing key and secret from Create the TLS keys and certificates above.
SSO_JWT_SIGNINIG_KEY_FILEPATH=/opt/apigee/customer/application/apigee-sso/jwt-keys/privkey.pem
SSO_JWT_VERIFICATION_KEY_FILEPATH=/opt/apigee/customer/application/apigee-sso/jwt-keys/pubkey.pem

###########################################################
#                 Define External IDP                     #
# Use one of the following configuration blocks to        #
# define your IDP settings:                               #
#  - SAML configuration properties                     #
#  - LDAP Direct Binding configuration properties        #
#  - LDAP Indirect Binding configuration properties       #
###########################################################

INSERT_IDP_CONFIG_BLOCK_HERE (SAML, LDAP direct, or LDAP indirect, below)

# Configure an SMTP server so that the Apigee SSO module can send emails to users
SKIP_SMTP=n
SMTPHOST=smtp.example.com
SMTPUSER=smtp@example.com
# omit for no username
SMTPPASSWORD=smtppwd
# omit for no password
SMTPSSL=n
SMTPPORT=25
# The address from which emails are sent
SMTPMAILFROM="My Company <myco@company.com>"

SAML SSO configuration properties

If you are using SAML for your IDP, use the following block of configuration properties in your configuration file (defined above):

## SAML Configuration Properties
# Insert this section into your base configuration file, as described previously.

# Name of SAML IDP. For example, okta or adfs.
SSO_SAML_IDP_NAME=okta
# Text displayed to user when they attempt to access Edge UI.
SSO_SAML_IDP_LOGIN_TEXT="Please log in to your IDP"

# The metadata URL from your IDP.
# If you have a metadata file, and not a URL,
# see "Specifying a metadata file instead of a URL" below.
SSO_SAML_IDP_METADATA_URL=https://dev-343434.oktapreview.com/app/exkar20cl/sso/saml/metadata

# Determines whether to skip TLS validation for the URL specified
# by SSO_SAML_IDP_METADATA_URL.
# This is necessary if the URL uses a self-signed certificate.
# The default value is "n".
SSO_SAML_IDPMETAURL_SKIPSSLVALIDATION=n

# SAML service provider key and cert from Create the TLS keys and certificates above.
SSO_SAML_SERVICE_PROVIDER_KEY=/opt/apigee/customer/application/apigee-sso/saml/server.key
SSO_SAML_SERVICE_PROVIDER_CERTIFICATE=/opt/apigee/customer/application/apigee-sso/saml/selfsigned.crt

# The passphrase used when you created the SAML cert and key.
# The section "Create the TLS keys and certificates" above removes the passphrase,
# but this property is available if you require a passphrase.
# SSO_SAML_SERVICE_PROVIDER_PASSWORD=samlSP123

LDAP Direct Binding configuration properties

If you are using LDAP direct binding for your IDP, use the following block of configuration properties in you configuration file, as shown in the example above:

## LDAP Direct Binding configuration
# Insert this section into your base configuration file, as described previously.

# The type of LDAP profile; in this case, "direct"
SSO_LDAP_PROFILE=direct

# The base URL to which SSO connects; in the form: "ldap://hostname_or_IP:port
SSO_LDAP_BASE_URL=LDAP_base_URL

# Attribute name used by the LDAP server to refer to the user's email address; for example, "mail"
SSO_LDAP_MAIL_ATTRIBUTE=LDAP_email_attribute

# Pattern of the user's DN; for example: =cn={0},ou=people,dc=example,dc=org
# If there is more than one pattern, separate with semicolons (";"); for example:
# =cn={0},ou=people,dc=example,dc=org;=cn={0},ou=people,dc=example,dc=com
SSO_LDAP_USER_DN_PATTERN=LDAP_DN_pattern

LDAP Indirect Binding configuration properties

If you are using LDAP indirect binding for your IDP, use the following block of configuration properties in your configuration file, as shown in the example above:

## LDAP Indirect Binding configuration
# Insert this section into your base configuration file, as described previously.

# Type of LDAP profile; in this case, "indirect"
SSO_LDAP_PROFILE=indirect

# Base URL to which SSO connects; in the form: "ldap://hostname_or_IP:port
SSO_LDAP_BASE_URL=LDAP_base_URL

# DN and password of the LDAP server's admin user
SSO_LDAP_ADMIN_USER_DN=LDAP_admin_DN
SSO_LDAP_ADMIN_PWD=LDAP_admin_password

# LDAP search base; for example, "dc=example,dc=org"
SSO_LDAP_SEARCH_BASE=LDAP_search_base

# LDAP search filter; for example, "cn={0}"
SSO_LDAP_SEARCH_FILTER=LDAP_search_filter
# Attribute name used by the LDAP server to refer to the user's email address; for example, "mail" SSO_LDAP_MAIL_ATTRIBUTE=LDAP_email_attribute

Install the Apigee SSO module

After you create the keys and set up your configuration file, you can install the Apigee SSO module.

To install the Apigee SSO module:

  1. Log in to the Management Server node. That node should already have apigee-service installed, as described in Install the Edge apigee-setup utility.

    Alternatively, you can install the Apigee SSO module on a different node. However, that node must be able to access the Management Server over port 8080.

  2. Install and configure apigee-sso by executing the following command:
    /opt/apigee/apigee-setup/bin/setup.sh -p sso -f configFile

    Where configFile is the configuration file that you defined above.

  3. Install the apigee-ssoadminapi.sh utility used to manage admin and machine users for the apigee-sso module:
    /opt/apigee/apigee-service/bin/apigee-service apigee-ssoadminapi install
  4. Log out of the shell, and then log back in again to add the apigee-ssoadminapi.sh utility to your path.

Specify a metadata file instead of a URL

If your IDP does not support an HTTP/HTTPS metadata URL, you can use a metadata XML file to configure Apigee SSO.

To use a metadata file instead of a URL to configure Apigee SSO:

  1. Copy the contents of the metadata XML from your IDP to a file on the Apigee SSO node. For example, copy the XML to:
    /opt/apigee/customer/application/apigee-sso/saml/metadata.xml
  2. Change ownership of the XML file to the "apigee" user:
    chown apigee:apigee /opt/apigee/customer/application/apigee-sso/saml/metadata.xml
  3. Set the value of SSO_SAML_IDP_METADATA_URL to the absolute file path:
    SSO_SAML_IDP_METADATA_URL=file:///opt/apigee/customer/application/apigee-sso/saml/metadata.xml

    You must prefix the file path with "file://", followed by the absolute path from root (/).