Instala y configura el SSO de Apigee

Para instalar y configurar el módulo de SSO de Apigee con un IDP externo, debes realizar las siguientes acciones: lo siguiente:

  1. Crea claves y certificados.
  2. Establece la configuración base del SSO de Apigee: archivo base debe incluir las propiedades que son comunes a todos los parámetros de configuración de SSO.
  3. Agrega propiedades de configuración específicas del IdP: Usa una de las siguientes opciones Bloques específicos de IdP de propiedades de configuración en tu archivo de configuración:
  4. Instalar el SSO de Apigee: Instala el módulo de SSO de Apigee y el archivo de configuración al instalador.

Cada uno de estos pasos se describe en las siguientes secciones.

Crea claves y certificados

En esta sección, se describe cómo crear certificados autofirmados, lo cual puede ser adecuado para tus entorno de pruebas, pero debes usar certificados firmados por una autoridad certificadora (AC) entorno de producción.

Para crear el par de claves que se firmará para la verificación, haz lo siguiente:

  1. Como usuario sudo, crea el siguiente directorio nuevo:
    sudo mkdir -p /opt/apigee/customer/application/apigee-sso/jwt-keys
  2. Cambia al directorio nuevo:
    cd /opt/apigee/customer/application/apigee-sso/jwt-keys/
  3. Genera la clave privada con el siguiente comando:
    sudo openssl genrsa -out privkey.pem 2048
  4. Usa el siguiente comando para generar la clave pública a partir de la clave privada:
    sudo openssl rsa -pubout -in privkey.pem -out pubkey.pem
  5. Cambiar el propietario del archivo PEM de salida a “apigee” usuario:
    sudo chown apigee:apigee *.pem

Para crear la clave y el certificado autofirmado, sin frase de contraseña, para comunicarse con el IDP:

  1. Como usuario sudo, crea un directorio nuevo:
    sudo mkdir -p /opt/apigee/customer/application/apigee-sso/idp/
  2. Cambia al directorio nuevo:
    cd /opt/apigee/customer/application/apigee-sso/idp/
  3. Genera tu clave privada con una frase de contraseña:
    sudo openssl genrsa -aes256 -out server.key 1024
  4. Quita la frase de contraseña de la clave:
    sudo openssl rsa -in server.key -out server.key
  5. Genera una solicitud de firma de certificado para la AC:
    sudo openssl req -x509 -sha256 -new -key server.key -out server.csr
  6. Genera un certificado autofirmado con una hora de vencimiento de 365 días:
    sudo openssl x509 -sha256 -days 365 -in server.csr -signkey server.key -out selfsigned.crt
  7. Cambiar el propietario de la clave y del archivo de certificación a “apigee” propietario:
    sudo chown apigee:apigee server.key
    sudo chown apigee:apigee selfsigned.crt

Para habilitar TLS en el módulo de SSO de Apigee, estableciendo SSO_TOMCAT_PROFILE en SSL_TERMINATION o a SSL_PROXY, no puedes usar un certificado autofirmado. Debes generar un certificado de una AC. Consulta Configura el SSO de Apigee para acceso HTTPS para obtener más información.

Configuración del SSO de Apigee

Antes de instalar el módulo de SSO de Apigee, debes definir un archivo de configuración. Apruebas esto al instalador cuando instales el módulo de SSO de Apigee.

El archivo de configuración tiene la siguiente forma:

IP1=hostname_or_IP_of_apigee_SSO
IP2=hostname_or_IP_of_apigee_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.
# If these credentials change, they must be updated and setup rerun.
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
# Uncomment the following line to set specific SSL cipher using OpenSSL syntax
# SSL_CIPHERS=HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!kRSA
# 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

# Enable the ability to sign an authentication request with SAML SSO.
SSO_SAML_SIGN_REQUEST=y

# Path to signing key and secret from Create the TLS keys and certificates above.
SSO_JWT_SIGNING_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>"

Propiedades de configuración del SSO de SAML

Si usas SAML para tu IdP, usa el siguiente bloque de propiedades de configuración en tu de configuración de Terraform (definido anteriormente):

## 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 on the SSO sign-in page after being redirected by either the New or Classic Edge UI for SAML logins.
# Note: Installing SSO does not depend on the Edge UI or which version of the UI you are using.
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

# Requires that SAML responses be signed by your IDP.
# This property is enabled by default since release 4.50.00.05.
SSO_SAML_SIGNED_ASSERTIONS=y

Propiedades de configuración de la Vinculación directa de LDAP

Si usas la vinculación directa de LDAP para tu IdP, usa el siguiente bloque de configuración en el archivo de configuración, como se muestra en el ejemplo anterior:

## 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

# Set true to allow users to login with non-email usernames
SSO_ALLOW_NON_EMAIL_USERNAME=false

Propiedades de configuración de la vinculación indirecta de LDAP

Si usas el enlace indirecto de LDAP para tu IdP, usa el siguiente bloque de configuración en el archivo de configuración, como se muestra en el ejemplo anterior:

## 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

Instala el módulo de SSO de Apigee

Después de crear las claves y configurar el archivo de configuración, puedes instalar el módulo en el módulo de SSO.

Para instalar el módulo de SSO de Apigee, sigue estos pasos:

  1. Accede al nodo del servidor de administración. Ese nodo ya debería tener apigee-service instalado, como se describe en Instala la utilidad de Apigee-setup de Edge.

    Como alternativa, puedes instalar el módulo de SSO de Apigee en un nodo diferente. Sin embargo, el nodo debe poder acceder al servidor de administración a través del puerto 8080.

  2. Instala y configura apigee-sso con la ejecución del siguiente comando:
    /opt/apigee/apigee-setup/bin/setup.sh -p sso -f configFile

    En el ejemplo anterior, configFile es el archivo de configuración que definiste antes.

  3. Instala la utilidad apigee-ssoadminapi.sh que se usa para administrar el administrador y la máquina usuarios del módulo apigee-sso:
    /opt/apigee/apigee-service/bin/apigee-service apigee-ssoadminapi install
  4. Sal de la shell y, luego, vuelve a acceder para agregar apigee-ssoadminapi.sh. a tu camino.

Especifica un archivo de metadatos en lugar de una URL

Si tu IdP no admite una URL de metadatos HTTP/HTTPS, puedes usar un archivo XML de metadatos para configurar el SSO de Apigee.

Si quieres usar un archivo de metadatos en lugar de una URL para configurar el SSO de Apigee, haz lo siguiente:

  1. Copia el contenido de los metadatos XML de tu IdP a un archivo en el nodo de SSO de Apigee. Para ejemplo, copia el XML a:
    /opt/apigee/customer/application/apigee-sso/saml/metadata.xml
  2. Cambiar la propiedad del archivo XML a “apigee” usuario:
    chown apigee:apigee /opt/apigee/customer/application/apigee-sso/saml/metadata.xml
  3. Configura el valor de SSO_SAML_IDP_METADATA_URL como la ruta absoluta del archivo:
    SSO_SAML_IDP_METADATA_URL=file:///opt/apigee/customer/application/apigee-sso/saml/metadata.xml

    Debes agregar el prefijo “file://” seguido de la ruta de acceso absoluta desde raíz (/).