This creates a new telemetry usage collector, which can be extended for
other purposes, that adds `static_telemetry` usage by pulling directory from
`${KIBANA_CONFIG}/telemetry.yml` anything specified
under the `xpack.telemetry.usage` object.
For example, if the kibana.yml set:
```yaml
xpack.telemetry.usage:
object1:
active: true
field1: "value1"
object2:
field2: 123
```
then this would result in the usage object:
```json
{
"static_telemetry": {
"object1": {
"active": true,
"field1": "value1"
},
"object2": {
"field2": 123
}
}
}
```
* enable security plugin in basic
enable security on file dataviz and import (ML plugin)
update unit tests
add api test coverage for security in basic
move audit logging to standard+ license level
* removing test that wasn't added until 7.X (feature controls)
* Check security privileges before allowing reindexing
* Add global readyForUpgrade flag for Cloud
* Add ml_settings to cluster_settings
* Generalize locking mechanism for stop/starting watcher
* Display ML/Watcher stopping/resuming steps in UI
* Fix type issues
* Handle security being disabled for privilege check
* Use xpack_main.info + add types
* Fix x-pack builds
* Updates react to 16.6 (latest)
* Updated fragment-based snapshots for Kibana root unit tests
* Updated fragment-based snapshots for x-pack unit tests
* Removed xpack yarn.lock file bc it is no longer needed, it was reintroduced by accident during a rebase in this branch
* React 16.6 snapshot updates, round 2 (mostly Fragment snapshot diffs)
* Updated last round of React 16.6 snapshots
* Fixes query bar issue with 16.4 gDSFP lifecycle
* Updated yarn lock (arraybuffer.slice updated)
* Updates snapshots where executeQueryOptions prop appears
This adds logic so that the code will wait until any previous
attempt to send telemetry causes follow-up attempts to wait until
it has completed sending (in the unlikely event that it takes
longer than a minute, we don't want to waste time / resources).
* add kibana stats
* fix tests
* format the stats for telemetry
* fix the os/platform stats
* add version to locally-source kibana telemetry stats
* use callWithInternalUser
* better get_kibana module unit test verification
* separate handleKibanaStats
* variable rename
* fix comment
* fix functional test
* keep the return object literal from handleLocalStats
* validate the payload fields
* add warning log if no kibana stats returned
* Adding very basic place for the logged out page
* Redirecting to logged_out when we aren't using SLO
* Basing styles on the login styles
* Fixing linting errors
* Responding to PR feedback
* Fixing issue with the basepath and the login link
* Adding proper i18n prefix
* Updating unit tests
* If the settings collector returns nothing, ensure the settings api still returns a null value for default_admin_email
* Update test
* Feedback from PR
* Convert xpack license check to use banners service.
* Remove notifier directive method.
* Remove notifier banner directive.
* Simplify pullMessageFromUrl and move it into its own appRedirect module.
Previously if Elasticsearch was unavailable in the Kibana default distribution,
you would be prompted with a disabled login screen stating "Login is currently
disabled. Administrators should consult the Kibana logs for more details". This
was rather confusing for users who have a Basic license.
This now provides the user with a screen providing only the required
messaging.
Additionally, if you were using Kibana with a Basic license with an OSS
distribution of Elasticsearch, you would see the same disabled login
screen as mentioned previously.
This also separates the messaging there to provide clear details for the
user to resolve the issue.
* partial implementation for OLS Phase 1
* Allow Saved Objects Client to be wrapped
* Add placeholder "kibana.namespace" configuration property
* revert changes to saved objects client
* Remove circular dependency
* Removing namespace setting, we're using xpack.security.rbac.application
* Adding config.getDefault
* Expose SavedObjectsClientProvider on the server for easy plugin consumption
* migrate x-pack changes into kibana
* Beginning to use the ES APIs to insert/check privileges (#18645)
* Beginning to use the ES APIs to insert/check privileges
* Removing todo comment, I think we're good with the current check
* Adding ability to edit kibana application privileges
* Introducing DEFAULT_RESOURCE constant
* Removing unused arguments when performing saved objects auth check
* Performing bulkCreate auth more efficiently
* Throwing error in SavedObjectClient.find if type isn't provided
* Fixing Reporting and removing errant console.log
* Introducing a separate hasPrivileges "service"
* Adding tests and fleshing out the has privileges "service"
* Fixing error message
* You can now edit whatever roles you want
* We're gonna throw the find error in another PR
* Changing conflicting version detection to work when user has no
application privileges
* Throwing correct error when user is forbidden
* Removing unused interceptor
* Adding warning if they're editing a role with application privileges we
can't edit
* Fixing filter...
* Beginning to only update privileges when they need to be
* More tests
* One more test...
* Restricting the rbac application name that can be chosen
* Removing DEFAULT_RESOURCE check
* Supporting 1024 characters for the role name
* Renaming some variables, fixing issue with role w/ no kibana privileges
* Throwing decorated general error when appropriate
* Fixing test description
* Dedent does nothing...
* Renaming some functions
* Adding built-in types and alphabetizing (#19306)
* Filtering out non-default resource Kibana privileges (#19321)
* Removing unused file
* Adding kibana_rbac_dashboard_only_user to dashboard only mode roles (#19511)
* Adding create default roles test (#19505)
* RBAC - SecurityAuditLogger (#19571)
* Manually porting over the AuditLogger for use within the security audit
logger
* HasPrivileges now returns the user from the request
* Has privileges returns username from privilegeCheck
* Adding first eventType to the security audit logger
* Adding authorization success message
* Logging arguments when authorization success
* Fixing test description
* Logging args during audit failures
* RBAC Integration Tests (#19647)
* Porting over the saved objects tests, a bunch are failing, I believe
because security is preventing the requests
* Running saved objects tests with rbac and xsrf disabled
* Adding users
* BulkGet now tests under 3 users
* Adding create tests
* Adding delete tests
* Adding find tests
* Adding get tests
* Adding bulkGet forbidden tests
* Adding not a kibana user tests
* Update tests
* Renaming the actions/privileges to be closer to the functions on the
saved object client itself
* Cleaning up tests and removing without index tests
I'm considering the without index tests to be out of scope for the RBAC
API testing, and we already have unit coverage for these and integration
coverage via the OSS Saved Objects API tests.
* Fixing misspelling
* Fixing "conflicts" after merging master
* Removing some white-space differences
* Deleting files that got left behind in a merge
* Adding the RBAC API Integration Tests
* SavedObjectClient.find filtering (#19708)
* Adding ability to specify filters when calling the repository
* Implementing find filtering
* Revert "Adding ability to specify filters when calling the repository"
This reverts commit 9da30a15db.
* Adding integration tests for find filtering
* Adding forbidden auth logging
* Adding asserts to make sure some audit log isn't used
* Adding more audit log specific tests
* Necessarly is not a work, unfortunately
* Fixing test
* More descriptive name than "result"
* Better unauthorized find message?
* Adding getTypes tests
* Trying to isolate cause of rbac test failures
* Adding .toLowerCase() to work around capitalization issue
* No longer exposing the auditLogger, we don't need it like that right now
* Removing some unused code
* Removing defaultSettings from test that doesn't utilize them
* Fixing misspelling
* Don't need an explicit login privilege when we have them all
* Removing unused code, fixing misspelling, adding comment
* Putting a file back
* No longer creating the roles on start-up (#19799)
* Removing kibana_rbac_dashboard_only_user from dashboard only role
defaults
* Fixing small issue with editing Kibana privileges
* [RBAC Phase 1] - Update application privileges when XPack license changes (#19839)
* Adding start to supporting basic license and switching to plat/gold
* Initialize application privilages on XPack license change
* restore mirror_status_and_initialize
* additional tests and peer review updates
* Introducing watchStatusAndLicenseToInitialize
* Adding some tests
* One more test
* Even better tests
* Removing unused mirrorStatusAndInitialize
* Throwing an error if the wrong status function is called
* RBAC Legacy Fallback (#19818)
* Basic implementation, rather sloppy
* Cleaning stuff up a bit
* Beginning to write tests, going to refactor how we build the privileges
* Making the buildPrivilegesMap no longer return application name as the
main key
* Using real privileges since we need to use them for the legacy fallback
* Adding more tests
* Fixing spelling
* Fixing test description
* Fixing comment description
* Adding similar line breaks in the has privilege calls
* No more settings
* No more rbac enabled setting, we just do RBAC
* Using describe to cleanup the test cases
* Logging deprecations when using the legacy fallback
* Cleaning up a bit...
* Using the privilegeMap for the legacy fallback tests
* Now with even less duplication
* Removing stray `rbacEnabled` from angularjs
* Fixing checkLicenses tests since we added RBAC
* [Flaky Test] - wait for page load to complete (#19895)
@kobelb this seems unrelated to our RBAC Phase 1 work, but I was able to consistently reproduce this on my machine.
* [Flaky Test] Fixes flaky role test (#19899)
Here's a fix for the latest flaky test @kobelb
* Now with even easier repository access
* Sample was including login/version privileges, which was occasionally (#19915)
causing issues that were really hard to replicate
* Dynamic types (#19925)
No more hard-coded types! This will make it so that plugins that register their own mappings just transparently work.
* start to address feedback
* Fix RBAC Phase 1 merge from master (#20226)
This updates RBAC Phase 1 to work against the latest master. Specifically:
1. Removes `xpack_main`'s `registerLicenseChangeCallback`, which we introduced in `security-app-privs`, in favor of `onLicenseInfoChange`, which was recently added to master
2. Updated `x-pack/plugins/security/server/lib/watch_status_and_license_to_initialize.js` to be compliant with rxjs v6
* Retrying initialize 20 times with a scaling backoff (#20297)
* Retrying initialize 20 times with a scaling backoff
* Logging error when we are registering the privileges
* Alternate legacy fallback (#20322)
* Beginning to use alternate callWithRequest fallback
* Only use legacy fallback when user has "some" privileges on index
* Logging useLegacyFallback when there's an authorization failure
* Adding tests, logging failure during find no types fallback
* Switching to using an enum instead of success/useLegacyFallback
* Using _execute to share some of the structure
* Moving comment to where it belongs
* No longer audit logging when we use the legacy fallback
* Setting the status to red on the first error then continually (#20343)
initializing
* Renaming get*Privilege to get*Action
* Adding "instance" to alert about other application privileges
* Revising some of the naming for the edit roles screen
* One more edit role variable renamed
* hasPrivileges is now checkPrivileges
* Revising check_license tests
* Adding 2 more privileges tests
* Moving the other _find method to be near his friend
* Spelling "returning" correctly, whoops
* Adding Privileges tests
* tests for Elasticsearch's privileges APIs
* Switching the hard-coded resource from 'default' to *
* Throw error before we execute a POST privilege call that won't work
* Resolving issue when initially registering privileges
* Logging legacy fallback deprecation warning on login (#20493)
* Logging legacy fallback deprecation on login
* Consolidation the privileges/authorization folder
* Exposing rudimentary authorization service and fixing authenticate tests
* Moving authorization services configuration to initAuthorization
* Adding "actions" service exposed by the authorization
* Fixing misspelling
* Removing invalid and unused exports
* Adding note about only adding privileges
* Calling it initAuthorizationService
* Throwing explicit validation error in actions.getSavedObjectAction
* Deep freezing authorization service
* Adding deepFreeze tests
* Checking privileges in one call and cleaning up tests
* Deriving application from Kibana index (#20614)
* Specifying the application on the "authorization service"
* Moving watchStatusAndLicenseToInitialize to be below initAuthorizationService
* Using short-hand propery assignment
* Validate ES has_privileges response before trusting it (#20682)
* validate elasticsearch has_privileges response before trusting it
* address feedback
* Removing unused setting
* Public Role APIs (#20732)
* Beginning to work on external role management APIs
* Refactoring GET tests and adding more permutations
* Adding test for excluding other resources
* Adding get role tests
* Splitting out the endpoints, or else it's gonna get overwhelming
* Splitting out the post and delete actions
* Beginning to work on POST and the tests
* Posting the updated role
* Adding update tests
* Modifying the UI to use the new public APIs
* Removing internal roles API
* Moving the rbac api integration setup tests to use the public role apis
* Testing field_security and query
* Adding create role tests
* We can't update the transient_metadata...
* Removing debugger
* Update and delete tests
* Returning a 204 when POSTing a Role.
* Switching POST to PUT and roles to role
* We don't need the rbacApplication client-side anymore
* Adding delete route tests
* Using not found instead of not acceptable, as that's more likely
* Only allowing us to PUT known Kibana privileges
* Removing transient_metadata
* Removing one letter variable names
* Using PUT instead of POST when saving roles
* Fixing broken tests
* Adding setting to allow the user to turn off the legacy fallback (#20766)
* Pulling the version from the kibana server
* Deleting unused file
* Add API integration tests for roles with index and app privileges (#21033)
* Rbac phase1 functional UI tests (#20949)
* rbac functional tests
* changes to the test file
* RBAC_functional test
* incorporating review feedback
* slight modification to the addPriv() to cover all tests
* removed the @ in secure roles and perm file in the describe block and made it look more relevant
* Fixing role management API from users
* Set a timeout when we try/catch a find, so it doesn't pause a long time
* Changing the way we detect if a user is reserved for the ftr
* Skipping flaky test
/api/_xpack/usage was added as a target for 6.4.0 but it will not be
used. Instead, the /api/stats response will include usage info on
everything that gets registered with the usage service in
/src/server/usage
/api/_kibana/v1/stats is a GET API that was added in 6.2, during a point
where we thought providing usage stats through a public API would be OK
for capturing internally, with the benefit of having it be visible.
However, we've pivoted away from that idea because it doesn't line up
too well with the existing flow of data, where usage stats are combined
with the "Kibana stats" such as process uptime and number of requests.
We want to shift how we collect stats from Kibana, but it will be
gradual. It might be a while before we have an architecture that makes
sense for a standalone public API for the usage stats
This endpoint was never documented, and isn't used anywhere in the code.
It does incur a maintenance cost though.
Therefore, instead of waiting for a next major version to remove this
API, I'm removing it for 6.4. It will be marked in the release notes as
a breaking change. Since it was never documented, it should not provide
a problem.
* [Stats API] Set API field names per spec
* fix jest tests
* fix api integration test
* trash the original metrics collector
- constantly accumulating stats over time does not align with the existing behavior, which is to reset the stats to 0 whenever they are pulled
* move some logic out of the collector types combiner into inline
- change the signature of sourceKibana
* Make a new stats collector for the API
- to not clear the data when pulling via the api
- fetching is a read-only thing
* isolate data transforms for api data and upload data
* no static methods
* remove external in bytes
* remove the _stats prefix for kibana and reporting
* update jest test snapshot
* fix collector_types_combiner test
* fix usage api
* add test suite todo comment
* reduce some loc change
* roll back mysterious change
* reduce some more loc change
* comment correction
* reduce more loc change
* whitespace
* comment question
* fix cluster_uuid
* fix stats integration test
* fix bulk uploader test, combineTypes is no longer external
* very important comments about the current nature of stats represented and long-term goals
* add stats api tests with/without authentication
* fix more fields to match data model
* fix more tests
* fix jest test
* remove TODO
* remove sockets
* use snake_case for api field names
* restore accidental removal + copy/paste error
* sourceKibana -> getKibanaInfoForStats
* skip usage test on legacy endpoint
* fix api tests
* more comment
* stop putting a field in that used to be omitted
* fix the internal type to ID the usage data for bulk uploader
* correct the kibana usage type value, which is shown as-is in the API
* more fixes for the constants identifying collector types + test against duplicates
* add a comment on a hack, and a whitespace fix
* [Monitoring/Telemetry] Move Usage service from Monitoring to Kibana core
* fix tests
* fix reporting integration
* roll back more diffs
* roll logger into bulk uploader to remove file duplication
* fix xpack usage api
* subclass constructor is not needed
* collectorSet has factory methods for collector object creation
* fix reporting usage jest test
* fix metrics field name (stats)
* add state info
* add module name count
* use a set for the unique hosts instead of a map
* fix getting beats_state info
* fix unit test
* processBeatsStatsResults and processBeatsStateResults
* Separate bulk upload behavior from CollectorSet
- takes out a lot of behavior from CollectorSet and moves it to a class called BulkUploader
- simplifies kibana monitoring init by taking out the indirection that startCollectorSet / createCollectorSet had
- removes start() method from CollectorSet and calls the collector objects' init() functions from CollectorSet.register()
- removes cleanup method from collectorSet since that was doing work for bulk uploading
* remove cleanup and fetchAfterInit methods
* test for bulk_uploader class
* improve test for collector_set
* fix reporting
* expose collectorSet if there actually is a collectorSet
* comment for enclosed function
* make collectorSet creation/expose unconditional, bulkUploader more conditional
* fix collector_set tests
* lifecycle events
* stab at collectorSet error logging from the API call
* clean up comments
* clean up comments
* fix BulkUploader mocha test
* check kibanaCollectionEnabled config before registering bulk upload and the plugin status listeners
* no singleton timer object
* just log a warning if bulk uploader start called twice
* normal quotes
* check if bulk is enabled inside of the _fetchAndUpload method
* log for stopping bulk stats
* call bulkUploader.start with the collectorSet object
* call bulkUploader.start with the collectorSet object
* roll back change for module scoped variable
* oops I broke init
* init and logging: if / elseif / elseif
* remove unnecessary check/log
* help log
* remove redundant, use data.filter.map
* use xpackInfo.onLicenseInfoChange not xpackMainPlugin.status.on('green')
* help logging
* fix unit test
* remove handler that stops upload when connection is lost
* [X-Pack Usage API] use authentication from request headers
* add test for usage api no-auth
* whitespace / syntax nits
* reduce loc changed
* remove a weird looking comment
Basic licenses never expire, so they do not have an expiration date at
all according to the Elasticsearch API. When this happens, we should not
attempt to parse the date nor show the expiry date in the log.