diff --git a/ldif/jabber_user.ldif b/ldif/jabber_user.ldif index 5bd4e68..fd169e9 100644 --- a/ldif/jabber_user.ldif +++ b/ldif/jabber_user.ldif @@ -4,6 +4,6 @@ objectClass: inetOrgPerson uid: #-ur_name-# cn: #-ur_fio-# sn: #-ur_fio-# -mail: #-ur_name-#@#-os_net_hostname-#.#-os_net_domain-# +mail: #-ur_name-#@#-sr_jabber_host-# initials: Yes userPassword: #-ur_hash-# diff --git a/ldif/mail_group.ldif b/ldif/mail_group.ldif index 98ab492..9b39774 100644 --- a/ldif/mail_group.ldif +++ b/ldif/mail_group.ldif @@ -3,7 +3,7 @@ dn: cn=#-ur_group-#,ou=Groups,#-ld_mail_dn-# objectClass: nisNetgroup objectClass: qmailGroup cn: #-ur_group-# -mail: #-ur_group-#@#-os_net_hostname-#.#-os_net_domain-# -mailAlternateAddress: #-ur_group-#@#-os_net_hostname-#.#-os_net_domain-# +mail: #-ur_group-#@#-sr_mail_host-# +mailAlternateAddress: #-ur_group-#@#-sr_mail_host-# mailMessageStore: #-ur_group-#/ description: #-ur_group_comment-# \ No newline at end of file diff --git a/ldif/mail_user.ldif b/ldif/mail_user.ldif index 1f5dcd8..72e039e 100644 --- a/ldif/mail_user.ldif +++ b/ldif/mail_user.ldif @@ -6,5 +6,5 @@ uid: #-ur_name-# cn: #-ur_fio-# sn: #-ur_fio-# accountStatus: active -mail: #-ur_name-#@#-os_net_hostname-#.#-os_net_domain-# +mail: #-ur_name-#@#-sr_mail_host-# userPassword: #-ur_hash-# diff --git a/profile/jabber/etc/jabber/ejabberd.cfg b/profile/jabber/etc/jabber/ejabberd.cfg index d61a493..ca6fe1f 100644 --- a/profile/jabber/etc/jabber/ejabberd.cfg +++ b/profile/jabber/etc/jabber/ejabberd.cfg @@ -4,7 +4,7 @@ %%% {loglevel, 4}. -{hosts, ["localhost", "#-os_net_hostname-#.#-os_net_domain-#"]}. +{hosts, ["localhost", "#-sr_jabber_host-#"]}. {listen, [ {#-sr_jabber_port-#, ejabberd_c2s, [ @@ -26,14 +26,14 @@ ]}. {auth_method, ldap}. {ldap_servers, ["localhost"]}. -{ldap_uids, [{"mail", "%u@#-os_net_hostname-#.#-os_net_domain-#"}]}. +{ldap_uids, [{"mail", "%u@#-sr_jabber_host-#"}]}. {ldap_base, "#-ld_jabber_dn-#"}. {ldap_rootdn, "#-ld_jabber_dn-#"}. {ldap_filter, "(initials=Yes)"}. {ldap_password, "#-ld_jabber_pw-#"}. {shaper, normal, {maxrate, 1000}}. {shaper, fast, {maxrate, 50000}}. -{acl, admin, {user, "admin", "#-os_net_hostname-#.#-os_net_domain-#"}}. +{acl, admin, {user, "admin", "#-sr_jabber_host-#"}}. {acl, local, {user_regexp, ""}}. {access, max_user_sessions, [{10, all}]}. {access, local, [{allow, local}]}. diff --git a/profile/mail/etc/postfix/main.cf b/profile/mail/etc/postfix/main.cf index 5196279..7f5785a 100644 --- a/profile/mail/etc/postfix/main.cf +++ b/profile/mail/etc/postfix/main.cf @@ -22,7 +22,7 @@ daemon_directory = /usr/lib/postfix mail_owner = postfix #Имя хоста -myhostname = #-os_net_hostname-#.#-os_net_domain-# +myhostname = #-sr_mail_host-# #Определяет домен данного компьютера. По умолчанию преобразуется из myhostname #mydomain = local.calculate.ru diff --git a/pym/cl_ldap.py b/pym/cl_ldap.py index 64dcf36..37c44a8 100644 --- a/pym/cl_ldap.py +++ b/pym/cl_ldap.py @@ -2771,9 +2771,7 @@ class servMail(shareLdap): if "@" in altMail: mail = altMail else: - mail = "%s@%s.%s" %(altMail, - self.clVars.Get("os_net_hostname"), - self.clVars.Get("os_net_domain")) + mail = "%s@%s" %(altMail,self.clVars.Get("sr_mail_host")) if not primaryMail: primaryMail = mail if self.searchUserToMail(mail) or\ @@ -2822,9 +2820,7 @@ in Unix service ...") %str(primaryMail)) if "@" in altMail: mail = altMail else: - mail = "%s@%s.%s" %(altMail, - self.clVars.Get("os_net_hostname"), - self.clVars.Get("os_net_domain")) + mail = "%s@%s" %(altMail,self.clVars.Get("sr_mail_host")) if self.searchUserToMail(mail) or\ self.searchGroupToMail(mail): self.printERROR( @@ -2837,9 +2833,7 @@ in Unix service ...") %str(primaryMail)) _("group name %s is found in Mail service")%\ str(groupName) + " ...") return False - mail = "%s@%s.%s" %(groupName, - self.clVars.Get("os_net_hostname"), - self.clVars.Get("os_net_domain")) + mail = "%s@%s" %(groupName,self.clVars.Get("sr_mail_host")) if self.searchUserToMail(mail) or\ self.searchGroupToMail(mail): self.printERROR( @@ -2930,9 +2924,8 @@ in Unix service ...") %str(primaryMail)) if res[0][0][1].has_key('rfc822member'): usersInGroup = res[0][0][1]['rfc822member'] for userName in usersNames: - userMail = "%s@%s.%s" %(userName, - self.clVars.Get("os_net_hostname"), - self.clVars.Get("os_net_domain")) + userMail = "%s@%s" %(userName, + self.clVars.Get("sr_mail_host")) if userMail in usersInGroup: findUsers.append(userName) return findUsers @@ -3033,9 +3026,7 @@ in Unix service ...") %str(primaryMail)) addUsers.append(user) modAttrs = [] for userName in addUsers: - userMail = "%s@%s.%s" %(userName, - self.clVars.Get("os_net_hostname"), - self.clVars.Get("os_net_domain")) + userMail = "%s@%s" %(userName,self.clVars.Get("sr_mail_host")) modAttrs.append((ldap.MOD_ADD, 'rfc822member', userMail)) if modAttrs: groupDN = self.addDN("cn="+groupName, self.relGroupsDN) @@ -3070,9 +3061,7 @@ in Unix service ...") %str(primaryMail)) if "@" in altMail: mail = altMail else: - mail = "%s@%s.%s" %(altMail, - self.clVars.Get("os_net_hostname"), - self.clVars.Get("os_net_domain")) + mail = "%s@%s" %(altMail,self.clVars.Get("sr_mail_host")) if not primaryMail: primaryMail = mail if self.searchUserToMail(mail) or\ @@ -3091,9 +3080,7 @@ in Unix service ...") %str(primaryMail)) self.printERROR(_("User exists in Mail service")) return False else: - mail = "%s@%s.%s" %(userName, - self.clVars.Get("os_net_hostname"), - self.clVars.Get("os_net_domain")) + mail = "%s@%s" %(userName,self.clVars.Get("sr_mail_host")) if self.searchUserToMail(mail) or\ self.searchGroupToMail(mail): self.printERROR( @@ -3266,8 +3253,13 @@ in Unix service ...") %str(primaryMail)) # Имя устанавливаемого сервиса self.clVars.Set("cl_pass_service","mail") self.clVars.Write("sr_mail_set","off") - # Cоздаем объект профиль устанавливая директорию mail для - # файлов профилей + # Почтовый ност + if options.has_key("mail-host"): + fullHostName = options['mail-host'] + else: + fullHostName = "%s.%s"%(self.clVars.Get('os_net_hostname'), + self.clVars.Get('os_net_domain')) + self.clVars.Set("sr_mail_host",fullHostName,True) if not self.applyProfilesFromService('mail'): return False # Проверим запущен ли ldap @@ -3330,10 +3322,10 @@ in Unix service ...") %str(primaryMail)) # Устанавливаем автозапуск демона if not self.setDaemonAutostart("dovecot"): return False + #запишем переменные для сервера + mailHost = self.clVars.Get("sr_mail_host") + self.clVars.Write("sr_mail_host",mailHost,True,"local") #запишем переменные для клиента - fullHostName = "%s.%s"%(self.clVars.Get('os_net_hostname'), - self.clVars.Get('os_net_domain')) - self.clVars.Set("sr_mail_host",fullHostName,True) self.clVars.Set("sr_mail_send_host",fullHostName) clientVars = ["sr_mail_host","sr_mail_crypt", "sr_mail_port", "sr_mail_type","sr_mail_send_crypt","sr_mail_send_port", @@ -3805,9 +3797,7 @@ class servJabber(shareLdap): if checkSetup and not self.isServiceSetup("jabber"): return False #jabber id - jabberId = "%s@%s.%s" %(userName, - self.clVars.Get("os_net_hostname"), - self.clVars.Get("os_net_domain")) + jabberId = "%s@%s" %(userName,self.clVars.Get("sr_jabber_host")) if self.searchUserToId(jabberId): self.printERROR(_("User exists in Jabber service")) return False @@ -3906,6 +3896,12 @@ class servJabber(shareLdap): # Имя устанавливаемого сервиса self.clVars.Set("cl_pass_service","jabber") self.clVars.Write("sr_jabber_set","off") + if options.has_key("jabber-host"): + fullHostName = options['jabber-host'] + else: + fullHostName = "%s.%s"%(self.clVars.Get('os_net_hostname'), + self.clVars.Get('os_net_domain')) + self.clVars.Set("sr_jabber_host",fullHostName,True) # Cоздаем объект профиль устанавливая директорию jabber для # файлов профилей if not self.applyProfilesFromService('jabber'): @@ -3944,9 +3940,7 @@ class servJabber(shareLdap): return False # Администратор сервиса adminName = "admin" - adminFullName = "%s@%s.%s" %(adminName, - self.clVars.Get("os_net_hostname"), - self.clVars.Get("os_net_domain")) + adminFullName = "%s@%s" %(adminName, self.clVars.Get("sr_jabber_host")) print _("Enter the %s password" % adminFullName) if not self.addUserJabberServer(adminName,{'p':""}, False): return False @@ -3970,10 +3964,10 @@ class servJabber(shareLdap): # Устанавливаем автозапуск демона if not self.setDaemonAutostart("ejabberd"): return False + #запишем переменные для сервера + jabberHost = self.clVars.Get("sr_jabber_host") + self.clVars.Write("sr_jabber_host",jabberHost,True,"local") #запишем переменные для клиента - fullHostName = "%s.%s"%(self.clVars.Get('os_net_hostname'), - self.clVars.Get('os_net_domain')) - self.clVars.Set("sr_jabber_host",fullHostName,True) clientVars = ["sr_jabber_host","sr_jabber_crypt","sr_jabber_port"] if not self.saveVarsClient(clientVars): return False @@ -4270,6 +4264,18 @@ class servSamba(shareLdap): if not flagError and createDirLogon: if not self.createUserDir(uid, gid, createDirLogon): flagError = True + # cоздадим cmd файл для монтирования ресурсов в windows + if not flagError: + netbios = self.clVars.Get("sr_samba_netbios") + netbios = netbios.upper() + fileTxt="NET USE R: /D\r\nNET USE R: \\%s\share"\ + %netbios + fileDirectory = os.path.join(createDirLogon, + "start.cmd") + print "FILE =", fileDirectory + if not self.createUserFile(fileDirectory, + fileTxt, uid, gid): + flagError = True # Cоздаем директорию профиля win if not flagError and createDirWinProfile: if not self.createUserDir(uid,gid,createDirWinProfile): @@ -4357,7 +4363,6 @@ class servSamba(shareLdap): self.printERROR(_("Can not add machine")+ " ...") return False - def setupSambaServer(self, options): """Начальная настройка Samba сервиса""" # Принудительная установка @@ -4501,13 +4506,21 @@ class servSamba(shareLdap): self.printERROR(_("not created samba user 'client'")) return False # Если нет то создадим директорию /var/calculate/remote - remotePath = "/var/calculate/remote" + remoteEnvFile = self.clVars.Get("cl_env_path")[0] + remotePath = os.path.split(remoteEnvFile)[0] if not os.path.exists(remotePath): os.makedirs(remotePath) # права и владелец /var/calculate/remote if os.path.exists(remotePath): - os.chown(remotePath,int(clientUid),int(clientGid)) - os.chmod(remotePath,0750) + os.chown(remotePath,0,int(clientGid)) + os.chmod(remotePath,02750) + # изменяем владельца remote на client + if not os.path.exists(remoteEnvFile): + fd = os.open(remoteEnvFile, os.O_CREAT) + os.close(fd) + os.chmod(remoteEnvFile, 0640) + if os.path.exists(remoteEnvFile): + os.chown(remoteEnvFile,0,int(clientGid)) if not self.setDaemonAutostart("slapd"): return False # Устанавливаем автозапуск демона @@ -4524,6 +4537,9 @@ class servSamba(shareLdap): gid = 0 if not self.createUserFile(fileDirectory, fileTxt, uid, gid): return False + #запишем переменные для сервера + netbios = self.clVars.Get("sr_samba_netbios") + self.clVars.Write("sr_mail_host",netbios,True,"local") #запишем переменные для клиента fullHostName = "%s.%s"%(self.clVars.Get('os_net_hostname'), self.clVars.Get('os_net_domain')) @@ -5746,6 +5762,18 @@ preferences and data (for users with uid<1000)") 'helpChapter':_("Samba service options"), 'help':_("workgroup, default 'Calculate'") }, + {'progAccess':(6,), + 'optVal':"HOST", + 'longOption':"mail-host", + 'helpChapter':_("Mail service options"), + 'help':_("mail-host, default - hostname") + }, + {'progAccess':(6,), + 'optVal':"HOST", + 'longOption':"jabber-host", + 'helpChapter':_("Jabber service options"), + 'help':_("jabber-host, default - hostname") + }, # Опции cl-passwd # LDAP пользователь {'progAccess':(7,),