Skip to content

Commit

Permalink
Merge dc44455 into 856157a
Browse files Browse the repository at this point in the history
  • Loading branch information
smacz42 committed Aug 19, 2019
2 parents 856157a + dc44455 commit e9ce0e2
Show file tree
Hide file tree
Showing 5 changed files with 691 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
@@ -0,0 +1,2 @@
tests/
run_test.sh
13 changes: 13 additions & 0 deletions Dockerfile
@@ -0,0 +1,13 @@
FROM debian:stretch

ADD . /opt/
WORKDIR "/opt"
RUN apt update && \
apt install -y python-dev python-pip libldap2-dev libsasl2-dev libssl-dev && \
pip install -e /opt/ -r /opt/requirements-stretch.txt pycodestyle passlib coveralls configparser in_place && \
/usr/bin/python2 /opt/setup.py install

VOLUME /etc/ldapcherry
EXPOSE 8080

CMD ["/usr/bin/python2", "/opt/init.py"]
102 changes: 98 additions & 4 deletions README.rst
@@ -1,5 +1,5 @@
**************
LdapCherry
LdapCherry
**************

.. image:: https://raw.githubusercontent.com/kakwa/ldapcherry/master/resources/static/img/apple-touch-icon-72-precomposed.png
Expand All @@ -8,10 +8,10 @@ Nice and simple application to manage users and groups in multiple directory ser

.. image:: https://travis-ci.org/kakwa/ldapcherry.svg?branch=master
:target: https://travis-ci.org/kakwa/ldapcherry

.. image:: https://coveralls.io/repos/kakwa/ldapcherry/badge.svg
:target: https://coveralls.io/r/kakwa/ldapcherry

.. image:: https://img.shields.io/pypi/v/ldapcherry.svg
:target: https://pypi.python.org/pypi/ldapcherry
:alt: PyPI version
Expand Down Expand Up @@ -88,7 +88,7 @@ The default backend plugins permit to manage Ldap and Active Directory.
$ export SYSCONFDIR=/etc
# change the directory where to put the resource (default: /usr/share)
$ export DATAROOTDIR=/usr/share/

# install ldapcherry
$ python setup.py install

Expand All @@ -100,6 +100,100 @@ The default backend plugins permit to manage Ldap and Active Directory.
# launch ldapcherry
$ ldapcherryd -c /etc/ldapcherry/ldapcherry.ini -D

**********
Docker
**********

Building and running
^^^^^^^^^^^^^^^^^^^^

.. sourcecode:: bash

# Build the docker container with the tag ldapcherry
$ docker build -t ldapcherry .

# Run the docker container tagged as ldapcherry with the demo backend
# and allow incoming requests on port 8080 on the localhost
$ docker run -p 8080:8080 ldapcherry

Default environment variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

+-----------------------------+-------------------------------------+-----------------------+-------------------------+
| Environment Variable Name | Description | Default | Values |
+=============================+=====================================+=======================+=========================+
| ``DEBUG`` | Run the container in debug mode | ``False`` | * ``True`` |
| | | | * ``False`` |
+-----------------------------+-------------------------------------+-----------------------+-------------------------+
| ``SUFFIX`` | Set the suffix for the domain | ``dc=example,dc=org`` | * ``example.org`` |
| | | | * ``dc=example,dc=org`` |
+-----------------------------+-------------------------------------+-----------------------+-------------------------+
| ``SERVER_SOCKET_HOST`` | IP address for the daemon to run on | ``0.0.0.0`` | IP Address |
+-----------------------------+-------------------------------------+-----------------------+-------------------------+
| ``SERVER_SOCKET_PORT`` | Port for the daemon to run on | ``8080`` | Unprivileged Port |
+-----------------------------+-------------------------------------+-----------------------+-------------------------+
| ``LOG_ACCESS_HANDLER`` | The target for the access logs | ``stdout`` | * ``stdout`` |
| | | | * ``file`` |
| | | | * ``syslog`` |
| | | | * ``none`` |
+-----------------------------+-------------------------------------+-----------------------+-------------------------+
| ``LOG_ERROR_HANDLER`` | The target for the error logs | ``stdout`` | * ``stdout`` |
| | | | * ``file`` |
| | | | * ``syslog`` |
| | | | * ``none`` |
+-----------------------------+-------------------------------------+-----------------------+-------------------------+

.. warning::

Setting either of the ``LOG_<TYPE>_HANDLER`` variables to ``file`` requires the appropriate ``LOG_<TYPE>_FILE`` to be set

Other environment variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^

All other confguration options are parsed programatically from environment variables that are formatted differently for the two file types -- one way for the ``ini`` file and another for the ``.yml`` file.

INI configuration file
^^^^^^^^^^^^^^^^^^^^^^

The environment variables that should be passed to the ``ldapcherry.ini`` configuration file are only to be made into upper-case underscore-separated versions of the options inside of each section of the ldapcherry.ini file. For instance:

::

server.socket_host -> SERVER_SOCKET_HOST
request.show_tracebacks -> REQUEST_SHOW_TRACEBACKS
tools.sessions.timeout -> TOOLS_SESSIONS_TIMEOUT
min_length -> MIN_LENGTH

They will be put into their respective sections in the ldapcherry.ini file.

YAML configuration files
^^^^^^^^^^^^^^^^^^^^^^^^

For the yaml configuration files (``attributes.yml`` and ``roles.yml``), the environment variable name is programatically parsed based on the following template:

::

<FILENAME (without the .yml extension)>__<ATTRIBUTE ID>__<PARAMETER>

The following example demonstrates how to customize the ``shell`` attribute ID in the ``attributes.yml`` file:

::

shell:
description: "Shell of the user"
display_name: "Shell"
weight: 80
values:
- /bin/bash
- /bin/zsh
- /bin/sh

::

ATTRIBUTES__SHELL__DESCRIPTION="Shell of the user"
ATTRIBUTES__SHELL__DISPLAY_NAME="Shell"
ATTRIBUTES__SHELL__WEIGHT="80"
ATTRIBUTES__SHELL__VALUES="['/bin/bash', '/bin/zsh', '/bin/sh']"

***********
License
Expand Down
2 changes: 1 addition & 1 deletion conf/ldapcherry.ini
Expand Up @@ -11,7 +11,7 @@ server.socket_port = 8080

# number of threads
server.thread_pool = 8
#don't show traceback on error
# don't show traceback on error
request.show_tracebacks = False

# log configuration
Expand Down

0 comments on commit e9ce0e2

Please sign in to comment.