详细的OTP配置教程

LDAP Policies/Actions

  1. Go to Security > AAA – Application Traffic > Polices > Authentication > Advanced Policies > Actions > LDAP.
  2. On the right, click Add.
    NetScaler Gateway配置OTP验证_netscaler

     

    1. Create a normal LDAP Server if you don’t have one already. This one has Authentication enabled. This LDAP Policy/Server will be used for single-factor authentication to the manageotp website, and for first factor of dual-factor authentication to NetScaler Gateway (second factor is OTP). There are no special instructions for this LDAP Server.
      NetScaler Gateway配置OTP验证_otp_02
  3. Create another LDAP Action.
    NetScaler Gateway配置OTP验证_otp_03

     

    1. This one is used by the manageotp site to set the OTP authenticator in Active Directory, so name it accordingly.
    2. On the right, uncheck the box next to Authentication. If you don’t uncheck it, you will see an error message after configuring the OTP Secret.
      NetScaler Gateway配置OTP验证_citrix_04
    3. Make sure the Administrator Bind DN has permissions to modify the OTP Secret Active Directory attribute for all users.
    4. If you cloned an existing LDAP Server, then make sure you re-enter the Administrator Password or the new one won’t work. Then click Test LDAP Reachability.
      NetScaler Gateway配置OTP验证_otp_05
    5. Configure the Server Logon Name Attribute to match the one you configured in the normal authentication LDAP Server.
      NetScaler Gateway配置OTP验证_Citrix adc_06
    6. In the Other Settings section, on the bottom right, find the OTP Secret field. Enter the name of the Active Directory attribute where NetScaler will store the user’s OTP secret. You can use the userParameters attribute if that attribute isn’t being used for anything else.
    7. Thomas Rolfs in the comments advises not to enable Nested Group Extraction in this LDAP Action.
    8. Click Create when done.
      NetScaler Gateway配置OTP验证_Citrix adc_07
  4. Create another LDAP Action.
    1. This one will verify the OTP code entered by the user, so name it accordingly. The only difference from the prior one is the addition of an LDAP Search Filter.
    2. On the right, uncheck the box next to Authentication. If you don’t uncheck it, you will see an error message after configuring the OTP Secret.
      NetScaler Gateway配置OTP验证_citrix_08
    3. Make sure the Administrator Bind DN has permissions to read the OTP Secret Active Directory attribute.
    4. If you cloned an existing LDAP Server, then make sure you re-enter the Administrator Password or the new one won’t work.
      NetScaler Gateway配置OTP验证_citrix_09
    5. In the Other Settings section, configure the Server Logon Name Attribute to match the one you configured in the normal authentication LDAP Server.
    6. In the Search Filter field, enter the text userParameters>=#@. This syntax ensures that only users with enrolled authenticators can login. See George Spiers NetScaler native OTP for more info.
      NetScaler Gateway配置OTP验证_citrix_10
    7. In the Other Settings section, on the bottom right, find the OTP Secret field. Enter the name of the Active Directory attribute containing the user’s OTP secret.
    8. Click Create when done.NetScaler Gateway配置OTP验证_otp_11
  5. Go to Security > AAA – Application Traffic > Policies > Authentication > Advanced Policies > Policy.
  6. On the right, click Add.
    NetScaler Gateway配置OTP验证_otp_12

     

    1. You probably don’t already have an Advanced Authentication Policy for your normal LDAP server.
    2. Change the Action Type to LDAP.
    3. Select your normal LDAP server, which is the one that has Authentication enabled.
    4. Enter true as the expression. This uses Default Syntax instead of Classic Syntax.
    5. Click Create.
      NetScaler Gateway配置OTP验证_otp_13
  7. Create another Authentication Policy.
    NetScaler Gateway配置OTP验证_Citrix adc_14

     

    1. This policy is for OTP management so name it accordingly.
    2. Change the Action Type to LDAP.
    3. Select the Set OTP LDAP Server that has Authentication disabled and OTP Secret configured. This LDAP Action should not have the Search Filter configured.
    4. Enter HTTP.REQ.COOKIE.VALUE(“NSC_TASS”).EQ(“manageotp”) in the Expression box, and click Create.
      NetScaler Gateway配置OTP验证_otp_15
  8. Create another Authentication Policy.
    NetScaler Gateway配置OTP验证_citrix_16

     

    1. This policy is for OTP verification so name it accordingly.
    2. Change the Action Type to LDAP.
    3. Select the OTP Verification LDAP Server that has Authentication disabled and OTP Secret configured. This LDAP Action should have the Search Filter configured to prevent unenrolled users from authenticating.
    4. Enter true in the Expression box, and click Create.
      NetScaler Gateway配置OTP验证_otp_17

Login Schemas

  1. Go to Security > AAA – Application Traffic > Login Schema.
  2. On the right, switch to the Profiles tab, and click Add.
    NetScaler Gateway配置OTP验证_Citrix adc_18

     

    1. This is the single factor Login Schema for manageotp so name the Schema accordingly.
    2. Click the Edit icon.
      NetScaler Gateway配置OTP验证_citrix_19
    3. On the left, click the LoginSchema folder to open it.
      NetScaler Gateway配置OTP验证_Citrix adc_20
    4. Scroll down, and click SingleAuthManageOTP.xml to highlight it.
      NetScaler Gateway配置OTP验证_citrix_21
    5. On the top right, click Select.
      NetScaler Gateway配置OTP验证_otp_22
    6. Click Create.
      NetScaler Gateway配置OTP验证_Citrix adc_23
  3. Add another Login Schema profile.
    NetScaler Gateway配置OTP验证_Citrix adc_24

     

    1. This Login Schema is for two-factor authentication to NetScaler Gateway so name it accordingly.
    2. Click the edit icon. Follow the same procedure as above, but this time select /LoginSchema/DualAuth.xml.
      NetScaler Gateway配置OTP验证_Citrix adc_25
    3. Click More to reveal more options.
      NetScaler Gateway配置OTP验证_Citrix adc_26
    4. Scroll down. In the Password Credential Index field, enter 1. This causes nFactor to save the user’s password into AAA Attribute #1, which we’ll use later in a Traffic Policy to Single Sign-on to StoreFront. If you don’t do this, then NetScaler Gateway will try to use the Passcode to authenticate to StoreFront, which obviously won’t work.
    5. Check the box next to Enable Single Sign On CredentialsMark in the comments indicates that this checkbox is needed to Single Sign On to RDP Hosts.
    6. Click Create.
      NetScaler Gateway配置OTP验证_otp_27
  4. On the right, switch to the Policies tab.
    NetScaler Gateway配置OTP验证_netscaler_28
  5. Click Add to add a Login Schema policy.
    1. In the Profile field, select the Single Factor Manage OTP Login Schema Profile.
    2. Name the Login Schema Policy for OTP management.
    3. In the Rule field, enter the following. This ensures that this single factor Login Schema is only used if the user enters /manageotp, and if the user is on the internal network. You don’t want manageotp to be accessible externally, because it’s only protected by single factor authentication, and it’s too easy to add multiple devices.
      http.req.cookie.value("NSC_TASS").eq("manageotp") && client.IP.SRC.IN_SUBNET(10.2.0.0/16)
    4. Click Create.
      NetScaler Gateway配置OTP验证_otp_29
  6. Create another Login Schema Policy.
    NetScaler Gateway配置OTP验证_netscaler_30

     

    1. In the Profile field, select the dual factor Login Schema.
    2. Name the Login Schema to indicate dual factor authentication.
    3. In the Rule box, enter true.
    4. Click Create.
      NetScaler Gateway配置OTP验证_netscaler_31

Authentication PolicyLabel

  1. Go to Security > AAA – Application Traffic > Policies > Authentication > Advanced Policies > PolicyLabel.
  2. On the right, click Add.
    NetScaler Gateway配置OTP验证_citrix_32
  3. This PolicyLabel is for OTP management, and OTP verification, so name it accordingly.
  4. In the Login Schema field, select LSCHEMA_INT, which means noschema.
  5. Click Continue.
    NetScaler Gateway配置OTP验证_citrix_33
  6. In the Policy Binding section, Click to select.
    NetScaler Gateway配置OTP验证_Citrix adc_34
  7. Click the radio button button next to the Manage OTP LDAP Policy that has authentication disabled, and OTP Secret configured. This one should have a policy expression that limits it to manageotp only. Click Select.
    NetScaler Gateway配置OTP验证_citrix_35
  8. Click Bind.
    NetScaler Gateway配置OTP验证_otp_36
  9. Click Add Binding to add another one.
    NetScaler Gateway配置OTP验证_Citrix adc_37
  10. Click to select.
    NetScaler Gateway配置OTP验证_Citrix adc_38
  11. Click the radio button next to the LDAP Policy that verifies OTP. Click Select.
    NetScaler Gateway配置OTP验证_Citrix adc_39
  12. Click Bind.
    NetScaler Gateway配置OTP验证_citrix_40
  13. Make sure the manageotp policy is higher in the list than the OTP Verification policy. To adjust priorities, right-click on the policies, and click Edit Binding. Click Done.
    NetScaler Gateway配置OTP验证_citrix_41

AAA vServer

  1. Go to Security > AAA – Application Traffic.
    1. If the AAA feature is not enabled, then right-click the AAA node, and click Enable Feature.
      NetScaler Gateway配置OTP验证_Citrix adc_42
  2. Go to Security > AAA – Application Traffic > Virtual Servers.
  3. On the right, click Add.
    NetScaler Gateway配置OTP验证_citrix_43
  4. This AAA vServer is for OTP so name it accordingly.
  5. Change the IP Address Type to Non Addressable.
  6. Click OK.
    NetScaler Gateway配置OTP验证_citrix_44
  7. Click where it says No Server Certificate.
    NetScaler Gateway配置OTP验证_otp_45

     

    1. In the Server Certificate Binding section, click Click to select.
      NetScaler Gateway配置OTP验证_netscaler_46
    2. Click the radio button next to a certificate, and click Select. You can use the same certificate as NetScaler Gateway.
      NetScaler Gateway配置OTP验证_netscaler_47
    3. Click Bind.
      NetScaler Gateway配置OTP验证_otp_48
  8. Click Continue to close the Certificate section.
    NetScaler Gateway配置OTP验证_Citrix adc_49
  9. In the Advanced Authentication Policies section, click where it says No Authentication Policy.
    NetScaler Gateway配置OTP验证_Citrix adc_50

     

    1. Click where it says Click to select.
      NetScaler Gateway配置OTP验证_netscaler_51
    2. Click the radio button next to the normal LDAP Policy that has authentication enabled. Then click the blue Select button.
      NetScaler Gateway配置OTP验证_Citrix adc_52
    3. In the Select Next Factor field, click where it says Click to select.
      NetScaler Gateway配置OTP验证_citrix_53
    4. Click the radio button next to the OTP PolicyLabel, and click Select.
      NetScaler Gateway配置OTP验证_Citrix adc_54
    5. Click Bind.
      NetScaler Gateway配置OTP验证_otp_55
  10. In the Advanced Authentication Policies section, click Continue.
    NetScaler Gateway配置OTP验证_citrix_56
  11. On the right, in the Advanced Settings column, click Login Schemas.
    NetScaler Gateway配置OTP验证_citrix_57
  12. On the left, scroll down, and click where it says No Login Schema.
    NetScaler Gateway配置OTP验证_netscaler_58

     

    1. Click where it says Click to select.
      NetScaler Gateway配置OTP验证_otp_59
    2. Click the radio button next to the Manage OTP Login Schema, and click Select.
      NetScaler Gateway配置OTP验证_Citrix adc_60
    3. Click Bind.
      NetScaler Gateway配置OTP验证_netscaler_61
  13. Click where it says 1 Login Schema.
    NetScaler Gateway配置OTP验证_otp_62

     

    1. Click Add Binding.
      NetScaler Gateway配置OTP验证_otp_63
    2. Click where it says Click to select.
      NetScaler Gateway配置OTP验证_netscaler_64
    3. Click the radio button next to the dual factor Login Schema, and click Select.
      NetScaler Gateway配置OTP验证_Citrix adc_65
    4. Click Bind.
      NetScaler Gateway配置OTP验证_netscaler_66
    5. Make sure the single factor Manage OTP Login Schema is higher in the list (lower priority number) than the dual factor Login Schema. Click Close.
      NetScaler Gateway配置OTP验证_netscaler_67
  14. On the right, in the Advanced Settings column, click Portal Themes.
    NetScaler Gateway配置OTP验证_Citrix adc_68
  15. On the left, scroll down, select RfWebUI as the Portal Theme, and click OK.
    NetScaler Gateway配置OTP验证_netscaler_69
  16. Click Done.
    NetScaler Gateway配置OTP验证_Citrix adc_70

Traffic Policy for Single Sign-on

  1. On the left, go to NetScaler Gateway > Policies > Traffic.
  2. On the right, switch to the Traffic Profiles tab, and click Add.
    NetScaler Gateway配置OTP验证_otp_71
  3. This Traffic Profile is for OTP and/or nFactor. Name it accordingly.
  4. Scroll down.
    NetScaler Gateway配置OTP验证_netscaler_72
  5. In the SSO Password Expression box, enter the following. This is where we use the Login Schema Password Attribute specified earlier.
    http.REQ.USER.ATTRIBUTE(1)
  6. Click Create.
    NetScaler Gateway配置OTP验证_otp_73
  7. On the right, switch to the Traffic Policies tab, and click Add.
    NetScaler Gateway配置OTP验证_netscaler_74
  8. In the Request Profile field, select the Traffic Profile you just created.
  9. Name the Traffic Policy.
  10. In the Expression box, enter true (Default Syntax).
    • If your NetScaler Gateway Virtual Server allows full VPN, change the expression to the following. Source = Julien Mooren at NetScaler – Native OTP is breaking SSL VPN.
      http.req.method.eq(post)||http.req.method.eq(get) && false
  11. Click Create.
    NetScaler Gateway配置OTP验证_citrix_75

NetScaler Gateway and Authentication Profile

  1. Go to NetScaler Gateway > Virtual Servers.
  2. Edit an existing Gateway vServer. If you don’t have one, see the other NetScaler Gateway topics on this site.
    NetScaler Gateway配置OTP验证_netscaler_76
  3. Scroll down to the Policies section, and click the plus icon.
    NetScaler Gateway配置OTP验证_Citrix adc_77
  4. Change the Choose Policy drop-down to Traffic, and click Continue.
    NetScaler Gateway配置OTP验证_netscaler_78
  5. Click to select.
    NetScaler Gateway配置OTP验证_citrix_79
  6. Click the radio button next to the Traffic Policy you created earlier, and click Select.
    NetScaler Gateway配置OTP验证_otp_80
  7. Click Bind.
    NetScaler Gateway配置OTP验证_otp_81
  8. On the right, in the Advanced Settings column, click Authentication Profile.
    NetScaler Gateway配置OTP验证_otp_82
  9. On the left, scroll down to the Authentication Profile section.
  10. Click Add to create one.
    NetScaler Gateway配置OTP验证_netscaler_83
  11. Authentication Profile links the NetScaler Gateway vServer with the OTP AAA vServer, so name it accordingly.
  12. In the Authentication Virtual Server section, Click to select.
    NetScaler Gateway配置OTP验证_Citrix adc_84
  13. Click the radio button next to the OTP AAA vServer, and click Select.
    NetScaler Gateway配置OTP验证_Citrix adc_85
  14. Click Create.
    NetScaler Gateway配置OTP验证_netscaler_86
  15. Scroll down again to the Authentication Profile section, and click OK.
    NetScaler Gateway配置OTP验证_citrix_87
  16. The Portal Theme bound to the Gateway vServer should be RfWebUI, or a derivative.
    NetScaler Gateway配置OTP验证_citrix_88
  17. Go to System > Profiles.
  18. On the right, switch to the SSL Profile tab.
  19. Edit the ns_default_ssl_profile_frontend profile.
    NetScaler Gateway配置OTP验证_netscaler_89
  20. Make sure HSTS is not enabled in the profile, or RfWebUI, and manageotp won’t work correctly. This is probably a bug. Note: the Rewrite method of enabling HSTS should work.
    NetScaler Gateway配置OTP验证_Citrix adc_90

Update Content Switching Expression for Unified Gateway

If your NetScaler Gateway Virtual Server is behind a Unified Gateway (Content Switching Virtual Server), then you must update the Content Switching Expression to include the manageotp paths.

  1. In the NetScaler GUI, navigate to ConfigurationTraffic Management > Content Switching > Policies.
  2. On the right, select the Unified Gateway Content Switching Policy, and then click Edit.
  3. Append the following expression under the Expression area, and then click OK.
    || HTTP.REQ.URL.CONTAINS("/manageotp")

Manageotp

  1. Point your browser to https://mygateway.corp.com/manageotp or similar. Simply add /manageotp to the end of your Gateway URL.
    NetScaler Gateway配置OTP验证_Citrix adc_91
  2. Notice it’s only single-factor authentication. Login using normal LDAP credentials.
    NetScaler Gateway配置OTP验证_Citrix adc_92
  3. Click Add Device.
    NetScaler Gateway配置OTP验证_citrix_93
  4. Enter a device name, and click Go.
    NetScaler Gateway配置OTP验证_netscaler_94
  5. Launch the Google Authenticator application on your phone. Click the plus icon in Google Authenticator, and scan the QRCode that is shown on the screen.
  6. Christian in the comments indicated that Microsoft Authenticator also works. Click on plus sign -> other (Google,…).
    NetScaler Gateway配置OTP验证_citrix_95
  7. Click Test.
    NetScaler Gateway配置OTP验证_otp_96
  8. Enter the passcode shown in your Authenticator, and click Go.
    NetScaler Gateway配置OTP验证_netscaler_97NetScaler Gateway配置OTP验证_netscaler_98
  9. If you logoff of manageotp, and access your Gateway URL normally, you’ll be prompted for two-factor authentication. Use the passcodes shown in your Google Authenticator application.
    NetScaler Gateway配置OTP验证_Citrix adc_99
  10. It should Single Sign-on into StoreFront.
    NetScaler Gateway配置OTP验证_citrix_100

官方链接:Native One Time Passwords (OTP) – NetScaler Gateway 12 / Citrix Gateway 12.1 – Carl Stalhood