feat: Add LDAP/Active Directory integration with group-based access control

- Add PHP LDAP extension to Docker container
- Implement LdapSync class for authentication and user synchronization
- Add automatic user sync via cron (every 30 minutes)
- Create role-based access control system (admin, manager, viewer)
- Add LDAP configuration UI in settings
- Support for both Active Directory and OpenLDAP
- Group-to-role mapping with flexible configuration
- Add 50+ translations (EN + RU) for LDAP features
- Include comprehensive setup documentation
- Enhance Auth::login() with LDAP fallback
- Add LDAP settings page with connection testing
This commit is contained in:
infosave2007
2025-11-10 17:46:27 +03:00
parent 40abe38616
commit 3d9cc02963
13 changed files with 1141 additions and 3 deletions
+7 -3
View File
@@ -1,6 +1,6 @@
FROM php:8.2-apache
# Install dependencies
# Install dependencies including LDAP
RUN apt-get update && apt-get install -y \
git \
curl \
@@ -13,7 +13,9 @@ RUN apt-get update && apt-get install -y \
openssh-client \
qrencode \
cron \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd \
libldap2-dev \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd ldap \
&& a2enmod rewrite \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
@@ -39,12 +41,14 @@ RUN chown -R www-data:www-data /var/www/html \
# Setup cron jobs
RUN echo "0 * * * * www-data cd /var/www/html && /usr/local/bin/php bin/check_expired_clients.php >> /var/log/cron.log 2>&1" > /etc/cron.d/amnezia-cron \
&& echo "0 * * * * www-data cd /var/www/html && /usr/local/bin/php bin/check_traffic_limits.php >> /var/log/cron.log 2>&1" >> /etc/cron.d/amnezia-cron \
&& echo "*/30 * * * * www-data cd /var/www/html && /usr/local/bin/php bin/sync_ldap_users.php >> /var/log/ldap_sync.log 2>&1" >> /etc/cron.d/amnezia-cron \
&& echo "*/3 * * * * root /bin/bash /var/www/html/bin/monitor_metrics.sh >> /var/log/metrics_monitor.log 2>&1" >> /etc/cron.d/amnezia-cron \
&& chmod 0644 /etc/cron.d/amnezia-cron \
&& crontab /etc/cron.d/amnezia-cron \
&& touch /var/log/cron.log \
&& touch /var/log/metrics_monitor.log \
&& touch /var/log/metrics_collector.log
&& touch /var/log/metrics_collector.log \
&& touch /var/log/ldap_sync.log
# Make monitor script executable
RUN chmod +x /var/www/html/bin/monitor_metrics.sh