Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SCHEMA]: "elasticstack_auth_*" resources #3

Open
tsouza opened this issue Apr 26, 2021 · 0 comments
Open

[SCHEMA]: "elasticstack_auth_*" resources #3

tsouza opened this issue Apr 26, 2021 · 0 comments

Comments

@tsouza
Copy link
Collaborator

tsouza commented Apr 26, 2021

The elasticstack_auth_* defines the following:

User

https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html

resource 'elasticstack_auth_user' '<name>' {
	metadata {
		# variable key/value pair
	}
	email			string
	full_name 		string
	password 		string
	password_hash 	string
	roles 			[]string 
}

Rules

Role

https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html

resource 'elasticstack_auth_role' '<name>' {
	metadata {
		# variable key/pair
	}
	cluster_privileges	[]string
	run_as_privileges	[]string
	index_privileges 	[]{
		indices		[]string
		privileges  []string
		field_privileges {
			granted_fields	[]string
			denied_fields	[]string
		}
		granted_documents_query {
			# variable key/value pair
		}
	}
	kibana_privileges 	[]{
		grant_all	{
			spaces		[]string
		}	
		grant_read	{
			spaces		[]string
		}	
		grant_custom	{
			spaces		[]string
			custom_feature_privileges []{
				features []enum
				grant	   enum
				sub_feature_privileges {
					short_url			 boolean
					store_search_session boolean
				}
			}
		}	
	}
}

Rules

  • Under kibana_privileges, exactly one of the following must be defined: grant_all, grant_read, grant_custom
  • Field kibana_privileges.grant_custom.custom_feature_privileges.features value enum's list: discover, dashboard, canvas, maps, machine-learning, graph, visualize-library, logs, metrics, apm-and-users-experience, uptime, security, dev-tools, advanced-settings, index-pattern-managegement, saved-objects-management, fleet, actions-and-connectors, stack-alerts, stack-monitoring
  • Field kibana_privileges.grant_custom.custom_feature_privileges.grant value enum's list: all, read, none (discuss: should we explicitly add a none or the absence implies none?)
  • Field field kibana_privileges.grant_custom.custom_feature_privileges.short_url is only supported when the feature is one of: discover, dashboard, visualize-library
  • Field kibana_privileges.grant_custom.custom_feature_privileges.store_search_session is only supported when the feature is one of: discover, dashboard

Role Mapping

resource 'elasticstack_auth_role_mapping' '<name>' {
	roles 	[]string
	rules	[]string {
		user_field	enum
		type		enum
		text_value	  string
		number_value  number
		boolean_value boolean
	}
}

Rules:

  • Field rules.user_field value enum's list: username, dn, groups, realm.name
  • Field rules.type value enum's list: text, number, is-null, boolean
  • Under rules, at most one of: text_value, number_value or boolean_value depending if type is text, number or boolean. In case type is is-null then no *_value field can be defined

API Key

https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html

resource 'elasticstack_auth_apikey' '<name>' {
	expiration	string
	role_descriptors {
		# key/value pair "role_name" -> "role_def" see definition of `Role`
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant