השבתת אימות בסיסי ב-Edge

Edge for Private Cloud v4.18.05

אחרי שמפעילים את SAML ב-Edge, אפשר להשבית את Basic Auth. אבל לפני שמשביתים את האימות הבסיסי:

  • חשוב לוודא שהוספתם את כל משתמשי Edge, כולל מנהלי מערכת, ל-SAML IDP.
  • חשוב לוודא שבדקתם ביסודיות את אימות ה-SAML בממשק המשתמש של Edge וב-Edge Management API.
  • אם אתם משתמשים בפורטל Apigee Developer Services (או פשוט הפורטל), צריך להגדיר ולבדוק את SAML בפורטל כדי לוודא שהפורטל יכול להתחבר ל-Edge. איך מגדירים את הפורטל לשימוש ב-SAML כדי לתקשר עם Edge

צפייה בפרופיל האבטחה הנוכחי

כדי לבדוק אם Basic Auth ו-SAML מופעלים, אפשר להציג את פרופיל האבטחה של Edge ולבדוק את ההגדרות הנוכחיות. כדי לראות את פרופיל האבטחה הנוכחי שבו Edge משתמש, מפעילים את הקריאה הבאה ל-Edge Management API ב-Edge Management Server:

curl -H "accept:application/xml" http://localhost:8080/v1/securityprofile -u sysAdminEmail:pWord

אם עדיין לא הגדרתם את SAML, התגובה תיראה כמו בדוגמה הבאה, כלומר Basic Auth מופעל:

<SecurityProfile enabled="true" name="securityprofile">
    <UserAccessControl enabled="true">
    </UserAccessControl>
</SecurityProfile>

אם כבר הפעלתם את SAML, התג <ssoserver> יופיע בפלט:

<SecurityProfile enabled="true" name="securityprofile">
    <UserAccessControl enabled="true">
        <SSOServer>
            <BasicAuthEnabled>true</BasicAuthEnabled>
            <PublicKeyEndPoint>/token_key</PublicKeyEndPoint>
            <ServerUrl>http://35.197.37.220:9099</ServerUrl>
        </SSOServer>
    </UserAccessControl>
</SecurityProfile>

שימו לב שבגרסה שבה SAML מופעל, מוצג גם <BasicAuthEnabled>true</BasicAuthEnabled>, כלומר Basic Auth עדיין מופעל.

השבתת Basic Auth

כדי להשבית את האימות הבסיסי, משתמשים בקריאה הבאה ל-Edge Management API ב-Edge Management Server. שימו לב שאתם מעבירים כמטען הייעודי (payload) את אובייקט ה-XML שהוחזר בקטע הקודם. ההבדל היחיד הוא שצריך להגדיר <BasicAuthEnabled>false</BasicAuthEnabled>:

curl -H "Content-Type: application/xml"
http://localhost:8080/v1/securityprofile  -u sysAdminEmail:pWord -d
 '<SecurityProfile enabled="true" name="securityprofile">
  <UserAccessControl enabled="true">
    <SSOServer>
      <BasicAuthEnabled>false</BasicAuthEnabled>
      <PublicKeyEndPoint>/token_key</PublicKeyEndPoint>
      <ServerUrl>http://35.197.37.220:9099</ServerUrl>
  </SSOServer>
 </UserAccessControl>
</SecurityProfile>'

אחרי שמשביתים את Basic Auth, כל קריאה ל-Edge management API שמעבירה פרטי כניסה של Basic Auth מחזירה את השגיאה הבאה:

<Error>
    <Code>security.SecurityProfileBasicAuthDisabled</Code>
    <Message>Basic Authentication scheme not allowed</Message>
    <Contexts/>
</Error>

הפעלה מחדש של אימות בסיסי

אם מסיבה כלשהי אתם צריכים להפעיל מחדש את Basic Auth, אתם צריכים לבצע את השלבים הבאים:

  1. מתחברים לכל צומת ZooKeeper ב-Edge.
  2. מריצים את סקריפט ה-bash הבא כדי להשבית את כל האבטחה:
    #! /bin/bash
    /opt/apigee/apigee-zookeeper/bin/zkCli.sh -server localhost:2181 <<EOF
    set /system/securityprofile <SecurityProfile></SecurityProfile>
    quit
    EOF

    הפלט ייראה כך:

    Connecting to localhost:2181
    Welcome to ZooKeeper!
    JLine support is enabled
    WATCHER::
    WatchedEvent state:SyncConnected
    type:None path:null
    [zk: localhost:2181(CONNECTED) 0]
    set /system/securityprofile <SecurityProfile></SecurityProfile>
    cZxid = 0x89
    ...
    [zk: localhost:2181(CONNECTED) 1] quit
    Quitting...
  3. הפעלה מחדש של אימות בסיסי ואימות SAML:
    curl -H "Content-Type: application/xml" http://localhost:8080/v1/securityprofile
      -u sysAdminEmail:pWord -d '<SecurityProfile enabled="true" name="securityprofile">
      <UserAccessControl enabled="true">
      <SSOServer>
      <BasicAuthEnabled>true</BasicAuthEnabled>
      <PublicKeyEndPoint>/token_key</PublicKeyEndPoint>
      <ServerUrl>http://35.197.37.220:9099</ServerUrl>
      </SSOServer>
      </UserAccessControl>
      </SecurityProfile>'

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