安裝並設定 Apigee 單一登入 (SSO)

如要使用外部 IDP 安裝及設定 Apigee 單一登入 (SSO) 模組,您必須執行 包括:

  1. 建立金鑰和憑證
  2. 進行基本的 Apigee 單一登入 (SSO) 設定 基礎檔案必須包含所有單一登入 (SSO) 設定通用的屬性。
  3. 新增 IdP 專屬設定屬性:請使用下列其中一種方式 設定檔中的 IdP 專屬的設定屬性區塊:
  4. 安裝 Apigee 單一登入 (SSO)安裝 Apigee 單一登入 (SSO) 模組,然後 將設定檔提供給安裝程式

每個步驟都會在後續章節中說明。

建立金鑰和憑證

本節將說明如何建立自行簽署的憑證,這對您的 但您必須使用憑證授權單位 (CA) 簽署的憑證 正式環境

如何建立用於簽署驗證的金鑰組:

  1. 以 sudo 使用者的身分,建立下列新目錄:
    sudo mkdir -p /opt/apigee/customer/application/apigee-sso/jwt-keys
  2. 變更為新目錄:
    cd /opt/apigee/customer/application/apigee-sso/jwt-keys/
  3. 請使用下列指令產生私密金鑰:
    sudo openssl genrsa -out privkey.pem 2048
  4. 使用下列指令透過私密金鑰產生公開金鑰:
    sudo openssl rsa -pubout -in privkey.pem -out pubkey.pem
  5. 將輸出 PEM 檔案的擁有者變更為「apigee」使用者:
    sudo chown apigee:apigee *.pem

如何建立金鑰和自行簽署的憑證,而不使用通關密語,以便與 IDP:

  1. 以 sudo 使用者的身分建立新目錄:
    sudo mkdir -p /opt/apigee/customer/application/apigee-sso/idp/
  2. 變更為新目錄:
    cd /opt/apigee/customer/application/apigee-sso/idp/
  3. 使用通關密語產生私密金鑰:
    sudo openssl genrsa -aes256 -out server.key 1024
  4. 從金鑰中移除通關密語:
    sudo openssl rsa -in server.key -out server.key
  5. 產生 CA 的憑證簽署要求:
    sudo openssl req -x509 -sha256 -new -key server.key -out server.csr
  6. 產生自行簽署的憑證 (有效期限為 365 天):
    sudo openssl x509 -sha256 -days 365 -in server.csr -signkey server.key -out selfsigned.crt
  7. 將金鑰和 crt 檔案的擁有者變更為「apigee」擁有者:
    sudo chown apigee:apigee server.key
    sudo chown apigee:apigee selfsigned.crt

如要在 Apigee 單一登入 (SSO) 模組中啟用 TLS,請按照下列步驟操作: 將「SSO_TOMCAT_PROFILE」設為「SSL_TERMINATION」或 至 SSL_PROXY,您無法使用自行簽署的憑證。您必須產生 由 CA 提供的憑證請參閱為 HTTPS 存取權

Apigee 單一登入 (SSO) 配置設定

您必須先定義設定檔,才能安裝 Apigee 單一登入 (SSO) 模組。您通過了 設定檔複製到安裝程式

設定檔的格式如下:

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

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

SAML 單一登入 (SSO) 設定屬性

如果您的 IdP 使用 SAML,請在指令中使用以下設定屬性區塊: 設定檔 (如上定義):

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

LDAP 直接繫結組態屬性

如果您的 IDP 使用 LDAP 直接繫結,請使用下列設定區塊 屬性,如上例所示:

## 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 間接繫結組態屬性

如果您的 IDP 使用 LDAP 間接繫結,請使用下列設定區塊 屬性,如上例所示:

## 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
# LDAP 伺服器用來參照使用者電子郵件地址的屬性名稱;例如「郵件」 SSO_LDAP_MAIL_ATTRIBUTE=LDAP_email_attribute

安裝 Apigee 單一登入 (SSO) 模組

建立金鑰並設定設定檔後,您就可以安裝 Apigee 單一登入 (SSO) 模組。

如何安裝 Apigee 單一登入 (SSO) 模組:

  1. 登入 Management Server 節點。該節點應該已經 已安裝「apigee-service」,如所述 安裝 Edge apigee-setup 公用程式

    或者,您「可以」在其他節點上安裝 Apigee 單一登入 (SSO) 模組。不過 該節點必須能夠透過通訊埠 8080 存取管理伺服器。

  2. 執行下列指令來安裝及設定 apigee-sso
    /opt/apigee/apigee-setup/bin/setup.sh -p sso -f configFile

    其中 configFile 是您在上方定義的設定檔。

  3. 安裝用於管理管理員和機器的 apigee-ssoadminapi.sh 公用程式 apigee-sso模組的使用者:
    /opt/apigee/apigee-service/bin/apigee-service apigee-ssoadminapi install
  4. 登出殼層再重新登入,以便新增 apigee-ssoadminapi.sh 延伸到路徑

指定中繼資料檔案而非網址

如果 IdP 不支援 HTTP/HTTPS 中繼資料網址,您可以使用中繼資料 XML 檔案來 設定 Apigee 單一登入

如要設定 Apigee 單一登入 (SSO) 而非網址,而是使用中繼資料檔案:

  1. 將 IdP 中的中繼資料 XML 內容複製到 Apigee 單一登入 (SSO) 節點上的檔案。適用對象 例如,請將 XML 複製到:
    /opt/apigee/customer/application/apigee-sso/saml/metadata.xml
  2. 將 XML 檔案的擁有權變更為「apigee」使用者:
    chown apigee:apigee /opt/apigee/customer/application/apigee-sso/saml/metadata.xml
  3. SSO_SAML_IDP_METADATA_URL 的值設為絕對檔案路徑:
    SSO_SAML_IDP_METADATA_URL=file:///opt/apigee/customer/application/apigee-sso/saml/metadata.xml

    您必須在檔案路徑前面加上「file://」,後面的絕對路徑是 根 (/)。