Subversion Repositories ALCASAR

Rev

Rev 2474 | Rev 2705 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2474 Rev 2490
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
 
2
 
-
 
3
# $Id: alcasar-ldap.sh 2490 2018-02-26 00:49:37Z tom.houdayer $
-
 
4
 
3
# alcasar-ldap.sh
5
# alcasar-ldap.sh
4
# by Rexy
6
# by Rexy
5
# This script is distributed under the Gnu General Public License (GPL)
7
# This script is distributed under the Gnu General Public License (GPL)
6
 
8
 
7
# activation / désactivation de l'authentification des utilisateurs via un serveur LDAP externe
9
# activation / désactivation de l'authentification des utilisateurs via un serveur LDAP externe
Line 29... Line 31...
29
		echo "$usage"
31
		echo "$usage"
30
		exit 0
32
		exit 0
31
		;;
33
		;;
32
	--on | -on)	
34
	--on | -on)	
33
		$SED "s/^LDAP=.*/LDAP=on/g" $CONF_FILE
35
		$SED "s/^LDAP=.*/LDAP=on/g" $CONF_FILE
34
		$SED "s/^server =.*/server = ldap:\/\/$LDAP_SERVER/g" $LDAP_MODULE
36
		$SED "s/^\tserver =.*/\tserver = \"ldap:\/\/${LDAP_SERVER//\"/\\\\\\\"}\"/g" $LDAP_MODULE
35
		$SED "s/^identity =.*/identity = $LDAP_USER/g" $LDAP_MODULE
37
		$SED "s/^\tidentity =.*/\tidentity = \"${LDAP_USER//\"/\\\\\\\"}\"/g" $LDAP_MODULE
36
		$SED "s/^password =.*/password = $LDAP_PASSWORD/g" $LDAP_MODULE
38
		$SED "s/^\tpassword =.*/\tpassword = \"${LDAP_PASSWORD//\"/\\\\\\\"}\"/g" $LDAP_MODULE
37
		$SED "s/^base_dn =.*/base_dn = \"$LDAP_BASE\"/g" $LDAP_MODULE
39
		$SED "s/^\tbase_dn =.*/\tbase_dn = \"${LDAP_BASE//\"/\\\\\\\"}\"/g" $LDAP_MODULE
38
		$SED "s/^filter =.*/filter = \"($LDAP_UID=%{%{Stripped-User-Name}:-%{User-Name}})\"/g" $LDAP_MODULE
40
		$SED "s/^\tfilter =.*/\tfilter = \"(${LDAP_UID//\"/\\\\\\\"}=%{%{Stripped-User-Name}:-%{User-Name}})\"/g" $LDAP_MODULE
39
		if [ ! -e /etc/raddb/mods-enabled/ldap ]
41
		if [ ! -e /etc/raddb/mods-enabled/ldap ]
40
		then
42
		then
41
			ln -s $LDAP_MODULE /etc/raddb/mods-enabled/ldap
43
			ln -s $LDAP_MODULE /etc/raddb/mods-enabled/ldap
42
		fi
44
		fi
43
		if [ -e /etc/raddb/sites-enabled/alcasar ]
45
		if [ -e /etc/raddb/sites-enabled/alcasar ]