Skip to main content

Gitlab authentication provider for Sentry

Project description

PyPI version

Disclaimer 1

That's a second level for of this library. This fork was made in order to prepare PyPi package and make installation process easier via supported plugins install flow. Original fork disclaimer is below.

Disclaimer 2

I am NOT a python developer. I just changed what was necessary to make it work. This repository can be used directly or be an inspiration to others to enable Gitlab SSO with Sentry 10. These files can be installed from local folder only as no updated package is available in pip repository.

Compatibility

The following table shows which version of this plugin is compatible with which version of Sentry:

Plugin version Sentry version
0.4.5 versions prior to 25.6
0.5.0 (the latest) 25.6 and above

How to install

Install via pip

Use enhance-image.sh script to build new image with this plugin. Create a new file sentry/enhance-image.sh if it is missing.

cp sentry/enhance-image.example.sh sentry/enhance-image.sh

Add the following line to sentry/enhance-image.sh file:

pip install sentry-auth-gitlab-v2

Then run ./install.sh script to build new image with this plugin.

Install from sources

Create plugins folder in sentry and clone this repo:

mkdir sentry/plugins
cd sentry/plugins
git clone https://github.com/zekker6/sentry-auth-gitlab.git

Use enhance-image.sh script to build new image with this plugin. Create a new file sentry/enhance-image.sh if it is missing.

cp sentry/enhance-image.example.sh sentry/enhance-image.sh

Add the following line to sentry/enhance-image.sh file:

pip install /usr/src/sentry/plugins/sentry-auth-gitlab

Gitlab configuration

Tested with an official sentry/self-hosted installation:

  • Sentry 25.3.0
  • Gitlab 17.1

Create a new application under your GitLab. Enter the Callback URL as the prefix to your Sentry installation:

http(s?)://sentry.example.com/auth/sso/

Once done, grab your API keys and drop them in your sentry.conf.py:

GITLAB_APP_ID = "APP-ID"
GITLAB_APP_SECRET = "APP-SECRET"
GITLAB_BASE_DOMAIN = "git.example.com"

Optionally you may also specify the api version, scheme, and scope:

GITLAB_API_VERSION = 4
GITLAB_HTTP_SCHEME = "https"
GITLAB_AUTH_SCOPE = "api"
GITLAB_AUTH_GROUPS = ["my-group", "another-group"]  # restrict login to members of these groups

Notice

If your gitlab is deployed in a private network (probably). You need to alter sentry's default ip black list to make oauth flow work.

Put following config in your sentry.conf.py and delete conflict ones

SENTRY_DISALLOWED_IPS = (
    '0.0.0.0/8',
    '10.0.0.0/8',
    '100.64.0.0/10',
    '127.0.0.0/8',
    '169.254.0.0/16',
    '172.16.0.0/12',
    '192.0.0.0/29',
    '192.0.2.0/24',
    '192.88.99.0/24',
    '192.168.0.0/16',
    '198.18.0.0/15',
    '198.51.100.0/24',
    '224.0.0.0/4',
    '240.0.0.0/4',
    '255.255.255.255/32'
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sentry_auth_gitlab_v2-0.6.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sentry_auth_gitlab_v2-0.6.1-py2.py3-none-any.whl (10.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sentry_auth_gitlab_v2-0.6.1.tar.gz.

File metadata

  • Download URL: sentry_auth_gitlab_v2-0.6.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sentry_auth_gitlab_v2-0.6.1.tar.gz
Algorithm Hash digest
SHA256 e2d6be680a47d0c2b3093efc16604525f1ef38b0d52bcadfbe23dcea91713d80
MD5 b97639a95b48da4ed1fda5fc93604ae6
BLAKE2b-256 839e81938aeddbe07ce200defb9332b24b415d57040168453e0e312c53608d18

See more details on using hashes here.

Provenance

The following attestation bundles were made for sentry_auth_gitlab_v2-0.6.1.tar.gz:

Publisher: publish.yml on zekker6/sentry-auth-gitlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sentry_auth_gitlab_v2-0.6.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sentry_auth_gitlab_v2-0.6.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1a23c44c519b6f223db4e563af2bddc2b8f1dc35345158f80070f72f79881149
MD5 6b3287e214eed652bcb25ef5efa66ea5
BLAKE2b-256 05adccf16fb64225585beed2e114616c32023bbb62bba090a0b04eb5b51eb1c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for sentry_auth_gitlab_v2-0.6.1-py2.py3-none-any.whl:

Publisher: publish.yml on zekker6/sentry-auth-gitlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page