การปิดใช้การตรวจสอบสิทธิ์พื้นฐานบน Edge

Edge for Private Cloud v4.19.01

หลังจากเปิดใช้ SAML ใน Edge แล้ว คุณจะปิดใช้การตรวจสอบสิทธิ์พื้นฐานได้ อย่างไรก็ตาม โปรดทำสิ่งต่อไปนี้ก่อนที่จะปิดใช้ Basic Auth

  • ตรวจสอบว่าคุณได้เพิ่มผู้ใช้ Edge ทั้งหมด รวมถึงผู้ดูแลระบบ ลงใน IDP ของ SAML แล้ว
  • ตรวจสอบว่าคุณได้ทดสอบการตรวจสอบสิทธิ์ SAML ใน Edge UI และ Edge Management API อย่างละเอียดแล้ว
  • หากคุณใช้พอร์ทัลบริการสำหรับนักพัฒนาแอป Apigee (หรือเรียกสั้นๆ ว่าพอร์ทัล) ให้กำหนดค่าและทดสอบ SAML ในพอร์ทัลเพื่อให้แน่ใจว่าพอร์ทัลจะเชื่อมต่อกับ Edge ได้ ดูหัวข้อการกำหนดค่าพอร์ทัลให้ใช้ SAML เพื่อสื่อสารกับ Edge

กำลังดูโปรไฟล์ความปลอดภัยปัจจุบัน

คุณสามารถดูโปรไฟล์ความปลอดภัยของ Edge เพื่อตรวจสอบการกำหนดค่าปัจจุบันเพื่อดูว่ามีการเปิดใช้การตรวจสอบสิทธิ์พื้นฐานและ SAML อยู่หรือไม่ ใช้การเรียก Edge Management API ต่อไปนี้ใน Edge Management Server เพื่อดูโปรไฟล์ความปลอดภัยปัจจุบันที่ Edge ใช้

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 ยังคงเปิดใช้อยู่

ปิดใช้การตรวจสอบสิทธิ์พื้นฐาน

ใช้การเรียก Edge Management API ต่อไปนี้บน Edge Management Server เพื่อปิดใช้การตรวจสอบสิทธิ์พื้นฐาน โปรดทราบว่าคุณส่งออบเจ็กต์ 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>'

หลังจากปิดใช้การตรวจสอบสิทธิ์พื้นฐานแล้ว การเรียก Edge Management API ที่ส่งข้อมูลเข้าสู่ระบบการตรวจสอบสิทธิ์พื้นฐานจะแสดงข้อผิดพลาดต่อไปนี้

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

เปิดใช้การตรวจสอบสิทธิ์พื้นฐานอีกครั้ง

หากต้องเปิดใช้ Basic Auth อีกครั้งไม่ว่าด้วยเหตุผลใดก็ตาม คุณต้องทำตามขั้นตอนต่อไปนี้

  1. เข้าสู่ระบบโหนด Edge ZooKeeper ใดก็ได้
  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>'

    ตอนนี้คุณจะใช้ Basic Auth ได้อีกครั้ง