Cài đặt và định cấu hình dịch vụ SSO dựa trên Edge

Edge for Private Cloud phiên bản 4.17.09

Để cài đặt và định cấu hình mô-đun SSO của Edge, trước tiên, bạn phải tạo hai bộ khoá và chứng chỉ TLS. Mô-đun SSO của Edge sử dụng TLS để bảo mật quá trình truyền thông tin trong quá trình bắt tay SAML với IDP SAML.

Lưu ý: Theo mặc định, bạn có thể truy cập vào mô-đun SSO của Edge qua HTTP trên cổng 9099 của nút mà mô-đun này được cài đặt. Bạn có thể bật TLS trên mô-đun SSO của Edge. Để làm việc này, bạn phải tạo một bộ khoá và chứng chỉ TLS thứ ba mà Tomcat sử dụng để hỗ trợ TLS. Hãy xem phần Định cấu hình apigee-sso để truy cập HTTPS để biết thêm thông tin.

Tạo khoá và chứng chỉ TLS

Các bước dưới đây tạo chứng chỉ tự ký có thể phù hợp với môi trường thử nghiệm của bạn, nhưng bạn thường cần chứng chỉ do CA ký cho môi trường thực tế.

Cách tạo khoá xác minh và ký cũng như chứng chỉ tự ký:

  1. > 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. > sudo chown apigee:apigee *.pem

Cách tạo khoá và chứng chỉ tự ký, không có cụm mật khẩu, để giao tiếp với IDP SAML:

  1. > sudo mkdir -p /opt/apigee/customer/application/apigee-sso/saml/
  2. > cd /opt/apigee/customer/application/apigee-sso/saml/
  3. Tạo khoá riêng tư bằng cụm mật khẩu:
    > sudo openssl genrsa -aes256 -out server.key 1024
  4. Xoá cụm mật khẩu khỏi khoá:
    > sudo openssl rsa -in server.key -out server.key
  5. Tạo yêu cầu ký chứng chỉ cho CA:
    > sudo openssl req -x509 -sha256 -new -key server.key -out server.csr
  6. Tạo chứng chỉ tự ký có thời hạn 365 ngày:
    > sudo openssl x509 -sha256 -days 365 -in server.csr -signkey server.key -out selfsigned.crt
  7. > sudo chown apigee:apigee server.key
  8. > sudo chown apigee:apigee selfsigned.crt

Nếu muốn bật TLS trên mô-đun SSO của Edge bằng cách đặt SSO_TOMCAT_PROFILE thành SSL_TERMINATION hoặc thành SSL_PROXY, bạn không thể sử dụng chứng chỉ tự ký. Bạn phải tạo một chứng chỉ từ một CA. Hãy xem bài viết Định cấu hình apigee-sso để truy cập HTTPS để biết thêm thông tin.

Cài đặt và định cấu hình Edge SSO cho quyền truy cập HTTP

Để cài đặt mô-đun SSO của Edge, apigee-sso, bạn phải sử dụng cùng một quy trình mà bạn đã dùng để cài đặt Edge. Vì apigee-sso được biểu thị bằng tệp RPM, nên người dùng thực hiện cài đặt phải là người dùng gốc hoặc là người dùng có toàn quyền truy cập sudo. Xem Tổng quan về việc cài đặt Edge để biết thêm thông tin.

Chuyển tệp cấu hình đến trình cài đặt. Tệp cấu hình có dạng như sau:

IP1=hostname_or_ip_of_management_server
IP2=hostname_or_ip_of_UI_and_apigge_sso

## Management Server configuration.
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. 
PG_HOST=$IP1
PG_PORT=5432
# Postgres username and password as set when you installed Edge.
PG_USER=apigee
PG_PWD=postgres

# apigee-sso configuration.
SSO_PROFILE="saml"
# Externally accessible IP or DNS name of apigee-sso.
SSO_PUBLIC_URL_HOSTNAME=$IP2
# 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_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

# 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

# Specifies to skip TLS validation for the URL specified
# by SSO_SAML_IDP_METADATA_URL. Necessary if URL uses a self-signed cert. 
# 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

# Must configure an SMTP server so Edge SSO 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
SMTPMAILFROM="My Company <myco@company.com>"

Cách cài đặt mô-đun SSO của Edge:

  1. Đăng nhập vào nút Máy chủ quản lý. Nút đó phải được cài đặt apigee-service như mô tả tại phần Cài đặt tiện ích apigee-setup của Edge.
    Xin lưu ý rằng bạn có thể cài đặt Edge SSO trên một nút khác. Tuy nhiên, nút đó phải có thể truy cập vào Máy chủ quản lý qua cổng 8080.
  2. Cài đặt và định cấu hình apigee-sso:
    > /opt/apigee/apigee-setup/bin/setup.sh -p sso -f configFile

    trong đó configFile là tệp cấu hình hiển thị ở trên.
  3. Cài đặt tiện ích apigee-ssoadminapi.sh dùng để quản lý người dùng quản trị và người dùng máy cho mô-đun apigee-sso:
    /opt/apigee/apigee-service/bin/apigee-service apigee-ssoadminapi install
  4. Đăng xuất khỏi shell, sau đó đăng nhập lại để thêm tiện ích apigee-ssoadminapi.sh vào đường dẫn của bạn.

Chỉ định tệp siêu dữ liệu thay vì URL

Nếu IDP của bạn không hỗ trợ URL siêu dữ liệu HTTP/HTTPS, bạn có thể sử dụng tệp XML siêu dữ liệu để định cấu hình SSO Edge:

  1. Sao chép nội dung của XML siêu dữ liệu từ IDP của bạn vào một tệp trên nút SSO của Edge. Ví dụ: sao chép XML vào:
    /opt/apigee/customer/application/apigee-sso/saml/metadata.xml
  2. Thay đổi quyền sở hữu tệp thành apigee:apigee:
    > chown apigee:apigee /opt/apigee/customer/application/apigee-sso/saml/metadata.xml
  3. Đặt giá trị của SSO_SAML_IDP_METADATA_URL thành đường dẫn tệp tuyệt đối:
    SSO_SAML_IDP_METADATA_URL=file:///opt/apigee/customer/application/apigee-sso/saml/metadata.xml

    Bạn phải thêm tiền tố "file://" vào đường dẫn tệp, theo sau là đường dẫn tuyệt đối từ thư mục gốc (/).