• This repository has been archived on 24/Sep/2023
  • Stars
    star
    163
  • Rank 231,141 (Top 5 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Sentry extension to add an LDAP server as an authention source.

sentry-ldap-auth

A Django custom authentication backend for Sentry. This module extends the functionality of django-auth-ldap with Sentry specific features.

Features

  • Users created by this backend are managed users. Managed fields are not editable through the Sentry account page.
  • Users may be auto-added to an Organization upon creation.

Prerequisites

Versions 2.0 and newer require Sentry 8. For Sentry 7 support, use the 1.1 release

Installation

To install, simply add sentry-ldap-auth to your requirements.txt for your Sentry environment (or pip install sentry-ldap-auth).

Configuration

This module extends the django-auth-ldap and all the options it provides are supported (up to v1.2.x, at least).

To configure Sentry to use this module, add sentry_ldap_auth.backend.SentryLdapBackend to your AUTHENTICATION_BACKENDS in your sentry.conf.py, like this:

AUTHENTICATION_BACKENDS = AUTHENTICATION_BACKENDS + (
    'sentry_ldap_auth.backend.SentryLdapBackend',
)

Then, add any applicable configuration options. Depending on your environment, and especially if you are running Sentry in containers, you might consider using python-decouple so you can set these options via environment variables.

sentry-ldap-auth Specific Options

AUTH_LDAP_DEFAULT_SENTRY_ORGANIZATION = u'My Organization Name'

Auto adds created user to the specified organization (matched by name) if it exists.

AUTH_LDAP_SENTRY_ORGANIZATION_ROLE_TYPE = 'member'

Role type auto-added users are assigned. Valid values in a default installation of Sentry are 'member', 'admin', 'manager' & 'owner'. However, custom roles can also be added to Sentry, in which case these are also valid.

AUTH_LDAP_SENTRY_ORGANIZATION_GLOBAL_ACCESS = True

Whether auto-created users should be granted global access within the default organization.

AUTH_LDAP_SENTRY_SUBSCRIBE_BY_DEFAULT = False

Whether new users should be subscribed to any new projects by default. Disabling this is useful for large organizations where a subscription to each project might be spammy.

AUTH_LDAP_SENTRY_USERNAME_FIELD = 'uid'

Specify which attribute to use as the Sentry username, if different from what the user enters on the login page. You can use this to prevent multiple accounts from being created when your AUTH_LDAP_USER_SEARCH allows users to log in with different usernames (e.g. (|(uid=%(user))(mail=%(user)))). If multiple values exist for the attribute, the first value will be used.

AUTH_LDAP_DEFAULT_EMAIL_DOMAIN = 'example.com'

Default domain to append to username as the Sentry user's e-mail address when the LDAP user has no mail attribute.

Sentry Options

SENTRY_MANAGED_USER_FIELDS = ('email', 'first_name', 'last_name', 'password', )

Fields which managed users may not modify through the Sentry accounts view. Applies to all managed accounts.

Example Configuration

import ldap
from django_auth_ldap.config import LDAPSearch, GroupOfUniqueNamesType

AUTH_LDAP_SERVER_URI = 'ldap://my.ldapserver.com'
AUTH_LDAP_BIND_DN = ''
AUTH_LDAP_BIND_PASSWORD = ''

AUTH_LDAP_USER_SEARCH = LDAPSearch(
    'dc=domain,dc=com',
    ldap.SCOPE_SUBTREE,
    '(mail=%(user)s)',
)

AUTH_LDAP_GROUP_SEARCH = LDAPSearch(
    '',
    ldap.SCOPE_SUBTREE,
    '(objectClass=groupOfUniqueNames)'
)

AUTH_LDAP_GROUP_TYPE = GroupOfUniqueNamesType()
AUTH_LDAP_REQUIRE_GROUP = None
AUTH_LDAP_DENY_GROUP = None

AUTH_LDAP_USER_ATTR_MAP = {
    'name': 'cn',
    'email': 'mail'
}

AUTH_LDAP_FIND_GROUP_PERMS = False
AUTH_LDAP_CACHE_GROUPS = True
AUTH_LDAP_GROUP_CACHE_TIMEOUT = 3600

AUTH_LDAP_DEFAULT_SENTRY_ORGANIZATION = u'My Organization Name'
AUTH_LDAP_SENTRY_ORGANIZATION_ROLE_TYPE = 'member'
AUTH_LDAP_SENTRY_GROUP_ROLE_MAPPING = {
    'owner': ['sysadmins'],
    'admin': ['devleads'],
    'member': ['developers', 'seniordevelopers']
}
AUTH_LDAP_SENTRY_ORGANIZATION_GLOBAL_ACCESS = True
AUTH_LDAP_SENTRY_USERNAME_FIELD = 'uid'

AUTHENTICATION_BACKENDS = AUTHENTICATION_BACKENDS + (
    'sentry_ldap_auth.backend.SentryLdapBackend',
)

import logging
logger = logging.getLogger('django_auth_ldap')
logger.addHandler(logging.StreamHandler())
logger.setLevel('DEBUG')

More Repositories

1

polymer-webpack-loader

WebPack Loader for Polymer Web Components
JavaScript
192
star
2

Gordon

Android Test Runner
Kotlin
169
star
3

kafka4s

Functional programming with Kafka and Scala
Scala
92
star
4

polymer-2-starter-kit-webpack

Polymer 2 Starter Kit and Webpack
HTML
38
star
5

packer-post-processor-vsphere-ova

This post-processor will upload a VMDK and vmware template to a datastore on VSphere 5.5
Go
33
star
6

druid-docker

Docker containers for Druid nodes
Scala
28
star
7

knife-whisk

Knife plugin to generate knife server create commands
Ruby
26
star
8

salat-avro

Fast bi-directional Scala case class to Avro serialization
Scala
23
star
9

asdf-kustomize

asdf plugin for installing kustomize
Shell
22
star
10

vault4s

Vault Client Library For Scala
Scala
19
star
11

graphite-setup

Graphite in your docker.
Ruby
17
star
12

sbt-license-plugin

sbt plugin for adding/updating license headers in source files
Scala
16
star
13

simple-plugin-example

Companion example app to the Plugin Quickstart
EJS
16
star
14

banno-powerons

Banno PowerOn library
IDL
15
star
15

consumer-api-openid-connect-example

Example of how to connect to Banno services using OpenID Connect (an identity layer on top of OAuth 2.0)
JavaScript
14
star
16

vagrant-mesos

Local Mesos cluster in Vagrant
Shell
12
star
17

akka-event-handler-flume

flume sink for your akka event handler
Scala
11
star
18

grunt-coffeeify

JavaScript
11
star
19

web-component-router

Framework independent router for web-components based apps
JavaScript
10
star
20

docker-hbase-standalone

Repo for Docker Trusted build banno/docker-hbase-standalone
Shell
9
star
21

sbt-plantuml-plugin

An sbt plugin to generate sequence diagrams from text files.
Java
9
star
22

jsonz

Yet another Scala json parsing library blending together the better ideas
Scala
9
star
23

hadoop-nagios

Ruby
9
star
24

terraform-provider-vsphere

VMware VSphere provider for Terraform
Go
9
star
25

terraform-provider-mesoskafka

Terraform Provider for the Mesos Kafka Scheduler API
Go
8
star
26

kube-ingress-index

index page linking to Kubernetes Ingress objects
Go
8
star
27

heatblast

A Mesos framework for scheduling Samza jobs.
Scala
6
star
28

google-actions-demo

Use the Banno Consumer API to power Google Assistant actions
JavaScript
5
star
29

scala-webframework-faceoff

Scala
5
star
30

jha-design

Design specification for JHA web apps
HTML
5
star
31

bower-sinopia-resolver

Custom resolver for bower allowing sinopia to be used as a registry
JavaScript
5
star
32

getsentry-kafka

An Apache Kafka plugin for Sentry
Python
4
star
33

polymer-rename

Rename polymer template databinding expressions and event functions with closure-compiler
JavaScript
4
star
34

FDL

Digital UX Field Definition Language
JavaScript
3
star
35

node-mock-rest-middleware

Simple middleware for mocking REST services
JavaScript
3
star
36

ninja-binaries

Contains binaries of the Ninja build system
Shell
3
star
37

polymer-lint

Linter for polymer web components
JavaScript
3
star
38

banno-client-creds-helper

Helper utilities for common tasks with Banno's Platform API
JavaScript
3
star
39

docker-elasticsearch-mesos

Elasticsaerch running as a mesos framework, in a docker container to be ran by marathon.
Shell
2
star
40

twitter-streaming

My approach to computing the top 5 hashtags in Twitter's Streaming API
Scala
2
star
41

docker-rabbitmq

rabbitmq docker image
Shell
2
star
42

asdf-jsonnet

Shell
2
star
43

basic-plugin-example

JavaScript
2
star
44

cosmos4s

Cosmos Access Api
Scala
2
star
45

semgrep-scalafix

scalafix rules that mimic some semgrep ones
Scala
1
star
46

samza-mesos-docker

Base Docker image for Samza jobs on Mesos
1
star
47

simple-announcements-plugin

A sample plugin for use with tutorial
JavaScript
1
star
48

terraform-provider-null

Go
1
star
49

getsentry-javascript-lite

Python
1
star
50

whampire

Go
1
star
51

ux-license-report

Generates license reports of 3rd-party software dependencies
JavaScript
1
star
52

banno-plugin-framework-bridge

JavaScript message bridge for Banno Plugins
JavaScript
1
star