|
|
|
@ -1,13 +1,13 @@
|
|
|
|
|
#-*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
#Copyright 2008 Calculate Pack, http://www.calculate-linux.ru
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
@ -736,7 +736,7 @@ http://distro.ibiblio.org/pub/linux/distributions/gentoo"
|
|
|
|
|
# Определим путь к LDAP-записям пользователей
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
#базовый суффикс
|
|
|
|
|
Set('soft_ldap_base',"dc=CDS",True)
|
|
|
|
|
Set('soft_ldap_base',"dc=%s"%(Get('soft_ldap_root')),True)
|
|
|
|
|
#алгоритм шифрования паролей
|
|
|
|
|
Set('soft_ldap_hash_encrypt',"{SSHA}",True)
|
|
|
|
|
#пользовательский доступ к базе с доступом только для чтения
|
|
|
|
@ -745,7 +745,7 @@ http://distro.ibiblio.org/pub/linux/distributions/gentoo"
|
|
|
|
|
(Get('soft_ldap_bindname'),\
|
|
|
|
|
Get('soft_ldap_base'))\
|
|
|
|
|
,True)
|
|
|
|
|
Set('soft_ldap_bindpw',"CDS",True)
|
|
|
|
|
Set('soft_ldap_bindpw',"calculate",True)
|
|
|
|
|
val="%s slappasswd -s %s -h %s"%\
|
|
|
|
|
(self.G_path,\
|
|
|
|
|
Get('soft_ldap_bindpw'),\
|
|
|
|
@ -754,22 +754,22 @@ http://distro.ibiblio.org/pub/linux/distributions/gentoo"
|
|
|
|
|
if res:
|
|
|
|
|
Set('soft_ldap_bindpw_hash',res,True)
|
|
|
|
|
#временный пользователь root для инициализации базы данных
|
|
|
|
|
Set('soft_ldap_root_tmp', "cn=ldaproot,%s"%Get('soft_ldap_base'),\
|
|
|
|
|
Set('soft_ldap_admin_tmp', "cn=ldapadmin,%s"%Get('soft_ldap_base'),\
|
|
|
|
|
True)
|
|
|
|
|
Set('soft_ldap_rootpw_tmp',cl_utils.genpassword().strip(),True)
|
|
|
|
|
Set('soft_ldap_adminpw_tmp',cl_utils.genpassword().strip(),True)
|
|
|
|
|
cstr='%s slappasswd -s %s -h %s'%\
|
|
|
|
|
(self.G_path,\
|
|
|
|
|
Get('soft_ldap_rootpw_tmp'),\
|
|
|
|
|
Get('soft_ldap_adminpw_tmp'),\
|
|
|
|
|
Get('soft_ldap_hash_encrypt')
|
|
|
|
|
)
|
|
|
|
|
res=cm(cstr)
|
|
|
|
|
if res:
|
|
|
|
|
Set('soft_ldap_rootpw_tmp_hash',res.strip(),True)
|
|
|
|
|
Set('soft_ldap_adminpw_tmp_hash',res.strip(),True)
|
|
|
|
|
#постоянный пользователь root, прописываемый в базу при первой загрузке
|
|
|
|
|
#с одновременным удалением временного root-а
|
|
|
|
|
Set('soft_ldap_rootname',"ldapadmin",True)
|
|
|
|
|
Set('soft_ldap_root',"cn=%s,%s"%\
|
|
|
|
|
(Get('soft_ldap_rootname'),\
|
|
|
|
|
Set('soft_ldap_adminname',"ldapadmin",True)
|
|
|
|
|
Set('soft_ldap_admin',"cn=%s,%s"%\
|
|
|
|
|
(Get('soft_ldap_adminname'),\
|
|
|
|
|
Get('soft_ldap_base')\
|
|
|
|
|
),True)
|
|
|
|
|
if os.path.exists('/etc/smbldap-tools/smbldap_bind.conf'):
|
|
|
|
@ -778,18 +778,18 @@ http://distro.ibiblio.org/pub/linux/distributions/gentoo"
|
|
|
|
|
res=cm(cstr)
|
|
|
|
|
rs=re.search('[^=]+="(.+)"',res.strip())
|
|
|
|
|
if rs:
|
|
|
|
|
Set('soft_ldap_rootpw',rs.group(1),True)
|
|
|
|
|
if not Get('soft_ldap_rootpw') or\
|
|
|
|
|
Get('soft_ldap_rootpw')=="secret":
|
|
|
|
|
Set('soft_ldap_rootpw',cl_utils.genpassword().strip(),True)
|
|
|
|
|
Set('soft_ldap_adminpw',rs.group(1),True)
|
|
|
|
|
if not Get('soft_ldap_adminpw') or\
|
|
|
|
|
Get('soft_ldap_adminpw')=="secret":
|
|
|
|
|
Set('soft_ldap_adminpw',cl_utils.genpassword().strip(),True)
|
|
|
|
|
cstr='%s slappasswd -s %s -h %s'%\
|
|
|
|
|
(self.G_path,\
|
|
|
|
|
Get('soft_ldap_rootpw'),\
|
|
|
|
|
Get('soft_ldap_adminpw'),\
|
|
|
|
|
Get('soft_ldap_hash_encrypt')\
|
|
|
|
|
)
|
|
|
|
|
res=cm(cstr)
|
|
|
|
|
if res:
|
|
|
|
|
Set('soft_ldap_rootpw_hash',res.strip(),True)
|
|
|
|
|
Set('soft_ldap_adminpw_hash',res.strip(),True)
|
|
|
|
|
#*****************************************************************************
|
|
|
|
|
#Заполнение глобальных переменных
|
|
|
|
|
#*****************************************************************************
|
|
|
|
|