Subversion Repositories ALCASAR

Rev

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

Rev 2447 Rev 2465
Line 33... Line 33...
33
#	base_filter = $ldap_base_filter;
33
#	base_filter = $ldap_base_filter;
34
 
34
 
35
usage="Usage: alcasar-ldap.sh {--on or -on } | {--off or -off}"
35
usage="Usage: alcasar-ldap.sh {--on or -on } | {--off or -off}"
36
SED="/bin/sed -i"
36
SED="/bin/sed -i"
37
CONF_FILE="/usr/local/etc/alcasar.conf"
37
CONF_FILE="/usr/local/etc/alcasar.conf"
-
 
38
LDAP_MODULE="/etc/raddb/mods-available/ldap-alcasar"
38
INTIF=`grep ^INTIF= $CONF_FILE|cut -d"=" -f2`				# INTernal InterFace
39
INTIF=`grep ^INTIF= $CONF_FILE|cut -d"=" -f2`				# INTernal InterFace
-
 
40
LDAP_SERVER=`grep ^LDAP_SERVER= $CONF_FILE|cut -d"=" -f2`
-
 
41
LDAP_BASE=`grep ^LDAP_BASE= $CONF_FILE|cut -d"=" -f2`
-
 
42
LDAP_UID=`grep ^LDAP_UID= $CONF_FILE|cut -d"=" -f2`
-
 
43
LDAP_FILTER=`grep ^LDAP_FILTER= $CONF_FILE|cut -d"=" -f2`
-
 
44
LDAP_USER=`grep ^LDAP_USER= $CONF_FILE|cut -d"=" -f2`
-
 
45
LDAP_PASSWORD=`grep ^LDAP_PASSWORD= $CONF_FILE|cut -d"=" -f2`
39
 
-
 
40
nb_args=$#
46
nb_args=$#
41
args=$1
47
args=$1
42
if [ $nb_args -eq 0 ]
48
if [ $nb_args -eq 0 ]
43
then
49
then
44
	nb_args=1
50
	nb_args=1
Line 48... Line 54...
48
	-\? | -h* | --h*)
54
	-\? | -h* | --h*)
49
		echo "$usage"
55
		echo "$usage"
50
		exit 0
56
		exit 0
51
		;;
57
		;;
52
	--on | -on)	
58
	--on | -on)	
-
 
59
		$SED "s/^LDAP=.*/LDAP=on/g" $CONF_FILE
-
 
60
		$SED "s/^server =.*/server = ldap://$LDAP_SERVER/g" $LDAP_MODULE
-
 
61
		$SED "s/^identity =.*/identity = $LDAP_UID/g" $LDAP_MODULE
-
 
62
		$SED "s/^password =.*/password = $LDAP_PASSWORD/g" $LDAP_MODULE
-
 
63
		$SED "s/^base_dn =.*/base_dn = $LDAP_BASE/g" $LDAP_MODULE
-
 
64
		$SED "s/^filter =.*/filter = ($LDAP_UID=%{%{Stripped-User-Name}:-%{User-Name}})/g" $LDAP_MODULE
-
 
65
		ln -s $LDAP_MODULE /etc/raddb/mods-enabled/ldap
-
 
66
		/usr/bin/systemctl restart radiusd.service
53
		;;
67
		;;
54
	--off | -off)
68
	--off | -off)
-
 
69
		$SED "s/^LDAP=.*/LDAP=off/g" $CONF_FILE
-
 
70
		rm -f /etc/raddb/mods-enabled/ldap
-
 
71
		/usr/bin/systemctl restart radiusd.service
55
;;
72
;;
56
	*)
73
	*)
57
		echo "Argument inconnu :$1";
74
		echo "Argument inconnu :$1";
58
		echo "$usage"
75
		echo "$usage"
59
		exit 1
76
		exit 1