Compare commits

...

2 commits

Author SHA1 Message Date
Benjamin Renard
c4e9a33d2d Add docker image 2022-06-08 14:24:35 +02:00
Benjamin Renard
23d185c171 LSexample: defaulty enable LSpeople API access 2022-06-08 14:21:51 +02:00
7 changed files with 75 additions and 1 deletions

36
docker/Dockerfile Normal file
View file

@ -0,0 +1,36 @@
FROM debian:11
# Update/upgrade
RUN apt-get update
RUN apt-get upgrade -y
# Install LdapSaisie APT repository
RUN apt-get install -y wget gnupg
RUN wget -O - http://ldapsaisie.org/debian/ldapsaisie.gpg.key | apt-key add -
COPY apt.list /etc/apt/sources.list.d/ldapsaisie.list
RUN apt-get update
# Install dependencies
RUN DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get install -y git slapd apache2 php-ldap libapache2-mod-php php-cli smarty3 php-net-ldap2 php-net-ftp php-mail php-mail-mime php-console-table ldapvi locales sed bash-completion liquidprompt vim curl jq
# Add fr_FR* locales
RUN sed -i 's/^# fr_FR/fr_FR/' /etc/locale.gen
RUN locale-gen
# Clone sources
RUN git clone https://gitlab.easter-eggs.com/ee/ldapsaisie.git /var/www/ldapsaisie
# Fix www-data permission on temporary directory
RUN chown www-data: -R /var/www/ldapsaisie/src/tmp/
# Configure slapd and load lsexample directory
RUN killall slapd || echo slapd is not running
RUN /var/www/ldapsaisie/lsexample/restore_lsexample -v
# Configure and enable ldapsaisie VirtualHost (as default)
RUN a2dissite 000-default
COPY apache2.conf /etc/apache2/sites-available/ldapsaisie.conf
RUN a2ensite ldapsaisie
RUN a2enmod rewrite
RUN service apache2 restart
# Install ldapsaisie binary (with its bash-completion config)
RUN ln -s /var/www/ldapsaisie/src/bin/ldapsaisie.php /usr/local/sbin/ldapsaisie
RUN ln -s /var/www/ldapsaisie/debian/ldapsaisie.bash-completion /usr/share/bash-completion/completions/ldapsaisie
# Install entrypoint
COPY bashrc /root/.bashrc
COPY entrypoint.sh /usr/local/sbin/entrypoint.sh
RUN echo "ldapsaisie-dev" > /etc/hostname
ENTRYPOINT /usr/local/sbin/entrypoint.sh
EXPOSE 80 389

14
docker/README.md Normal file
View file

@ -0,0 +1,14 @@
# LdapSaisie docker image
This docker image permit to test LdapSaisie using _LSexample_ test LDAP directory and configuration.
To use it, just run the following command :
```bash
docker run -it -p 8080:80 -h ldapsaisie.dev brenard/ldapsaisie:dev
```
You could access LdapSaisie using :
- your Web browser on http://127.0.0.1:8080 (credentials: `admin/admin`)
- the `ldapsaisie` CLI command (for instance: `ldapsaisie search LSpeople`, run `ldapsaisie --help` for details)
- the API on http://127.0.0.1/api (for instance: `curl -u admin:admin http://127.0.0.1/api/1.0/object/LSpeople|jq`, see [documentation](https://ldapsaisie.org/doc/all-in-one/LdapSaisie.html#api-methods) for details)

11
docker/apache2.conf Normal file
View file

@ -0,0 +1,11 @@
<VirtualHost *:80>
DocumentRoot /var/www/ldapsaisie/src/public_html
<Directory /var/www/ldapsaisie/src/public_html>
Options -Indexes +FollowSymLinks
AllowOverride FileInfo
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

1
docker/apt.list Normal file
View file

@ -0,0 +1 @@
deb http://ldapsaisie.org/debian bullseye main

7
docker/bashrc Normal file
View file

@ -0,0 +1,7 @@
HISTCONTROL=ignoreboth
HISTSIZE=1000
HISTFILESIZE=2000
source /etc/bash_completion
# Only load liquidprompt in interactive shells, not from a script or from scp
echo $- | grep -q i 2>/dev/null && . /usr/share/liquidprompt/liquidprompt

5
docker/entrypoint.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/bash -e
service slapd start
service apache2 start
bash -l

View file

@ -55,7 +55,7 @@ $GLOBALS['LSconfig'] = array(
'LSpeople' => array( 'LSpeople' => array(
'filter' => '(|(uid=%{user})(mail=%{user}))', 'filter' => '(|(uid=%{user})(mail=%{user}))',
'password_attribute' => 'userPassword', 'password_attribute' => 'userPassword',
'api_access' => false, 'api_access' => true,
), ),
'LSsysaccount' => array( 'LSsysaccount' => array(
'api_access' => true, 'api_access' => true,