Graylog2 / Graylog2/graylog2-server
API method to validate correctness of write-only properties such as LDAP system password
- Dominant language
- Java
- Stars
- 8.1k
- Forks
- 1.1k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 217
Description
After #4526 was merged, the LDAP settings API no longer allows you to read the admin password back out, which is a win for security. However, it does make the use of certain configuration management tools awkward (see "Context" section for more details).
I'd like to be able to programmatically verify that the the currently stored password matches my expectations. Note, it's not necessary that the API expose the current password value, only that a method exists by which I, knowing what the password _should_ be, can validate that Graylog agrees with me.
## Expected Behavior
An API endpoint exists which allows me to verify that the current stored LDAP system password is what I believe it to be (without exposing the actual, stored password value to me if I'm incorrect).
## Current Behavior
No such API endpoint exists.
## Possible Solution
The simplest method to achieve what I'm after would be an API call in which the caller supplies what they believe the password should be, and Graylog responds with "yes" if that is in fact the stored password, and "no" if it is not. For example:
```
$ curl -u 'admin:password' -H 'Content-Type: application/json' -H 'Accept: appliction/json' -d '{"system_password":"APASSWORD"}' "https://localhost/api/system/ldap/validate"
{"status":"ok"}
$
```
## Context
I'm the maintainer of the [graylog_api Puppet module](https://github.com/magicmemories/puppet-graylog_api), which can (among other things) use Graylog's REST API to configure LDAP settings. However, Puppet's model in general relies on being able to tell whether a particular property needs to be changed or not; it does this to enforce "corrective changes", where if someone manually edits a property outside of Puppet, Puppet will change it back to the way it's "supposed" to be.
Currently, the only option is to assume that the stored LDAP system password is always incorrect and reset it every time Puppet runs. This works, but it's not ideal, particularly from a reporting standpoint: Puppet will always report that the stored password was wrong and needed to be reset.
The same concern would apply to any other write-only value, if any exist (or are added in the future); at this point in time the LDAP system password that's caused me problems.
## Your Environment
* Graylog Version: 3.0.1
* Elasticsearch Version: 6.5.2
* MongoDB Version: 3.0.15
* Operating System: CentOS 7
* Browser version: N/A
Contributor guide
Assessment
This issue has not been assessed yet.