def init_ldap_properties_list_reqd()

in ambari-server/src/main/python/ambari_server/setupSecurity.py [0:0]


def init_ldap_properties_list_reqd(properties, options):
  ldap_properties = [
    LdapPropTemplate(
      properties,
      options.ldap_primary_host,
      "ambari.ldap.connectivity.server.host",
      "Primary LDAP Host{0}: ",
      REGEX_HOSTNAME,
      False,
      LdapDefaultMap(
        {LDAP_IPA: "ipa.ambari.apache.org", LDAP_GENERIC: "ldap.ambari.apache.org"}
      ),
    ),
    LdapPropTemplate(
      properties,
      options.ldap_primary_port,
      "ambari.ldap.connectivity.server.port",
      "Primary LDAP Port{0}: ",
      REGEX_PORT,
      False,
      LdapDefaultMap({LDAP_IPA: "636", LDAP_GENERIC: "389"}),
    ),
    LdapPropTemplate(
      properties,
      options.ldap_secondary_host,
      "ambari.ldap.connectivity.secondary.server.host",
      "Secondary LDAP Host <Optional>{0}: ",
      REGEX_HOSTNAME,
      True,
    ),
    LdapPropTemplate(
      properties,
      options.ldap_secondary_port,
      "ambari.ldap.connectivity.secondary.server.port",
      "Secondary LDAP Port <Optional>{0}: ",
      REGEX_PORT,
      True,
    ),
    LdapPropTemplate(
      properties,
      options.ldap_ssl,
      "ambari.ldap.connectivity.use_ssl",
      "Use SSL [true/false]{0}: ",
      REGEX_TRUE_FALSE,
      False,
      LdapDefaultMap({LDAP_AD: "false", LDAP_IPA: "true", LDAP_GENERIC: "false"}),
    ),
    LdapPropTemplate(
      properties,
      options.ldap_user_class,
      "ambari.ldap.attributes.user.object_class",
      "User object class{0}: ",
      REGEX_ANYTHING,
      False,
      LdapDefaultMap(
        {LDAP_AD: "user", LDAP_IPA: "posixAccount", LDAP_GENERIC: "posixUser"}
      ),
    ),
    LdapPropTemplate(
      properties,
      options.ldap_user_attr,
      "ambari.ldap.attributes.user.name_attr",
      "User ID attribute{0}: ",
      REGEX_ANYTHING,
      False,
      LdapDefaultMap({LDAP_AD: "sAMAccountName", LDAP_IPA: "uid", LDAP_GENERIC: "uid"}),
    ),
    LdapPropTemplate(
      properties,
      options.ldap_user_group_member_attr,
      "ambari.ldap.attributes.user.group_member_attr",
      "User group member attribute{0}: ",
      REGEX_ANYTHING,
      False,
      LdapDefaultMap(
        {LDAP_AD: "memberof", LDAP_IPA: "member", LDAP_GENERIC: "memberof"}
      ),
    ),
    LdapPropTemplate(
      properties,
      options.ldap_group_class,
      "ambari.ldap.attributes.group.object_class",
      "Group object class{0}: ",
      REGEX_ANYTHING,
      False,
      LdapDefaultMap(
        {LDAP_AD: "group", LDAP_IPA: "posixGroup", LDAP_GENERIC: "posixGroup"}
      ),
    ),
    LdapPropTemplate(
      properties,
      options.ldap_group_attr,
      "ambari.ldap.attributes.group.name_attr",
      "Group name attribute{0}: ",
      REGEX_ANYTHING,
      False,
      LdapDefault("cn"),
    ),
    LdapPropTemplate(
      properties,
      options.ldap_member_attr,
      "ambari.ldap.attributes.group.member_attr",
      "Group member attribute{0}: ",
      REGEX_ANYTHING,
      False,
      LdapDefaultMap(
        {LDAP_AD: "member", LDAP_IPA: "member", LDAP_GENERIC: "memberUid"}
      ),
    ),
    LdapPropTemplate(
      properties,
      options.ldap_dn,
      "ambari.ldap.attributes.dn_attr",
      "Distinguished name attribute{0}: ",
      REGEX_ANYTHING,
      False,
      LdapDefaultMap(
        {LDAP_AD: "distinguishedName", LDAP_IPA: "dn", LDAP_GENERIC: "dn"}
      ),
    ),
    LdapPropTemplate(
      properties,
      options.ldap_base_dn,
      "ambari.ldap.attributes.user.search_base",
      "Search Base{0}: ",
      REGEX_ANYTHING,
      False,
      LdapDefaultMap(
        {
          LDAP_AD: "dc=ambari,dc=apache,dc=org",
          LDAP_IPA: "cn=accounts,dc=ambari,dc=apache,dc=org",
          LDAP_GENERIC: "dc=ambari,dc=apache,dc=org",
        }
      ),
    ),
    LdapPropTemplate(
      properties,
      options.ldap_referral,
      "ambari.ldap.advanced.referrals",
      "Referral method [follow/ignore]{0}: ",
      REGEX_REFERRAL,
      True,
      LdapDefault("follow"),
    ),
    LdapPropTemplate(
      properties,
      options.ldap_bind_anonym,
      "ambari.ldap.connectivity.anonymous_bind",
      "Bind anonymously [true/false]{0}: ",
      REGEX_TRUE_FALSE,
      False,
      LdapDefault("false"),
    ),
    LdapPropTemplate(
      properties,
      options.ldap_sync_username_collisions_behavior,
      "ambari.ldap.advanced.collision_behavior",
      "Handling behavior for username collisions [convert/skip] for LDAP sync{0}: ",
      REGEX_SKIP_CONVERT,
      False,
      LdapDefault("skip"),
    ),
    LdapPropTemplate(
      properties,
      options.ldap_force_lowercase_usernames,
      "ambari.ldap.advanced.force_lowercase_usernames",
      "Force lower-case user names [true/false]{0}:",
      REGEX_TRUE_FALSE,
      True,
    ),
    LdapPropTemplate(
      properties,
      options.ldap_pagination_enabled,
      "ambari.ldap.advanced.pagination_enabled",
      "Results from LDAP are paginated when requested [true/false]{0}:",
      REGEX_TRUE_FALSE,
      True,
    ),
  ]
  return ldap_properties