From ece4ededee300abdbb0fa115350da1048617fede Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Tue, 18 Jun 2013 17:05:27 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=B5=D0=BE=D0=B1=D1=85=D0=BE?= =?UTF-8?q?=D0=B4=D0=B8=D0=BC=D0=BE=D1=81=D1=82=D0=B8=20=D1=88=D0=B8=D1=84?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=84=D0=B8=D0=BB=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Добавлено правило: если каталог содержит только данные от бутстрапа cl-core, то его необходимо шифровать при включенном общем шифровании. --- calculate/lib/utils/common.py | 10 ++++++++++ calculate/lib/variables/user.py | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/calculate/lib/utils/common.py b/calculate/lib/utils/common.py index 1799713..53e07ad 100644 --- a/calculate/lib/utils/common.py +++ b/calculate/lib/utils/common.py @@ -471,3 +471,13 @@ def mountEcryptfs(userName,userPwd,userDir): # отправить пароль через stdin mountProcess.write("passphrase_passwd="+userPwd) return mountProcess.success() + +def isBootstrapDataOnly(directory): + """ + Каталог содержит только сертификат, созданный командой cl-core + """ + from calculate.lib.utils.files import (process,readLinesFile,STDOUT, + isMount) + userCalculate = path.join(directory,".calculate") + return (set(listDirectory(directory)) == set([".calculate"]) and + set(listDirectory(userCalculate)) == set(["client_cert"])) diff --git a/calculate/lib/variables/user.py b/calculate/lib/variables/user.py index e8e378f..7b3596a 100644 --- a/calculate/lib/variables/user.py +++ b/calculate/lib/variables/user.py @@ -21,7 +21,7 @@ import grp from os import environ,path from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable from calculate.lib.cl_vars_share import varsShare -from calculate.lib.utils.common import getPasswdUsers +from calculate.lib.utils.common import getPasswdUsers,isBootstrapDataOnly from calculate.lib.utils.files import listDirectory import sys from calculate.lib.cl_lang import setLocalTranslate @@ -229,7 +229,8 @@ class VariableUrHomeCryptSet(ReadonlyVariable): # если пользовательского профиля нет, то шифровать ли профиль # узнаем на уровне системы homeDir = self.Get('ur_home_path') - if not path.exists(homeDir) or not listDirectory(homeDir): + if (not path.exists(homeDir) or not listDirectory(homeDir) or + isBootstrapDataOnly(homeDir)): return self.Get('cl_home_crypt_set') # профиль не шифрованный return "off"