重設 Edge 密碼

完成安裝後,您可以重設下列密碼:

以下章節將提供重設每個密碼的說明。

重設 OpenLDAP 密碼

重設 OpenLDAP 密碼的方式取決於您的設定。視您的邊緣設定而定,OpenLDAP 可安裝為:

  • 安裝在 Management Server 節點中的 OpenLDAP 單一執行個體。例如用於 2 個節點、5 個節點或 9 個節點邊緣設定。
  • 多個 OpenLDAP 執行個體安裝在 Management Server 節點中,且設定使用 OpenLDAP 複製功能。例如在 12 節點邊緣設定中。
  • 多個 OpenLDAP 執行個體安裝在各自的節點上,並使用 OpenLDAP 複製功能設定。例如在 13 個節點邊緣設定中。

針對管理伺服器中安裝的 OpenLDAP 單一執行個體,請執行下列步驟:

  1. 在 Management Server 節點中執行下列指令,建立新的 OpenLDAP 密碼:
    /opt/apigee/apigee‑service/bin/apigee‑service apigee‑openldap \ 
      change‑ldap‑password ‑o OLD_PASSWORD ‑n NEW_PASSWORD
  2. 執行下列指令,儲存新密碼供 Management Server 存取:
    /opt/apigee/apigee‑service/bin/apigee‑service edge‑management‑server \ 
      store_ldap_credentials ‑p NEW_PASSWORD

    這個指令會重新啟動管理伺服器。

在 Management Server 節點中安裝 OpenLDAP 的 OpenLDAP 複製設定中,在管理伺服器節點中按照上述步驟更新密碼。

OpenLDAP 複製設定 (OpenLDAP 設定位於 Management Server 以外的節點) 中,請務必先變更兩個 OpenLDAP 節點的密碼,再變更這兩個 Management Server 節點的密碼。

重設系統管理員密碼

重設系統管理員密碼後,您必須在兩個地方重設密碼:

  • 管理伺服器
  • UI

如何重設系統管理員密碼:

  1. 編輯您用於安裝 Edge UI 的無訊息設定檔,以設定下列屬性:
    APIGEE_ADMINPW=NEW_PASSWORD
    SMTPHOST=smtp.gmail.com
    SMTPPORT=465
    SMTPUSER=foo@gmail.com
    SMTPPASSWORD=bar
    SMTPSSL=y
    SMTPMAILFROM="My Company <myco@company.com>"

    請注意,傳送新密碼時,您必須加入 SMTP 屬性,因為使用者介面上的所有屬性都會重設。

  2. 在 UI 節點上,停止 Edge UI:
    /opt/apigee/apigee-service/bin/apigee-service edge-ui stop
  3. 使用 apigee-setup 公用程式,透過設定檔重設 Edge UI 的密碼:
    /opt/apigee/apigee-setup/bin/setup.sh -p ui -f configFile
  4. (僅在 UI 已啟用 TLS 的情況下) 按照「為管理 UI 設定 TLS」所述,在 Edge UI 上重新啟用 TLS。
  5. 在管理伺服器上,建立新的 XML 檔案。在這個檔案中,將使用者 ID 設為「admin」,並使用以下格式定義密碼、名字、姓氏和電子郵件地址:
    <User id="admin">
      <Password><![CDATA[password]]></Password>
      <FirstName>first_name</FirstName>
      <LastName>last_name</LastName>
      <EmailId>email_address</EmailId>
    </User>
  6. 在 Management Server 中執行下列指令:
    curl -u "admin_email_address:admin_password" -H \
    "Content-Type: application/xml" -H "Accept: application/json" -X POST \
    "http://localhost:8080/v1/users/admin_email_address" -d @your_data_file
    

    其中 your_data_file 是您在上一個步驟中建立的檔案。

    Edge 會更新管理伺服器中的管理員密碼。

  7. 刪除您建立的 XML 檔案。請勿使用明文永久儲存密碼。

在具有多個管理伺服器的 OpenLDAP 複製環境中,在一部管理伺服器中重設密碼,會自動更新其他管理伺服器。不過,您必須分別更新所有 Edge UI 節點。

重設機構使用者密碼

如要重設機構使用者的密碼,請使用 apigee-servce 公用程式叫用 apigee-setup,如以下範例所示:

/opt/apigee/apigee-service/bin/apigee-service apigee-setup reset_user_password
  [-h]
  [-u USER_EMAIL]
  [-p USER_PWD]
  [-a ADMIN_EMAIL]
  [-P APIGEE_ADMINPW]
  [-f configFile]

例如:

/opt/apigee/apigee‑service/bin/apigee‑service apigee‑setup reset_user_password 
  ‑u user@myCo.com ‑p Foo12345 ‑a admin@myCo.com ‑P adminPword
cp ~/Documents/tmp/hybrid_root/apigeectl_beta2_a00ae58_linux_64/README.md 
  ~/Documents/utilities/README.md

以下是可與「-f」選項搭配使用的範例設定檔:

USER_NAME=user@myCo.com
USER_PWD="Foo12345"
APIGEE_ADMINPW=ADMIN_PASSWORD

您也可以使用 Update user API 變更使用者密碼。

SysAdmin 和機構使用者密碼規則

請使用本節,為 API 管理使用者強制要求的密碼長度和強度。設定會使用一系列預先設定 (且具有唯一編號的) 規則運算式來檢查密碼內容 (例如大寫、小寫、數字和特殊字元)。將這些設定寫入 /opt/apigee/customer/application/management-server.properties 檔案。如果該檔案不存在,請建立該檔案。

編輯 management-server.properties 後,重新啟動管理伺服器:

/opt/apigee/apigee-service/bin/apigee-service edge-management-server restart

接下來,您可以將不同的規則運算式組合分組,藉此設定密碼強度評分。舉例來說,您可以判斷一個具有至少一個大寫和一個小寫字母的密碼,強度等級為「3」,但具有至少一個小寫字母和一個數字的密碼,其強度評分為「4」。

屬性 說明
conf_security_password.validation.minimum.password.length=8
conf_security_password.validation.default.rating=2
conf_security_password.validation.minimum.rating.required=3

這些項目可用於判斷有效密碼的整體特性。密碼強度的預設最低評分為 3 (請參閱下表)。

請注意,password.validation.default.rating=2 低於規定的最低分級,也就是說,如果輸入的密碼不符合您設定的規則,系統就會將其評定為 2,因此無效 (低於最低評分 3)。

以下為可識別密碼特性的規則運算式。請注意,每個 ID 都會加上編號。例如,password.validation.regex.5=... 是運算式編號 5。在檔案的後續部分中,您將使用這些數字設定不同的組合,以決定整體密碼強度。

conf_security_password.validation.regex.1=^(.)\\1+$

1:所有字元都重複

conf_security_password.validation.regex.2=^.*[a-z]+.*$

2:至少一個小寫字母

conf_security_password.validation.regex.3=^.*[A-Z]+.*$

3:至少 1 個大寫字母

conf_security_password.validation.regex.4=^.*[0-9]+.*$

4:至少 1 個數字

conf_security_password.validation.regex.5=^.*[^a-zA-z0-9]+.*$

5:至少包含一個特殊字元 (不含底線 _)

conf_security_password.validation.regex.6=^.*[_]+.*$

6:至少一個底線

conf_security_password.validation.regex.7=^.*[a-z]{2,}.*$

7:多個小寫字母

conf_security_password.validation.regex.8=^.*[A-Z]{2,}.*$

8:多個大寫字母

conf_security_password.validation.regex.9=^.*[0-9]{2,}.*$

9:多個數字

conf_security_password.validation.regex.10=^.*[^a-zA-z0-9]{2,}.*$

10:多個特殊字元 (不含底線)

conf_security_password.validation.regex.11=^.*[_]{2,}.*$

11:多個底線

下列規則會根據密碼內容決定密碼強度。 每項規則都會包含前一節的一或多個規則運算式,並指派數字強度。系統會將密碼的數值強度與這個檔案頂端的 conf_security_password.validation.minimum.rating.required 數字進行比對,判斷密碼是否有效。

conf_security_password.validation.rule.1=1,AND,0
conf_security_password.validation.rule.2=2,3,4,AND,4
conf_security_password.validation.rule.3=2,9,AND,4
conf_security_password.validation.rule.4=3,9,AND,4
conf_security_password.validation.rule.5=5,6,OR,4
conf_security_password.validation.rule.6=3,2,AND,3
conf_security_password.validation.rule.7=2,9,AND,3
conf_security_password.validation.rule.8=3,9,AND,3

每項規則都會加上編號。例如,password.validation.rule.3=... 是規則編號 3。

每項規則都會使用下列格式 (等號右側):

regex-index-list,[AND|OR],rating

regex-index-list 是規則運算式清單 (依前一節的數字),並搭配 AND|OR 運算子 (也就是將所有或列出的任何運算式列入考量)。

rating 是每項規則給予的強度等級數值。

舉例來說,規則 5 表示任何密碼都至少有一個特殊字元「或」一個底線,則代表強度等級為 4。檔案頂端標有 password.validation.minimum.rating.required=3 表示有效的密碼為 4 分。

conf_security_rbac.password.validation.enabled=true

在啟用單一登入 (SSO) 時,將角色型存取權控管密碼驗證設為 false。預設值為 true。

重設 Cassandra 密碼

根據預設,Cassandra 隨附的驗證已停用。如果您啟用驗證功能,系統就會使用名為 cassandra 的預先定義使用者,並提供密碼 cassandra 密碼。您可以使用這個帳戶、為這個帳戶設定其他密碼,或建立新的 Cassandra 使用者。使用 Cassandra CREATE/ALTER/DROP USER 陳述式新增、移除及修改使用者。

如要瞭解如何啟用 Cassandra 驗證,請參閱啟用 Cassandra 驗證

如要重設 Cassandra 密碼,您必須:

  • 設定一個 Cassandra 節點的密碼,該密碼會廣播至環形中的所有 Cassandra 節點
  • 以新的密碼更新每個節點上的管理伺服器、訊息處理器、路由器、Qpid 伺服器和 Postgres 伺服器

詳情請參閱 CQL 指令

如何重設 Cassandra 密碼:

  1. 使用 cqlsh 工具和預設憑證登入任一 Cassandra 節點。您只需變更一個 Cassandra 節點上的密碼,這個 Cassandra 節點的密碼會播送至環形中的所有 Cassandra 節點:
    /opt/apigee/apigee-cassandra/bin/cqlsh cassIP 9042 -u cassandra -p 'cassandra'

    在此情況下:

    • cassIP 是 Cassandra 節點的 IP 位址。
    • 9042 是 Cassandra 通訊埠。
    • 預設使用者為 cassandra
    • 預設密碼為「cassandra」。如果您先前曾變更過密碼,請使用目前的密碼。如果密碼包含任何特殊字元,您必須使用單引號括住。
  2. 執行 cqlsh> 提示來更新密碼,藉此執行下列指令:
    ALTER USER cassandra WITH PASSWORD 'NEW_PASSWORD';

    如果新密碼含有單一引號字元,請在密碼前面加上單引號字元,將密碼逸出。

  3. 退出 cqlsh 工具:
    exit
  4. 在 Management Server 節點中執行下列指令:
    /opt/apigee/apigee-service/bin/apigee-service edge-management-server store_cassandra_credentials -u CASS_USERNAME -p 'CASS_PASSWORD'

    您也可以選擇將檔案傳送至含有新使用者名稱和密碼的指令:

    apigee-service edge-management-server store_cassandra_credentials -f configFile

    其中 configFile 包含以下:

    CASS_USERNAME=CASS_USERNAME
    CASS_PASSWORD='CASS_PASSWROD'

    這個指令會自動重新啟動管理伺服器。

  5. 在以下裝置重複步驟 4:
    • 所有訊息處理器
    • 所有路由器
    • 所有 Qpid 伺服器 (edge-qpid-server)
    • Postgres 伺服器 (edge-postgres-server)

Cassandra 密碼現已變更。

重設 PostgreSQL 密碼

根據預設,PostgreSQL 資料庫定義了兩位使用者:postgresapigee。兩位使用者的預設密碼為 postgres。請按照下列步驟變更預設密碼。

變更所有 Postgres 主節點的密碼。如果您在主節點/待機模式下設定了兩個 Postgres 伺服器,您只需變更主要節點上的密碼。詳情請參閱「為 Postgres 設定主待命複製功能 」一文。

  1. 在主要 Postgres 節點上,將目錄變更為 /opt/apigee/apigee-postgresql/pgsql/bin
  2. 設定 PostgreSQL postgres 使用者密碼:
    1. 使用下列指令登入 PostgreSQL 資料庫:
      psql -h localhost -d apigee -U postgres
    2. 系統提示時,請輸入現有的 postgres 使用者密碼,格式為 postgres
    3. 在 PostgreSQL 指令提示中,輸入下列指令來變更預設密碼:
      ALTER USER postgres WITH PASSWORD 'new_password';

      成功時,PostgreSQL 會回應以下內容:

      ALTER ROLE
    4. 使用下列指令退出 PostgreSQL 資料庫:
      \q
  3. 設定 PostgreSQL apigee 使用者密碼:
    1. 使用下列指令登入 PostgreSQL 資料庫:
      psql -h localhost -d apigee -U apigee
    2. 系統提示時,請輸入 apigee 使用者密碼,格式為 postgres
    3. 在 PostgreSQL 指令提示中,輸入下列指令來變更預設密碼:
      ALTER USER apigee WITH PASSWORD 'new_password';
    4. 使用下列指令退出 PostgreSQL 資料庫:
      \q

    您可以將 postgresapigee 使用者的密碼設為相同值或不同的值。

  4. 設定 APIGEE_HOME
    export APIGEE_HOME=/opt/apigee/edge-postgres-server
  5. 加密新密碼:
    sh /opt/apigee/edge-analytics/utils/scripts/utilities/passwordgen.sh new_password

    這個指令會傳回加密的密碼。加密密碼的開頭為「:」字元,且不包含「:」。例如,「apigee1234」的加密密碼如下:

    Encrypted string:WheaR8U4OeMEM11erxA3Cw==
  6. 使用新的「已加密」密碼為 postgresapigee 使用者更新 Management Server 節點。
    1. 在管理伺服器上,將目錄變更為 /opt/apigee/customer/application
    2. 編輯 management-server.properties 檔案,設定下列屬性。 如果這個檔案不存在,請建立檔案。
    3. 確認檔案為 apigee 使用者所有:
      chown apigee:apigee management-server.properties
  7. 使用新的加密密碼更新所有 Postgres 伺服器和 Qpid Server 節點。
    1. 在 Postgres 伺服器或 Qpid Server 節點上,變更為以下目錄:
      /opt/apigee/customer/application
    2. 開啟下列檔案進行編輯:
      • postgres-server.properties
      • qpid-server.properties

      如果這些檔案不存在,請建立這些檔案。

    3. 在檔案中加入下列屬性:
      • conf_pg-agent_password=newEncryptedPasswordForPostgresUser
      • conf_pg-ingest_password=newEncryptedPasswordForPostgresUser
      • conf_query-service_pgDefaultPwd=newEncryptedPasswordForPostgresUser
      • conf_query-service_dwDefaultPwd=newEncryptedPasswordForPostgresUser
      • conf_analytics_aries.pg.password=newEncryptedPasswordForPostgresUser
    4. 確認檔案為 apigee 使用者所有:
      chown apigee:apigee postgres-server.properties
      chown apigee:apigee qpid-server.properties
  8. 更新單一登入 (SSO) 元件 (如果已啟用單一登入):
    1. 連線至或登入執行 apigee-sso 元件的節點。也稱為「SSO 伺服器」

      在 AIO 或 3 節點安裝作業中,這個節點與管理伺服器相同。

      如果您有多個節點執行 apigee-sso 元件,則必須為每個節點執行這些步驟。

    2. 開啟下列檔案進行編輯:
      /opt/apigee/customer/application/sso.properties 

      如果檔案不存在,請建立檔案。

    3. 在檔案中新增下列指令行:
      conf_uaa_database_password=new_password_in_plain_text

      例如:

      conf_uaa_database_password=apigee1234
    4. 執行下列指令,將設定變更套用至 apigee-sso 元件:
      /opt/apigee/apigee-service/bin/apigee-service apigee-sso configure
    5. 針對各個單一登入 (SSO) 伺服器重複執行上述步驟。
  9. 按照下列順序重新啟動下列元件:
    1. PostgreSQL 資料庫:
      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql restart
    2. Qpid 伺服器:
      /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server restart
    3. Postgres 伺服器:
      /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server restart
    4. 管理伺服器:
      /opt/apigee/apigee-service/bin/apigee-service edge-management-server restart
    5. 單一登入 (SSO) 伺服器:
      /opt/apigee/apigee-service/bin/apigee-service apigee-sso restart