如要安裝及設定具有外部 IDP 的 Apigee SSO 模組,您必須執行下列操作:
- 建立金鑰和憑證。
- 完成 Apigee 單一登入 (SSO) 基本設定:基礎檔案必須包含所有單一登入 (SSO) 設定通用的屬性。
- 新增 IdP 專屬設定屬性:在設定檔中使用下列其中一個 IdP 專屬設定屬性區塊:
- 安裝 Apigee SSO:安裝 Apigee SSO 模組,並將設定檔傳送給安裝程式。
以下各節將說明這些步驟。
建立金鑰和憑證
本節說明如何建立適用於測試環境的自行簽署憑證,但您應該在實際工作環境中使用由憑證授權單位 (CA) 簽署的憑證。
如何建立用於簽署驗證的金鑰組:
- 以 sudo 使用者身分建立下列新目錄:
sudo mkdir -p /opt/apigee/customer/application/apigee-sso/jwt-keys
- 變更為新的目錄:
cd /opt/apigee/customer/application/apigee-sso/jwt-keys/
- 使用下列指令產生私密金鑰:
sudo openssl genrsa -out privkey.pem 2048
- 使用下列指令從私密金鑰產生公開金鑰:
sudo openssl rsa -pubout -in privkey.pem -out pubkey.pem
- 將輸出 PEM 檔案的擁有者變更為「apigee」使用者:
sudo chown apigee:apigee *.pem
如要在不設定通關密語的情況下建立金鑰和自行簽署的憑證,以便與 IdP 通訊,請按照下列指示操作:
- 以 sudo 使用者的身分建立新目錄:
sudo mkdir -p /opt/apigee/customer/application/apigee-sso/idp/
- 變更為新的目錄:
cd /opt/apigee/customer/application/apigee-sso/idp/
- 使用通關密語產生私密金鑰:
sudo openssl genrsa -aes256 -out server.key 1024
- 從金鑰中移除通關密語:
sudo openssl rsa -in server.key -out server.key
- 產生 CA 的憑證簽署要求:
sudo openssl req -x509 -sha256 -new -key server.key -out server.csr
- 在 365 天的有效期限產生自行簽署憑證:
sudo openssl x509 -sha256 -days 365 -in server.csr -signkey server.key -out selfsigned.crt
- 將金鑰和 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) 設定
您必須先定義設定檔,才能安裝 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 伺服器使用的屬性名稱會參照使用者的電子郵件地址,例如「mail」 SSO_LDAP_EXTERNAL_ATTRIBUTE=LDAP_email_attribute
安裝 Apigee SSO 模組
建立金鑰並設定設定檔後,您就可以安裝 Apigee 單一登入 (SSO) 模組。
如何安裝 Apigee SSO 模組:
- 登入 Management Server 節點。該節點應該已安裝
apigee-service
,詳情請參閱安裝 Edge apigee-setup 公用程式。或者,您也可以在其他節點上安裝 Apigee 單一登入 (SSO) 模組。不過,該節點必須可以透過通訊埠 8080 存取管理伺服器。
- 執行下列指令來安裝及設定
apigee-sso
:/opt/apigee/apigee-setup/bin/setup.sh -p sso -f configFile
其中 configFile 是您在上述步驟定義的設定檔。
- 安裝
apigee-ssoadminapi.sh
公用程式,用於管理apigee-sso
模組的管理員和機器使用者:/opt/apigee/apigee-service/bin/apigee-service apigee-ssoadminapi install
- 登出殼層,然後再次登入,將
apigee-ssoadminapi.sh
公用程式新增至路徑。
指定中繼資料檔案,而非網址
如果您的 IdP 不支援 HTTP/HTTPS 中繼資料網址,您可以使用中繼資料 XML 檔案設定 Apigee SSO。
如何使用中繼資料檔案 (而非網址) 設定 Apigee SSO:
- 將中繼資料 XML 的內容從 IDP 複製到 Apigee SSO 節點上的檔案。例如,請將 XML 複製到:
/opt/apigee/customer/application/apigee-sso/saml/metadata.xml
- 將 XML 檔案的擁有權變更為「apigee」使用者:
chown apigee:apigee /opt/apigee/customer/application/apigee-sso/saml/metadata.xml
- 將
SSO_SAML_IDP_METADATA_URL
的值設為絕對檔案路徑:SSO_SAML_IDP_METADATA_URL=file:///opt/apigee/customer/application/apigee-sso/saml/metadata.xml
您必須在檔案路徑前面加上「
file://
」,後面接著根 (/) 的絕對路徑。