59,58 → 59,24 |
exit("Vous n'avez pas les droits d'écriture sur le fichier /etc/raddb/mods-available/ldap"); |
} |
|
/**************************************************************** |
* File sites-enabled/alcasar * |
*****************************************************************/ |
/* |
ON ACTIVE LE LDAP |
*/ |
/* |
Configure autorize section with: |
ldap { |
fail=1 |
} |
*/ |
/* |
Configure authenticate section with |
Auth-Type LDAP { |
ldap |
} |
*/ |
/* |
|
/**************************************************************** |
* File mods/available/ldap * |
*****************************************************************/ |
//$ldap->host = $ldap_server; |
//$ldap->identity = $ldap_user; |
//$ldap->password = $ldap_password; |
//$ldap->basedn = $ldap_base_dn; |
//$ldap->filter = $ldap_filter; |
//$ldap->uid = $ldap_filter; |
//$ldap->base_filter = $ldap_base_filter; |
|
/******************************************************** |
* File modification & services restart * |
* Conf file modification & ldap script call * |
*********************************************************/ |
//test d'accès au serveur |
//si réussite |
// - écriture config ldap complète dans alcasar.conf |
// - appel script-shell (alcasar-ldap.sh) |
// - modif des 2 fichier ci-dessus |
// - actions si dessous |
// After testing serveur access |
if ($auth_enable == "1") { |
file_put_contents(ALCASAR_CONF_FILE, str_replace('LDAP=off', 'LDAP=on', file_get_contents(ALCASAR_CONF_FILE))); |
exec("sed -i \"s/^LDAP_IP=.*/LDAP_IP=$ldap_server/g\" ".ALCASAR_CONF_FILE); |
exec("ln -s /etc/raddb/mods-available/ldap /etc/raddb/mods-enabled/ldap"); |
exec("sed -i \"s/^LDAP=.*/LDAP=on/g\" ".ALCASAR_CONF_FILE); |
exec("sed -i \"s/^LDAP_SERVER=.*/LDAP_SERVER=$ldap_server/g\" ".ALCASAR_CONF_FILE); |
exec("sed -i \"s/^LDAP_BASE=.*/LDAP_BASE=$ldap_base_dn/g\" ".ALCASAR_CONF_FILE); |
exec("sed -i \"s/^LDAP_UID=.*/LDAP_UID=$ldap_filter/g\" ".ALCASAR_CONF_FILE); |
exec("sed -i \"s/^LDAP_FILTER=.*/LDAP_FILTER=$ldap_filter/g\" ".ALCASAR_CONF_FILE); |
exec("sed -i \"s/^LDAP_USER=.*/LDAP_USER=$ldap_user/g\" ".ALCASAR_CONF_FILE); |
exec("sed -i \"s/^LDAP_PASSWORD=.*/LDAP_PASSWORD=$ldap_password/g\" ".ALCASAR_CONF_FILE); |
exec("sudo /usr/local/bin/alcasar-ldap.sh -on"); |
} |
else { |
file_put_contents(ALCASAR_CONF_FILE, str_replace('LDAP=on', 'LDAP=off', file_get_contents(ALCASAR_CONF_FILE))); |
exec("sed -i \"s/^LDAP_IP=.*/LDAP_IP=0.0.0.0/g\" ".ALCASAR_CONF_FILE); |
exec("rm -f /etc/raddb/mods-enabled/ldap"); |
exec("sed -i \"s/^LDAP=.*/LDAP=off/g\" ".ALCASAR_CONF_FILE); |
exec("sudo /usr/local/bin/alcasar-ldap.sh -off"); |
} |
#exec("sudo /usr/local/bin/alcasar-iptables.sh"); |
#exec("sudo /usr/bin/systemctl restart radiusd"); |
|
/**************************************************************** |
* Redirection vers la page de configuration LDAP * |