initial commit

This commit is contained in:
Carneiro 2025-02-27 10:31:46 -03:00
commit bc20e1df72
10 changed files with 518 additions and 0 deletions

31
config.php Normal file
View File

@ -0,0 +1,31 @@
<?php
$config->custom->appearance['friendly_attrs'] = array(
'facsimileTelephoneNumber' => 'Fax',
'gid' => 'Group',
'mail' => 'Email',
'telephoneNumber' => 'Telephone',
'uid' => 'User Name',
'userPassword' => 'Password'
);
// $config->custom->appearance['password_hash'] = 'ssha';
$servers = new Datastore();
$servers->newServer('ldap_pla');
$servers->setValue('server','name','Alice');
$servers->setValue('server','host','ldap://openldap');
$servers->setValue('appearance','pla_password_hash','ssha');
// $servers->setValue('server','port',389);
$servers->setValue('server','base',array('dc=alice,dc=ufsj'));
$servers->setValue('login','bind_id','cn=admin,dc=alice,dc=ufsj');
$servers->setValue('login','auth_type','session');
$servers->setValue('auto_number','min',array('uidNumber'=>10000,'gidNumber'=>10000));
// $config->custom->session['reCAPTCHA-enable'] = false;
// $config->custom->session['reCAPTCHA-key-site'] = '<put-here-key-site>';
// $config->custom->session['reCAPTCHA-key-server'] = '<put-here-key-server>';
?>

28
docker-compose.yml Normal file
View File

@ -0,0 +1,28 @@
services:
phpldapadmin:
image: osixia/phpldapadmin:latest
restart: 'unless-stopped'
container_name: phpldapadmin
command: --copy-service
environment:
PHPLDAPADMIN_LDAP_HOSTS: "openldap"
PHPLDAPADMIN_HTTPS: false
PHPLDAPADMIN_TRUST_PROXY_SSL: true
volumes:
- data:/var/www/phpldapadmin
- ./templates:/var/www/phpldapadmin/templates
- ./config.php:/container/service/phpldapadmin/assets/config/config.php:ro
networks:
- traefik-public
labels:
traefik.enable: true
traefik.http.routers.phpldapadmin.rule: Host(`ldap.alice.ufsj.edu.br`)
traefik.http.routers.phpldapadmin.entrypoints: websecure
traefik.http.services.phpldapadmin.loadBalancer.server.port: 80
volumes:
data:
networks:
traefik-public:
external: true

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE template SYSTEM "template.dtd">
<template>
<askcontainer>1</askcontainer>
<description>Novo Grupo</description>
<icon>ldap-ou.png</icon>
<invalid>0</invalid>
<rdn>cn</rdn>
<!-- <regexp>^ou=.*,</regexp> -->
<title>Grupo</title>
<visible>1</visible>
<objectClasses>
<objectClass id="groupOfEntries"></objectClass>
<objectClass id="posixGroup"></objectClass>
</objectClasses>
<attributes>
<attribute id="cn">
<display>Group</display>
<order>1</order>
<page>1</page>
</attribute>
<attribute id="gidNumber">
<display>GID Number</display>
<order>2</order>
<page>1</page>
<readonly>0</readonly>
<spacer>1</spacer>
<value>=php.GetNextNumber(/;gidNumber)</value>
<!-- <value><![CDATA[=php.GetNextNumber(/;gidNumber;false;(&(objectClass=posixGroup));*2,+1000)]]></value> -->
</attribute>
<attribute id="member">
<display>Users</display>
<hidden>0</hidden>
<order>3</order>
<page>1</page>
<!-- <value><![CDATA[=php.MultiList(/;(&(objectClass=posixAccount));cn;cn=%cn%,ou=users,dc=alice,dc=ufsj)]]></value> -->
<value><![CDATA[=php.MultiList(/;(&(objectClass=posixAccount));dn)]]></value>
</attribute>
</attributes>
</template>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE template SYSTEM "template.dtd">
<template>
<askcontainer>1</askcontainer>
<description>Novo Host</description>
<icon>host.png</icon>
<invalid>0</invalid>
<rdn>cn</rdn>
<title>IP Host</title>
<visible>1</visible>
<objectClasses>
<objectClass id="device"></objectClass>
<objectClass id="ipHost"></objectClass>
</objectClasses>
<attributes>
<attribute id="cn">
<display>Host</display>
<order>1</order>
<page>1</page>
</attribute>
<attribute id="ipHostNumber">
<display>IP</display>
<order>1</order>
<page>1</page>
</attribute>
<attribute id="serialNumber">
<display>MAC</display>
<order>1</order>
<page>1</page>
</attribute>
</attributes>
</template>

27
templates/creation/ou.xml Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE template SYSTEM "template.dtd">
<template>
<askcontainer>1</askcontainer>
<description>New Organisational Unit</description>
<icon>ldap-ou.png</icon>
<invalid>0</invalid>
<rdn>ou</rdn>
<!-- <regexp>^o=.*,</regexp> -->
<title>Organisational Unit</title>
<visible>1</visible>
<objectClasses>
<objectClass id="organizationalUnit"></objectClass>
</objectClasses>
<attributes>
<attribute id="ou">
<display>Organisational Unit</display>
<hint>don't include "ou="</hint>
<order>1</order>
<page>1</page>
</attribute>
</attributes>
</template>

View File

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE template SYSTEM "../template.dtd">
<template>
<askcontainer>1</askcontainer>
<description>New User Account</description>
<icon>ldap-user.png</icon>
<invalid>0</invalid>
<rdn>cn</rdn>
<!--<regexp>^ou=People,o=.*,</regexp>-->
<title>Usuário</title>
<visible>1</visible>
<objectClasses>
<objectClass id="inetOrgPerson"></objectClass>
<objectClass id="posixAccount"></objectClass>
<objectClass id="ldapPublicKey"></objectClass>
</objectClasses>
<attributes>
<attribute id="givenName">
<display>First name</display>
<icon>ldap-uid.png</icon>
<!-- <onchange>=autoFill(cn;%givenName% %sn%)</onchange> -->
<!-- <onchange>=autoFill(uid;%givenName|0-1/l%%sn/l%)</onchange> -->
<order>1</order>
<page>1</page>
</attribute>
<attribute id="sn">
<display>Last name</display>
<!-- <onchange>=autoFill(cn;%givenName% %sn%)</onchange> -->
<!-- <onchange>=autoFill(uid;%givenName|0-1/l%%sn/l%)</onchange> -->
<!-- <onchange>=autoFill(homeDirectory;/home/users/%uid|0-1/l%/%uid%)</onchange> -->
<order>2</order>
<page>1</page>
</attribute>
<attribute id="cn">
<display>Username (cn)</display>
<onchange>=autoFill(homeDirectory;/nethome/%cn%)</onchange>
<onchange>=autoFill(uid;%cn%)</onchange>
<order>3</order>
<page>1</page>
</attribute>
<attribute id="uid">
<display>User ID</display>
<readonly>1</readonly>
<order>4</order>
<page>1</page>
<spacer>1</spacer>
</attribute>
<attribute id="homeDirectory">
<display>Home directory</display>
<!-- <onchange>=autoFill(homeDirectory;/home/users/%gidNumber|0-0/T%/%uid|3-%)</onchange> -->
<order>8</order>
<page>1</page>
</attribute>
<attribute id="mail">
<display>Mail</display>
<order>8</order>
<page>1</page>
</attribute>
<attribute id="uidNumber">
<display>UID Number</display>
<icon>terminal.png</icon>
<order>6</order>
<page>1</page>
<readonly>1</readonly>
<value>=php.GetNextNumber(/;uidNumber)</value>
</attribute>
<attribute id="gidNumber">
<display>GID Number</display>
<!-- <onchange>=autoFill(homeDirectory;/home/users/%gidNumber|0-0/T%/%uid|3-%)</onchange> -->
<order>7</order>
<page>1</page>
<value><![CDATA[=php.PickList(/;(&(objectClass=posixGroup));gidNumber;%cn%;;;;cn)]]></value>
</attribute>
<attribute id="loginShell">
<display>Login shell</display>
<order>9</order>
<page>1</page>
<!-- <value><![CDATA[=php.PickList(/;(&(objectClass=posixAccount));loginShell;%loginShell%;;;;loginShell)]]></value> -->
<type>select</type>
<value id="/bin/bash">Bash</value>
<value id="/bin/csh">C Shell</value>
<value id="/bin/dash">Dash</value>
<value id="/bin/sh">Shell</value>
<value id="/bin/tsh">Turbo C Shell</value>
<value id="/bin/false">False</value>
<value id="/usr/sbin/nologin">No Login</value>
</attribute>
<attribute id="userPassword">
<display>Password</display>
<!-- <helper>
<display>Encryption</display>
<id>enc</id>
<value>=php.PasswordEncryptionTypes()</value>
</helper> -->
<icon>lock.png</icon>
<order>5</order>
<page>1</page>
<post>=php.PasswordEncrypt(%enc%;%userPassword%)</post>
<options>
<default>ssha</default>
</options>
<spacer>1</spacer>
<verify>1</verify>
</attribute>
<attribute id="sshPublicKey">
<display>SSH Public Key</display>
<icon>key.png</icon>
<order>8</order>
<page>1</page>
</attribute>
</attributes>
</template>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE template SYSTEM "template.dtd">
<template>
<askcontainer>1</askcontainer>
<description>New Simple Security Object</description>
<icon>ldap-user.png</icon>
<invalid>0</invalid>
<rdn>userid</rdn>
<!--<regexp>^ou=People,o=.*,</regexp>-->
<title>Simple Security Object</title>
<visible>1</visible>
<objectClasses>
<objectClass id="account"></objectClass>
<objectClass id="simpleSecurityObject"></objectClass>
</objectClasses>
<attributes>
<attribute id="userid">
<display>User Name</display>
<icon>ldap-uid.png</icon>
<order>1</order>
<page>1</page>
<spacer>1</spacer>
</attribute>
<attribute id="userPassword">
<display>Password</display>
<icon>lock.png</icon>
<order>5</order>
<page>1</page>
<post>=php.PasswordEncrypt(%enc%;%userPassword%)</post>
<verify>1</verify>
</attribute>
</attributes>
</template>

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE template SYSTEM "template.dtd">
<template>
<askcontainer>1</askcontainer>
<description>New Posix Group</description>
<icon>ldap-ou.png</icon>
<invalid>0</invalid>
<noleaf>1</noleaf>
<rdn>cn</rdn>
<!-- <regexp>^ou=.*,</regexp> -->
<title>Generic: Posix Group</title>
<visible>0</visible>
<objectClasses>
<objectClass id="posixGroup"></objectClass>
</objectClasses>
<attributes>
<attribute id="cn">
<display>Group</display>
<order>1</order>
<page>1</page>
</attribute>
<attribute id="gidNumber">
<display>GID Number</display>
<!-- <option><![CDATA[=php.GetNextNumber(/;gidNumber;false;(&(objectClass=posixGroup));*2,+1000)]]></option> -->
<order>2</order>
<page>1</page>
<readonly>1</readonly>
<spacer>1</spacer>
<value>=php.GetNextNumber(/;gidNumber)</value>
</attribute>
<attribute id="memberUid">
<display>Users</display>
<hidden>0</hidden>
<order>3</order>
<page>1</page>
<value><![CDATA[=php.MultiList(/;(objectClass=posixAccount);uid;%cn% (%uid|-4%))]]></value>
</attribute>
</attributes>
</template>

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE template SYSTEM "template.dtd">
<template>
<description>Address Book Entry</description>
<icon>address-book.png</icon>
<invalid>0</invalid>
<rdn>cn</rdn>
<noleaf>1</noleaf>
<!--<regexp>^ou=People,o=.*,</regexp>-->
<title>Generic: Address Book Entry</title>
<visible>0</visible>
<objectClasses>
<objectClass id="inetOrgPerson"></objectClass>
</objectClasses>
<attributes>
<attribute id="givenName">
<display>First name</display>
<icon>ldap-uid.png</icon>
<onchange>=autoFill(cn;%givenName% %sn%)</onchange>
<order>1</order>
</attribute>
<attribute id="sn">
<display>Last name</display>
<onchange>=autoFill(cn;%givenName% %sn%)</onchange>
<order>2</order>
</attribute>
<attribute id="cn">
<display>Common Name</display>
<order>3</order>
<readonly>1</readonly>
<spacer>1</spacer>
</attribute>
<attribute id="jpegPhoto">
<display>Photo</display>
<order>3</order>
<spacer>1</spacer>
</attribute>
<attribute id="o">
<display>Organisation</display>
<order>4</order>
</attribute>
<attribute id="street">
<cols>50</cols>
<display>Street</display>
<icon>mail.png</icon>
<order>5</order>
<rows>4</rows>
<type>textarea</type>
</attribute>
<attribute id="l">
<display>City</display>
<order>6</order>
</attribute>
<attribute id="st">
<display>State</display>
<order>7</order>
</attribute>
<attribute id="postalCode">
<display>Postal code</display>
<order>8</order>
<spacer>1</spacer>
</attribute>
<attribute id="telephoneNumber">
<display>Work phone</display>
<icon>phone.png</icon>
<order>9</order>
</attribute>
<attribute id="facsimileTelephoneNumber">
<display>Fax</display>
<order>10</order>
</attribute>
<attribute id="mobile">
<display>Mobile</display>
<order>11</order>
</attribute>
<attribute id="mail">
<display>Email</display>
<order>12</order>
</attribute>
</attributes>
</template>

71
templates/template.dtd Normal file
View File

@ -0,0 +1,71 @@
<!--
==========================================================================
This is the DTD for phpLDAPAdmin Templates.
Copyright (c) 2009
Temporary URI for the DTD: http://phpldapadmin.sf.net/release/templates/template.dtd
Validate your templates here: http://www.xmlvalidation.com
==========================================================================
-->
<!-- Unused -->
<!ENTITY % Boolean "(0 | 1)">
<!-- ================================================================ -->
<!-- Template Definition -->
<!ELEMENT template (askcontainer?,description?,icon?,invalid?,rdn?,regexp?,
title,visible?,objectClasses,attributes)>
<!-- ObjectClasses Definition -->
<!ELEMENT objectClasses (objectClass+)>
<!ELEMENT objectClass EMPTY>
<!ATTLIST objectClass id CDATA #REQUIRED>
<!-- Attributes Definition -->
<!ELEMENT attributes (attribute*)>
<!ELEMENT attribute (cols?,default?,display?,helper?,hidden?,hint?,icon?,
maxlength?,onchange*,order?,page?,post?,presubmit?,readonly?,rows?,size?,
spacer?,type?,value*,verify?)?>
<!ATTLIST attribute id CDATA #REQUIRED>
<!-- helper -->
<!ELEMENT helper (default?,display?,id?,value*)>
<!-- ================================================================ -->
<!-- Common Parameters -->
<!ELEMENT icon (#PCDATA)>
<!ELEMENT default (#PCDATA)>
<!ELEMENT display (#PCDATA)>
<!ELEMENT value (#PCDATA)>
<!-- Header Parameters -->
<!ELEMENT askcontainer (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT invalid (#PCDATA)>
<!ELEMENT rdn (#PCDATA)>
<!ELEMENT regexp (#PCDATA)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT visible (#PCDATA)>
<!-- Attribute Parameters -->
<!ELEMENT cols (#PCDATA)>
<!ELEMENT hidden (#PCDATA)>
<!ELEMENT hint (#PCDATA)>
<!ELEMENT maxlength (#PCDATA)>
<!ELEMENT onchange (#PCDATA)>
<!ELEMENT order (#PCDATA)>
<!ELEMENT page (#PCDATA)>
<!ELEMENT post (#PCDATA)>
<!ELEMENT presubmit (#PCDATA)>
<!ELEMENT readonly (#PCDATA)>
<!ELEMENT rows (#PCDATA)>
<!ELEMENT size (#PCDATA)>
<!ELEMENT spacer (#PCDATA)>
<!ELEMENT type (#PCDATA)>
<!ELEMENT verify (#PCDATA)>
<!-- Helper Parameters -->
<!ELEMENT id (#PCDATA)>