Commit Graph

4916 Commits

Author SHA1 Message Date
Marcus Efraimsson
3de693af49
MySQL: Limit datasource error details returned from the backend (#19373)
Only return certain mysql errors from backend.
The following errors is returned as is from backend:
error code 1064 (parse error)
error code 1054 (bad column/field selected)
error code 1146 (table not exists)
Any other errors is logged and returned as a generic
error.
Restrict use of certain functions:
Do not allow usage of the following in query:
system_user()
session_user()
current_user() or current_user
user()
show grants

Fixes #19360
2019-09-24 20:50:49 +02:00
Erik Sundell
4dbedb8405 Azure Monitor: Revert support for cross resource queries (#19115)" (#19346)
This reverts commit 88051258e9.
2019-09-24 12:01:12 +02:00
Hugo Häggmark
75dcaecc99
Plugins: Skips existence of module.js for renderer plugins (#19318)
* Fix: Skips test for module.js for plugins of renderer type
Fixes #19130

* Refactor: Changes after PR comments

* Chore: Fixes go lint issue
2019-09-23 22:54:28 -07:00
gotjosh
279249ef56
Multi-LDAP: Do not fail-fast on invalid credentials (#19261)
* Multi-LDAP: Do not fail-fast on invalid credentials

When configuring LDAP authentication, it is very common to have multiple
servers configured. When using user bind (authenticating with LDAP using
the same credentials as the user authenticating to Grafana) we don't
expect all the users to be on all LDAP servers.

Because of this use-case, we should not fail-fast when authenticating on
multiple LDAP server configurations. Instead, we should continue to try
the credentials with the next LDAP server configured.

Fixes #19066
2019-09-23 13:34:05 +01:00
Marcus Efraimsson
19f3ec4891
MySQL, Postgres, MSSQL: Only debug log when in development (#19239)
Found some additional debug statements in relation to #19049 that 
can cause memory issues.

Ref #19049
2019-09-20 15:00:28 +02:00
Franco Papalardo
b8334c14f8 CloudWatch: ContainerInsights metrics support (#18971)
* CloudWatch ContainerInsights support
2019-09-20 12:05:58 +03:00
Andrew Rabert
8a991244d5 Alerting: Truncate PagerDuty summary when greater than 1024 characters (#18730)
Requests to PagerDuty fail with an HTTP 400 if the `summary` 
attribute contains more than 1024 characters, this fixes this.
API spec:
https://v2.developer.pagerduty.com/docs/send-an-event-events-api-v2

Fixes #18727
2019-09-20 10:39:27 +02:00
Brenda Harjala
c9e566b156 Docs: Minor edits to the README and several md files (#19238)
* Update README.md

Capitalized the G and S in "Getting Started," and moved "guide" to match the section title in the docs.

* Fixed sentence structure. Changed "download" to "grafana.com/get" and changed "get" to "download".

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

*  Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)
2019-09-20 00:04:56 +02:00
gotjosh
b20a258b72
LDAP: Show non-matched groups returned from LDAP (#19208)
* LDAP: Show all LDAP groups

* Use the returned LDAP groups as the reference when debugging LDAP

We need to use the LDAP groups returned as the main reference for
assuming what we were able to match and what wasn't. Before, we were
using the configured groups in LDAP TOML configuration file.

* s/User name/Username

* Add a title to for the LDAP mapping results

* LDAP: UI Updates to debug view

* LDAP: Make it explicit when we weren't able to match teams
2019-09-19 16:13:38 +01:00
Sofia Papagiannaki
56f5106717
SQL: Rewrite statistics query (#19178)
* Rewrite statistics query
2019-09-19 14:15:26 +03:00
Kevin Printz
79f8433675 Cloudwatch: Fix autocomplete for Gamelift dimensions (#19145) (#19146) 2019-09-19 08:27:15 +02:00
Masudur Rahman
a41a7ea656 Backend: Remove redundant condition of ROLE_VIEWER (#19211) 2019-09-19 08:19:11 +02:00
Marcus Efraimsson
0f524fc947
MSSQL: Revert usage of new connectionstring format (#19203)
This reverts commit 2514209 from #18384. Reason is that it doesn't 
work due to xorm 0.7.1 which doesn't support this new connectionstring 
format.

Fixes #19189
Ref #18384
Ref #17665
2019-09-18 19:30:35 +02:00
Leonard Gram
dd794625dd
API: adds redirect helper to simplify http redirects (#19180) 2019-09-17 19:28:35 +02:00
Erik Sundell
88051258e9
Azure Monitor: Add support for cross resource queries (#19115)
* Add new query mode picker with different states for each query. Also really simple migration script

* Populate cross resource dropdowns

* Cleanup. Handle change events

* Add multi select picker for subscriptions

* Fix markup issue

* Prepare for new query mode

* More cleanup

* Handle multiple queries both in ds and backend

* Refactoring

* Improve migration

* Add support for multiselect display name

* Use multiselect also for locations and resources

* Add more typings

* Fix migrations

* Custom multiselect built for array of options instead of variables

* Add url builder test

* fix datasource tests

* UI fixes

* Improve query editor init

* Fix brokens tests

* Cleanup

* Fix tslint issue

* Change query mode display name

* Make sure alerting works for single queries

* Friendly error for multi resources

* Add temporary typings
2019-09-17 11:35:40 +02:00
Sofia Papagiannaki
b5f0a5d5ca
Api: Readonly datasources should not be created via the API (#19006)
* Readonly datasources should not be created via the API

* Return correct `ReadOnly` value in GetDataSourceByName
2019-09-17 12:29:43 +03:00
Alexander Zobnin
494b4aaf88 LDAP: only show tab if LDAP is enabled (#19156)
* LDAP: add nav link only if ldap enabled

* LDAP: /admin/ldap required admin permissions
2019-09-17 10:27:55 +02:00
Marcus Efraimsson
80592e3361
Metrics: Adds setting for turning off total stats metrics (#19142)
Don't update total stats metrics if reporting is disabled.
New setting disable_total_stats for turning off update 
of total stats (stat_totals_*) metrics.

Ref #19137
2019-09-17 09:32:24 +02:00
Peter Holmberg
3c61b563c3 Ldap: Add LDAP debug page (#18759)
* Add items for navmodel and basic page

* add reducer and actions

* adding user mapping table component

* adding components for ldap tables

* add alert box on error

* close error alert box

* LDAP status page: connect APIs WIP

* LDAP debug: fetch connection status from API

* LDAP debug: fetch user info from API

* LDAP debug: improve connection error view

* LDAP debug: connection error tweaks

* LDAP debug: fix role mapping view

* LDAP debug: role mapping view tweaks

* LDAP debug: add bulk-sync button stub

* LDAP debug: minor refactor

* LDAP debug: show user teams

* LDAP debug: user info refactor

* LDAP debug: initial user page

* LDAP debug: minor refactor, remove unused angular wrapper

* LDAP debug: add sessions to user page

* LDAP debug: tweak user page

* LDAP debug: tweak view for disabled user

* LDAP debug: get sync info from API

* LDAP debug: user sync info

* LDAP debug: sync user button

* LDAP debug: clear error on page load

* LDAP debug: add user last sync info

* LDAP debug: actions refactor

* LDAP debug: roles and teams style tweaks

* Pass showAttributeMapping to LdapUserTeams

* LDAP debug: hide bulk sync button

* LDAP debug: refactor sessions component

* LDAP debug: fix loading user sessions

* LDAP debug: hide sync user button

* LDAP debug: fix fetching unavailable /ldap-sync-status endpoint

* LDAP debug: revert accidentally added fix

* LDAP debug: show error when LDAP is not enabled

* LDAP debug: refactor, move ldap components into ldap/ folder

* LDAP debug: styles refactoring

* LDAP debug: ldap reducer tests

* LDAP debug: ldap user reducer tests

* LDAP debug: fix connection error placement

* Text update

* LdapUser: Minor UI changes moving things around

* AlertBox: Removed icon-on-top as everywhere else it is centered, want to have it be consistent
2019-09-16 18:56:01 +03:00
gotjosh
99c799e9b7
Close the connection only if we establish it. (#18897) 2019-09-16 14:13:35 +01:00
Dominik Prokop
97ff75732d
Routing: Update routing to require sign in on every route (#19118)
* Update routing to require sign in on every route

* Review update
2019-09-16 14:06:50 +02:00
Dominik Prokop
44a2a648c6
Login: fix login page failing when navigating from reset password views (#19124) 2019-09-16 13:38:03 +02:00
Marcus Efraimsson
2acffbeb10
CLI: Fix installing plugins on windows (#19061)
Fixes #19022
2019-09-13 18:12:52 +02:00
gotjosh
7b7b95341e
LDAP: Allow an user to be synchronised against LDAP (#18976)
* LDAP: Allow an user to be synchronised against LDAP
This PR introduces the /ldap/sync/:id endpoint. It allows a user to be synchronized against LDAP on demand.

A few things to note are:

LDAP needs to be enabled for the sync to work
It only works against users that originally authenticated against LDAP
If the user is the Grafana admin and it needs to be disabled - it will not sync the information
Includes a tiny refactor that favours the JSONEq assertion helper instead of manually parsing JSON strings.
2019-09-13 16:26:25 +01:00
Erik Sundell
4c8f417f18 Stackdriver: Add extra alignment period options (#18909)
* Add more alignment period options

* Remove unnecessary alignment period limit
2019-09-13 10:45:59 +02:00
548017
09b434bdd0 Auth: Allow inviting existing users when login form is disabled (#19048)
Allow api to accept inviting existing users when login form is disabled.
UI shows invite button when login form is disabled.
2019-09-12 18:45:50 +02:00
Brian Gann
9eafc693b2
MSSQL: Fix memory leak when debug enabled (#19049)
* fix for #19049
2019-09-12 18:44:31 +02:00
gotjosh
fa007423e3
API: Add updatedAt to api/users/:id (#19004)
* API: Add `updatedAt` to api/users/:id

This adds the timestamp of when a particular user was last updated to
the `api/users/:id` endpoint.

This helps our administrators understand when was the user information last
updated. Particularly when it comes from external systems e.g. LDAP
2019-09-11 13:43:05 +01:00
Kyle Brandt
e5bf3027fc
Refactor: Move sql_engine to sub package of tsdb (#18991)
this way importing the tsdb package does not come with xorm dependencies
2019-09-10 15:50:04 -04:00
Sofia Papagiannaki
7f40dc5317
Image rendering: Add deprecation warning when PhantomJS is used for rendering images (#18933)
* Add deprecation warning

* Update pkg/services/rendering/rendering.go

Co-Authored-By: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2019-09-10 16:16:51 +03:00
lzd
c9c0dd1ea8 Alerting: fix response popover prompt when add notification channels (#18967) 2019-09-09 14:09:21 +02:00
Sofia Papagiannaki
de075e529d
Build: Fix potential case-insensitive import collision for github.com/Unknwon/com (#18915)
* update gopkg.in/macaron.v1

* update github.com/go-macaron/binding

* update github.com/go-macaron/session

* Substitute github.com/Unknwon/com with github.com/unknwon/com

* Clean up modules using `go mod tidy`

* Substitute github.com/Unknwon/bra with github.com/unknwon/bra
2019-09-09 14:22:06 +03:00
Ryan McKinley
7d32caeac2 Transformers: configure result transformations after query(alpha) (#18740) 2019-09-09 08:58:57 +02:00
gotjosh
10fe101add
LDAP: Fetch teams in debug view (#18951)
Adds the definition of `GetTeamsForLDAPGroupCommand` which handles the lookup of team information based on LDAP groupDNs.

This is an Enterprise only feature. To diferentiate,a response will contain the `team` key as `null` on OSS while on Enterprise the key will contain an empty array `[]` when no teams are found.
2019-09-08 11:48:47 +01:00
Sofia Papagiannaki
388d3d3714
Notification is sent when state changes from no_data to ok (#18920) 2019-09-05 18:54:27 +03:00
gotjosh
7c6dd1868b
LDAP: Add API endpoint to query the LDAP server(s) status (#18868)
* LDAP: Add API endpoint to query the LDAP server(s) status|

This endpoint returns the current status(es) of the configured LDAP server(s).

The status of each server is verified by dialling and if no error is returned we assume the server is operational.

This is the last piece I'll produce as an API before moving into #18759 and see the view come to life.
2019-09-04 15:29:14 +01:00
gotjosh
0cbbb43222
LDAP: Add API endpoint to debug user mapping from LDAP (#18833)
* Move the ReloadLDAPCfg function to the debug file

Appears to be a better suite place for this.

* LDAP: Return the server information when we find a specific user

We allow you to specify multiple LDAP servers as part of LDAP authentication integration. As part of searching for specific users, we need to understand from which server they come from. Returning the server configuration as part of the search will help us do two things:

- Understand in which server we found the user
- Have access the groups specified as part of the server configuration

* LDAP: Adds the /api/admin/ldap/:username endpoint

This endpoint returns a user found within the configured LDAP server(s). Moreso, it provides the mapping information for the user to help administrators understand how the users would be created within Grafana based on the current configuration.

No changes are executed or saved to the database, this is all an in-memory representation of how the final result would look like.
2019-09-03 18:34:44 +01:00
Kyle Brandt
364d2358d8
alerting: add lock on job to prevent a race condition (#18218)
without this lock there is a race condition between the scheduler and job processing.
2019-09-03 09:14:28 -04:00
Marcus Efraimsson
964c2e722f
Snapshot: Fix http api (#18830)
(cherry picked from commit be2e2330f5)
2019-09-02 15:15:46 +02:00
Oleg Gaidarenko
1a4be4af8c
Enterprise: add dependencies for upcoming features (#18793)
* Enterprise: add dependencies for upcoming features

See enterprise issues
2019-08-30 18:14:32 +02:00
Gali Alykoff
f942fecc52 Chore: Improve err message for notifications (#18757)
Improve message of notification json error
Fix test after change error message
2019-08-28 16:49:36 +02:00
Marcus Efraimsson
e83f55f394 Chore: Use ruleId instead of alertId as log keyword (#18738) 2019-08-27 08:40:03 +02:00
Bob Shannon
056dbc7012 OAuth: Support JMES path lookup when retrieving user email (#14683)
Add support for fetching e-mail with JMES path

Signed-off-by: Bob Shannon <bobs@dropbox.com>
2019-08-26 18:11:40 +02:00
Oleg Gaidarenko
35b74a99a8
Emails: resurrect template notification (#18686)
* Emails: resurrect template notification

* Phantomjs (oh yeah, there is another dev dep phantom :-) was failing for
  the generation of the html templates so I had to update the dependencies
  in order to fix it. While doing that I update the scripts field and docs
  for it as well. yarn.lock is included

* Move splitting of the emails to separate helper function, since more services
  coming up that would need to use this functionality

* Add support for enterprise specific email letters. Probably could
  be done in the better way, but it's not a priority right now
2019-08-26 17:19:03 +02:00
Oleg Gaidarenko
c5bca40566
Email: add reply-to and direct attachment (#18715)
* Add support for `Reply-To` header

* Allow direct attachment

Don't have tests yet, but they will follow
2019-08-26 16:44:18 +02:00
Ryan McKinley
f7c55d3968 Plugins: better warning when plugins fail to load (#18671)
* better pluin feedback

* add server side check for module.js
2019-08-22 07:04:02 +02:00
Ryan McKinley
e6fbf358c8
TestData: attach labels to series results (#18653) 2019-08-21 07:50:13 -07:00
Oleg Gaidarenko
6ca1a6c8da
Auth: change the error HTTP status codes (#18584)
* Auth: change the error HTTP status codes

* Use 407 HTTP status code for incorrect credentials error

* Improve proxy auth logs

* Remove no longer needed TODO comment

Fixes #18439
2019-08-20 20:13:27 +03:00
Oleg Gaidarenko
02af966964
LDAP: multildap + ldap integration (#18588)
It seems `ldap` module introduced new error type of which
multildap module didn't know about.

This broke the multildap login logic

Fixes #18491
Ref #18587
2019-08-19 00:52:32 +03:00
kay delaney
fb0cec5591
Backend: Adds support for HTTP/2 (#18358)
* Backend: Adds support for HTTP/2

* Adds mozilla recommended ciphers

* Updates sample.ini and config documentation
2019-08-16 16:06:54 +01:00