realm.tf 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. resource "keycloak_realm" "realm" {
  2. # Docs: https://registry.terraform.io/providers/mrparkers/keycloak/latest/docs/resources/realm
  3. realm = "XDR"
  4. enabled = true
  5. display_name = "AFS eXtended Detection and Response"
  6. display_name_html = "<b>AFS XDR</b>"
  7. user_managed_access = false
  8. #login_theme = "base"
  9. # account_theme = ""
  10. # admin_theme = ""
  11. # email_theme = ""
  12. registration_allowed = false
  13. edit_username_allowed = true
  14. reset_password_allowed = false
  15. remember_me = false
  16. verify_email = true
  17. login_with_email_allowed = true
  18. duplicate_emails_allowed = false
  19. ssl_required = "all"
  20. # default_signature_algorithm = ""?
  21. # revoke_refresh_token = ""
  22. # refresh_token_max_reuse = ""
  23. # TODO: Wes, Brad, Asha or somebody better should review these:
  24. sso_session_idle_timeout = "1h" # (Optional) The amount of time a session can be idle before it expires.
  25. sso_session_max_lifespan = "8h" # (Optional) The maximum amount of time before a session expires regardless of activity.
  26. # offline_session_idle_timeout = "" # (Optional) The amount of time an offline session can be idle before it expires.
  27. # offline_session_max_lifespan = "" # (Optional) The maximum amount of time before an offline session expires regardless of activity.
  28. # offline_session_max_lifespan_enabled = "" # (Optional) Enable offline_session_max_lifespan.
  29. #access_token_lifespan = "1h" # (Optional) The amount of time an access token can be used before it expires.
  30. # access_token_lifespan_for_implicit_flow = "" # (Optional) The amount of time an access token issued with the OpenID Connect Implicit Flow can be used before it expires.
  31. # access_code_lifespan = "" # (Optional) The maximum amount of time a client has to finish the authorization code flow.
  32. # access_code_lifespan_login = "" # (Optional) The maximum amount of time a user is permitted to stay on the login page before the authentication process must be restarted.
  33. # access_code_lifespan_user_action = "" # (Optional) The maximum amount of time a user has to complete login related actions, such as updating a password.
  34. # action_token_generated_by_user_lifespan = "" # (Optional) The maximum time a user has to use a user-generated permit before it expires.
  35. # action_token_generated_by_admin_lifespan = "" # (Optional) The maximum time a user has to use an admin-generated permit before it expires.
  36. password_policy = "upperCase(1) and length(12) and forceExpiredPasswordChange(90) and notUsername"
  37. smtp_server {
  38. host = "mailrelay.${ var.dns_info["private"]["zone"] }"
  39. from = "keycloak@${ var.dns_info["public"]["zone"] }"
  40. from_display_name = "AFS XDR KeyCloak"
  41. reply_to = "xdr.eng@accenturefederal.com"
  42. reply_to_display_name = "XDR Engineering"
  43. }
  44. #attributes = {
  45. # mycustomAttribute = "myCustomValue"
  46. #}
  47. internationalization {
  48. supported_locales = [
  49. "en",
  50. "de",
  51. "es"
  52. ]
  53. default_locale = "en"
  54. }
  55. security_defenses {
  56. headers {
  57. x_frame_options = "DENY"
  58. content_security_policy = "frame-src 'self'; frame-ancestors 'self'; object-src 'none';"
  59. content_security_policy_report_only = ""
  60. x_content_type_options = "nosniff"
  61. x_robots_tag = "none"
  62. x_xss_protection = "1; mode=block"
  63. strict_transport_security = "max-age=31536000; includeSubDomains"
  64. }
  65. brute_force_detection {
  66. permanent_lockout = false# (Optional) When true, this will lock the user permanently when the user exceeds the maximum login failures.
  67. max_login_failures = 3 # (Optional) How many failures before wait is triggered.
  68. wait_increment_seconds = 60 # (Optional) This represents the amount of time a user should be locked out when the login failure threshold has been met.
  69. quick_login_check_milli_seconds = 1000 # (Optional) Configures the amount of time, in milliseconds, for consecutive failures to lock a user out.
  70. minimum_quick_login_wait_seconds = 60 # (Optional) How long to wait after a quick login failure.
  71. max_failure_wait_seconds = 900 # (Optional) Max. time a user will be locked out.
  72. failure_reset_time_seconds = 43200 # (Optional) When will failure count be reset?
  73. }
  74. }
  75. #web_authn_policy {
  76. # relying_party_entity_name = "Example"
  77. # relying_party_id = "keycloak.example.com"
  78. # signature_algorithms = ["ES256", "RS256"]
  79. #}
  80. }