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

Dbp 1037 setup privacyidea monitring #140

Open
wants to merge 39 commits into
base: master
Choose a base branch
from

Conversation

sahassou
Copy link
Contributor

Description

This PR focuses on creating a robust monitoring setup for PrivacyIDEA by developing a custom exporter that collects vital statistics from PrivacyIDEA's database and exposes them in a format that Prometheus can scrape.
Custom Exporter Configuration
The custom exporter will follow this chain of communication:

  1. Prometheus sends requests for metrics.
  2. Nginx forwards Prometheus requests to uWSGI using a socket.
  3. uWSGI routes these requests to a Flask application.
  4. Flask fetches the metrics from PrivacyIDEA’s database and sends the response back through the chain to Prometheus.

@sahassou sahassou self-assigned this Nov 22, 2024
@@ -63,3 +63,4 @@
path: "/tmp/certificate_sync_key_*"
state: absent
delegate_to: localhost
ignore_errors: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for ignoring errors here?

# args:
# executable: /bin/bash
# notify: restart uwsgi

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for commenting this out? There is a when condition in the main.yml so it would only be executed if privacyidea_execute_data_import is true.

- name: Install prometheus_client in PrivacyIDEA
ansible.builtin.command:
cmd: sudo -H /opt/privacyidea/virtualenv/bin/pip install prometheus_client
become: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be the ansible pip module could be more elegant here? I think it supports virtualenvs.


def check_auth(username, password):
"""Check if a username/password combination is valid."""
return username == EXPORTER_USERNAME and password == EXPORTER_PASSWORD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could potentially be vulnerable for timing attacks.
Maybe we could use a hash and standard method from bcrypt instead?

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

Successfully merging this pull request may close these issues.

3 participants