התקנה והגדרה של SSO ב-Apigee

כדי להתקין ולהגדיר את מודול ה-SSO של Apigee באמצעות IDP חיצוני, צריך לבצע את הפעולות הבאות:

  1. יצירת מפתחות ואישורים.
  2. קביעת ההגדרה הבסיסית של SSO ב-Apigee: קובץ הבסיס צריך לכלול את המאפיינים המשותפים לכל הגדרות ה-SSO.
  3. הוספת מאפייני תצורה ספציפיים ל-IdP: משתמשים באחד מהבלוקים הבאים שספציפיים ל-IdP של מאפייני התצורה:
  4. התקנת Apigee SSO: התקנת מודול ה-SSO של Apigee והעברת קובץ התצורה למנהל ההתקנה.

כל אחד מהשלבים האלה מתואר בסעיפים הבאים.

יצירת מפתחות ואישורים

בקטע הזה נסביר איך ליצור אישורים בחתימה עצמית, שעשויים להתאים לסביבת הבדיקה, אבל צריך להשתמש באישורים החתומים על ידי רשות אישורים (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. יצירת בקשה לחתימה על אישור עבור רשות האישורים:
    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 לבעלים של ה "APIge":
    sudo chown apigee:apigee server.key
    sudo chown apigee:apigee selfsigned.crt

כדי להפעיל את TLS במודול ה-SSO של Apigee, על ידי הגדרת הערך של SSO_TOMCAT_PROFILE לערך SSL_TERMINATION או לערך SSL_PROXY, לא ניתן להשתמש באישור בחתימה עצמית. עליך ליצור אישור מ-CA. מידע נוסף זמין במאמר הגדרת SSO ב-Apigee לגישת HTTPS.

הגדרות אישיות של SSO ב-Apigee

כדי להתקין את מודול ה-SSO של Apigee, צריך להגדיר קובץ תצורה. כשמתקינים את מודול ה-SSO של Apigee, צריך להעביר את קובץ התצורה הזה למנהל ההתקנה.

קובץ התצורה מורכב מהצורה הבאה:

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

מאפייני הגדרה של SSO ב-SAML

אם אתם משתמשים ב-SAML עבור ה-IdP, השתמשו בבלוק הבא של מאפייני ההגדרות בקובץ התצורה (שמוגדר למעלה):

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

אם משתמשים בחיבור ישיר ל-LDAP עבור ה-IdP, צריך להשתמש בבלוק הבא של מאפייני ההגדרות בקובץ התצורה, כמו בדוגמה שלמעלה:

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

אם משתמשים בקישור עקיף של LDAP ל-IdP, צריך להשתמש בבלוק הבא של מאפייני ההגדרות בקובץ התצורה, כמו בדוגמה למעלה:

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

התקנה של מודול ה-SSO של Apigee

אחרי שיוצרים את המפתחות ומגדירים את קובץ התצורה, אפשר להתקין את מודול ה-SSO של Apigee.

כדי להתקין את מודול ה-SSO של Apigee:

  1. נכנסים לצומת של שרת הניהול. apigee-service כבר אמור להיות מותקן בצומת הזה, כפי שמתואר בהתקנת כלי השירות Edge apigee-setup.

    לחלופין, אפשר להתקין את מודול ה-SSO של Apigee בצומת אחר. עם זאת, לצומת הזה צריכה להיות גישה לשרת הניהול דרך יציאה 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 לנתיב.

ציון קובץ מטא-נתונים במקום כתובת URL

אם ה-IdP שלך לא תומך בכתובת URL של מטא-נתונים מסוג HTTP/HTTPS, אפשר להשתמש בקובץ XML של מטא-נתונים כדי להגדיר כניסה יחידה (SSO) ל-Apigee.

כדי להגדיר כניסה יחידה (SSO) ל-Apigee באמצעות קובץ מטא-נתונים במקום כתובת URL:

  1. מעתיקים את התוכן של קובץ ה-XML של המטא-נתונים מה-IdP שלך לקובץ בצומת ה-SSO של Apigee. לדוגמה, מעתיקים את ה-XML אל:
    /opt/apigee/customer/application/apigee-sso/saml/metadata.xml
  2. משנים את הבעלות על קובץ ה-XML למשתמש ה-API:
    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://" לפני הנתיב המוחלט מהשורש (/).