Code Monkey home page Code Monkey logo

graylog-groups's Introduction

graylog-groups

A program that controls Graylog roles and privileges over objects using LDAP groups.

Note My apologies, this is my first actual program in Go, so it must be a terrible example of worst practices. Sorry.

Why?

The community edition of Graylog had the ability to use LDAP group in order to control user access to the various objects (searches, streams and dashboards).

In a somewhat ethically questionable move this capability was removed in version 4.0 and replaced with an enterprise-only feature called teams.

This program is meant to emulate the pre-4.0 LDAP group functionality.

How?

This program is meant to be executed on a regular basis through e.g. cron. It will read its configuration file, and from there :

  • get the list of users on the Graylog side,
  • read the list of members for all LDAP groups that have a mapping defined in the configuration file,
  • compute the roles and object privileges to grant for each Graylog user,
  • optionally delete users that no longer have any privileges according to the mapping and LDAP group membership,
  • set the users' permissions on the various Graylog objects,
  • add or remove Graylog roles from user accounts.

It should be noted that permissions set by this tool to not appear anywhere on the Graylog 4 UI. They can be queried back using the API, using the /user/{login} endpoint.

Installing

  • Download and build the program :
git clone https://github.com/tseeker/graylog-groups
cd graylog-groups
go build
  • Copy the resulting binary to whatever box will run it.
  • Create a configuration file based in the example from graylog-groups.yml.example.
  • Set up a cron job or whatever it is you use to schedule tasks to run the synchronization binary on a regular basis.

Usage

The program accepts the following command line arguments :

  • -h / --help: displays usage information then exits.
  • -q / --quiet: quiet mode. This will disable logging to stderr.
  • -c <file> / --config <file>: specifies the configuration file. If this option is not present, the program will try to load a file named graylog-groups.yml from the current working directory.
  • -i <name> / --instance <name>: specifies an instance name that will be added to logs as a field named instance.
  • -L <level> / --level <level>: specifies the log level. It must be one of the following: trace, debug, info (the default), warn, error, fatal, panic.
  • -f <file> / --log-file <file>: appends logs to the specified file.
  • -g <host>:<port> / --log-graylog <host>:<port>: sends logs to the specified Graylog server using GELF over UDP.

To Do

  • Add TLS options (skip checks / specify CA) for the Graylog API.
  • Read object ownership using grn_permissions to preserve privileges on users' own objects
  • Support granting ownership on objects
  • Use goroutines ? Maybe.
  • Custom log file/terminal output

graylog-groups's People

Contributors

emmanuel-benoit avatar tseeker avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

graylog-groups's Issues

searches are not supported as valid items

Hello,

  • first thank you very much for this tool, it is extremely useful!

  • I would like to give access to custom searches, those are sharable, as streams & dashboards, and accessible at the following urls : gaylogserver/search/UUID

I tried to add them to the yml config but got this error :
level=fatal msg="Invalid Graylog item" application=graylog component=graylog-groups config=./graylog-groups.yml entry=1 group="cn=appteam,cn=groups,cn=accounts,dc=hostics,dc=fr" item=search

It would be great if you could add support for attributing rights on Searches too, as for Dashboards and Streams

Privilege on stream applied by tool but not showing in Graylog

Hello,

I configured a group with the privilege to a stream. :

  cn=appteam,cn=groups,cn=accounts,dc=hostics,dc=fr:
    roles:
      - Reader
      - Dashboard Creator

    privileges:

      - type: stream
        id: 608f98fa71724935b8e90ded
        level: read

A user from that group exists in Graylog and the tool reported having given access :

level=trace msg="Computed group membership" application=graylog component=graylog-groups groups="[cn=appteam,cn=groups,cn=accounts,dc=domain,dc=fr]" user=cdel
level=trace msg="Computed roles" application=graylog component=graylog-groups roles="[Dashboard Creator Reader]" user=cdel
level=trace msg="Computed privileges" application=graylog component=graylog-groups privileges="[streams:read:608f98fa71724935b8e90ded]" user=cdel
level=info msg="Setting permissions" application=graylog component=graylog-groups privileges="[streams:read:608f98fa71724935b8e90ded]" user=cdel
level=trace msg="Executing Graylog API call" application=graylog base="https://graylogserver/api" component=graylog-groups method=PUT path=users/cdel/permissions username=admin
level=trace msg="Executed Graylog API call" application=graylog base="https://graylogserver/api" component=graylog-groups method=PUT path=users/cdel/permissions status=204 username=admin

However in the UI the stream still shows no one with access

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.